summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristof Schmitt <cs@samba.org>2016-09-26 14:40:28 -0700
committerJeremy Allison <jra@samba.org>2016-09-29 22:17:20 +0200
commit7a3b7804cba53a21739e8912b005ab498e921eb7 (patch)
tree8068e70def75f69ee44b6816f60eb2c482c7a0b5
parent1017b22f68e798a080e0738d3beecf008b2284ef (diff)
downloadsamba-7a3b7804cba53a21739e8912b005ab498e921eb7.tar.gz
idmap_ad: Fix retrieving credentials from clustered secrets.tdb
cli_credentials_set_machine_account only reads from a local tdb. Change that call to cli_credentials_set_machine_account_db_ctx to fix this for clustered Samba. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12295 Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
-rw-r--r--source3/winbindd/idmap_ad.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/source3/winbindd/idmap_ad.c b/source3/winbindd/idmap_ad.c
index 242b788773b..c385cf0e5e7 100644
--- a/source3/winbindd/idmap_ad.c
+++ b/source3/winbindd/idmap_ad.c
@@ -22,6 +22,7 @@
#include "idmap.h"
#include "tldap_gensec_bind.h"
#include "tldap_util.h"
+#include "secrets.h"
#include "lib/param/param.h"
#include "utils/net.h"
#include "auth/gensec/gensec.h"
@@ -242,6 +243,7 @@ static NTSTATUS idmap_ad_get_tldap_ctx(TALLOC_CTX *mem_ctx,
const char *domname,
struct tldap_context **pld)
{
+ struct db_context *db_ctx;
struct netr_DsRGetDCNameInfo *dcinfo;
struct sockaddr_storage dcaddr;
struct cli_credentials *creds;
@@ -308,7 +310,14 @@ static NTSTATUS idmap_ad_get_tldap_ctx(TALLOC_CTX *mem_ctx,
cli_credentials_set_conf(creds, lp_ctx);
- status = cli_credentials_set_machine_account(creds, lp_ctx);
+ db_ctx = secrets_db_ctx();
+ if (db_ctx == NULL) {
+ DBG_DEBUG("Failed to open secrets.tdb.\n");
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+
+ status = cli_credentials_set_machine_account_db_ctx(creds, lp_ctx,
+ db_ctx);
if (!NT_STATUS_IS_OK(status)) {
DBG_DEBUG("cli_credentials_set_machine_account "
"failed: %s\n", nt_errstr(status));