Browse Source

Bug 727511 - ldclt SSL search requests are failing with "illegal error number -1" error

https://bugzilla.redhat.com/show_bug.cgi?id=727511
Resolves: bug 727511
Bug Description: ldclt SSL search requests are failing with "illegal error number -1" error
Reviewed by: me
Branch: master
Fix Description: Fix coverity NULL deref defect in ldclt_clientauth
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
Rich Megginson 14 years ago
parent
commit
053cc6aed4
1 changed files with 4 additions and 4 deletions
  1. 4 4
      ldap/servers/slapd/tools/ldclt/ldapfct.c

+ 4 - 4
ldap/servers/slapd/tools/ldclt/ldapfct.c

@@ -635,7 +635,7 @@ ldclt_get_sec_pwd(PK11SlotInfo *slot, PRBool retry, void *arg)
 }
 
 static int
-ldclt_clientauth(thread_context	*tttctx, const char *path, const char *certname, const char *pwd)
+ldclt_clientauth(thread_context	*tttctx, LDAP *ld, const char *path, const char *certname, const char *pwd)
 {
   const char *colon = NULL;
   char *token_name = NULL;
@@ -686,14 +686,14 @@ ldclt_clientauth(thread_context	*tttctx, const char *path, const char *certname,
     goto done;
   }
 
-  if ((rc = ldap_set_option(tttctx->ldapCtx, LDAP_OPT_X_TLS_CERTFILE, certname))) {
+  if ((rc = ldap_set_option(ld, LDAP_OPT_X_TLS_CERTFILE, certname))) {
     printf ("ldclt[%d]: T%03d: Cannot ldap_set_option(ld, LDAP_OPT_X_CERTFILE, %s), errno=%d ldaperror=%d:%s\n",
 	    mctx.pid, thrdNum, certname, errno, rc, my_ldap_err2string(rc));
     fflush (stdout);
     goto done;
   }
 
-  if ((rc = ldap_set_option(tttctx->ldapCtx, LDAP_OPT_X_TLS_KEYFILE, pwd))) {
+  if ((rc = ldap_set_option(ld, LDAP_OPT_X_TLS_KEYFILE, pwd))) {
     printf ("ldclt[%d]: T%03d: Cannot ldap_set_option(ld, LDAP_OPT_X_KEYFILE, %s), errno=%d ldaperror=%d:%s\n",
 	    mctx.pid, thrdNum, pwd, errno, rc, my_ldap_err2string(rc));
     fflush (stdout);
@@ -772,7 +772,7 @@ connectToLDAP(thread_context *tttctx, const char *bufBindDN, const char *bufPass
       goto done;
     }
     if ((mode & CLTAUTH) &&
-	(ret = ldclt_clientauth(tttctx, certdir, mctx.cltcertname, mctx.keydbpin))) {
+        (ret = ldclt_clientauth(tttctx, ld, certdir, mctx.cltcertname, mctx.keydbpin))) {
       free(certdir);
       goto done;
     }