diff options
author | Günther Deschner <gd@samba.org> | 2011-11-15 23:56:38 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2011-11-16 12:26:26 +0100 |
commit | 65e2944c678a7d4d111ee00e9e964fde14b163a6 (patch) | |
tree | f583a2ed29949dc794b95f6e2966b6d4deb13296 /source3/passdb | |
parent | af50d7a57fcc69d0bc5928410618f253071e9759 (diff) | |
download | samba-65e2944c678a7d4d111ee00e9e964fde14b163a6.tar.gz samba-65e2944c678a7d4d111ee00e9e964fde14b163a6.tar.bz2 samba-65e2944c678a7d4d111ee00e9e964fde14b163a6.zip |
s3-smbldap: extend smbldap_init() with binddn/bindsecret arguments.
Guenther
Diffstat (limited to 'source3/passdb')
-rw-r--r-- | source3/passdb/pdb_ldap.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c index 701b74609b..49eb3e12fa 100644 --- a/source3/passdb/pdb_ldap.c +++ b/source3/passdb/pdb_ldap.c @@ -6447,6 +6447,8 @@ static NTSTATUS pdb_init_ldapsam_common(struct pdb_methods **pdb_method, const c { NTSTATUS nt_status; struct ldapsam_privates *ldap_state; + char *bind_dn = NULL; + char *bind_secret = NULL; if (!NT_STATUS_IS_OK(nt_status = make_pdb_method( pdb_method ))) { return nt_status; @@ -6489,9 +6491,17 @@ static NTSTATUS pdb_init_ldapsam_common(struct pdb_methods **pdb_method, const c return NT_STATUS_NO_MEMORY; } - nt_status = smbldap_init(*pdb_method, pdb_get_tevent_context(), - location, &ldap_state->smbldap_state); + if (!fetch_ldap_pw(&bind_dn, &bind_secret)) { + DEBUG(0, ("pdb_init_ldapsam_common: Failed to retrieve LDAP password from secrets.tdb\n")); + return NT_STATUS_NO_MEMORY; + } + nt_status = smbldap_init(*pdb_method, pdb_get_tevent_context(), + location, false, bind_dn, bind_secret, + &ldap_state->smbldap_state); + memset(bind_secret, '\0', strlen(bind_secret)); + SAFE_FREE(bind_secret); + SAFE_FREE(bind_dn); if ( !NT_STATUS_IS_OK(nt_status) ) { return nt_status; } |