diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2013-01-18 20:40:54 +0100 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2013-03-03 11:35:52 +0100 |
commit | f2c49e6ac286174584dceeaf8552d3cef45f94d7 (patch) | |
tree | d38ff25822a5a5e67848097d0a1792867fcd1ce5 /nslcd/myldap.c | |
parent | 117327e5e97ac87d64e4fb0809141d9f40665d7b (diff) |
pass the session along to the do_bind() function
Diffstat (limited to 'nslcd/myldap.c')
-rw-r--r-- | nslcd/myldap.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/nslcd/myldap.c b/nslcd/myldap.c index 19407bf..014d414 100644 --- a/nslcd/myldap.c +++ b/nslcd/myldap.c @@ -398,8 +398,7 @@ static int do_sasl_interact(LDAP UNUSED(*ld), unsigned UNUSED(flags), The binddn and bindpw parameters may be used to override the authentication mechanism defined in the configuration. This returns an LDAP result code. */ -static int do_bind(LDAP *ld, const char *binddn, const char *bindpw, - const char *uri) +static int do_bind(MYLDAP_SESSION *session, LDAP *ld, const char *uri) { int rc; #ifdef HAVE_LDAP_SASL_INTERACTIVE_BIND_S @@ -423,12 +422,14 @@ static int do_bind(LDAP *ld, const char *binddn, const char *bindpw, } #endif /* LDAP_OPT_X_TLS */ /* check if the binddn and bindpw are overwritten in the session */ - if ((binddn != NULL) && (binddn[0] != '\0')) + if ((session->binddn != NULL) && (session->binddn[0] != '\0')) { /* do a simple bind */ log_log(LOG_DEBUG, "ldap_simple_bind_s(\"%s\",%s) (uri=\"%s\")", - binddn, ((bindpw != NULL) && (bindpw[0] != '\0')) ? "\"***\"" : "\"\"", uri); - return ldap_simple_bind_s(ld, binddn, bindpw); + session->binddn, + ((session->bindpw != NULL) && (session->bindpw[0] != '\0')) ? "\"***\"" : "\"\"", + uri); + return ldap_simple_bind_s(ld, session->binddn, session->bindpw); } /* perform SASL bind if requested and available on platform */ #ifdef HAVE_LDAP_SASL_INTERACTIVE_BIND_S @@ -498,7 +499,7 @@ static int do_rebind(LDAP *ld, LDAP_CONST char *url, { MYLDAP_SESSION *session = (MYLDAP_SESSION *)arg; log_log(LOG_DEBUG, "rebinding to %s", url); - return do_bind(ld, session->binddn, session->bindpw, url); + return do_bind(session, ld, url); } #else /* not recent OpenLDAP */ static int do_rebind(LDAP *ld, char **dnp, char **passwdp, int *authmethodp, @@ -810,8 +811,7 @@ static int do_open(MYLDAP_SESSION *session) } /* bind to the server */ errno = 0; - rc = do_bind(session->ld, session->binddn, session->bindpw, - nslcd_cfg->uris[session->current_uri].uri); + rc = do_bind(session, session->ld, nslcd_cfg->uris[session->current_uri].uri); if (rc != LDAP_SUCCESS) { /* log actual LDAP error code */ |