[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: strange problem: FIXED



On Tue, 28 Dec 2004 10:35:36 -0500
Adam Tauno Williams <adam@morrison-ind.com> wrote:

ATW> > I'm successfully using mod_ldap on hosing system, with FreeBSD
ATW> > 4.8 and proftpd 1.2.9, OpenLDAP 2.0.23; however, I've got
ATW> > problems on 5.3/1.3.0/2.2.19. Problem is QUITE strange. 
ATW> >   if ((ld = ldap_init(ldap_server, LDAP_PORT)) == NULL) {
ATW> >     printf("mod_ldap: pr_ldap_connect(): ldap_init() to %s
ATW> >     failed: %s", ldap_server, strerror(errno)); return -1;
ATW> >   }
ATW> >   if ((ret = ldap_simple_bind_s(ld, ldap_dn, ldap_dnpass) !=
ATW> >   LDAP_SUCCESS)) {
ATW> >     printf("mod_ldap: pr_ldap_connect(): ldap_simple_bind() to %s
ATW> >     as %s:%s failed (%d): %s", ldap_server, ldap_dn, ldap_dnpass,
ATW> >     ret, ldap_err2string(ret)); return -1;
ATW> >   }

Fixed the problem. I don't know if it is a pecularity of gcc version 3.4.2 [FreeBSD] 20040728, or something else; anyway, I've made the code a bit more correct

--- mod_ldap.c.orig     Tue Dec 28 13:40:51 2004
+++ mod_ldap.c  Tue Dec 28 13:45:34 2004
@@ -244,7 +244,7 @@
 #endif /* USE_LDAP_TLS */

   if (bind == TRUE) {
-    if ((ret = ldap_simple_bind_s(*conn_ld, ldap_dn, ldap_dnpass) != LDAP_SUCCESS)) {
+    if ((ret = ldap_simple_bind_s(*conn_ld, ldap_dn, ldap_dnpass)) != LDAP_SUCCESS) {
       pr_log_pri(PR_LOG_ERR, "mod_ldap: pr_ldap_connect(): ldap_simple_bind() as %s failed: %s", ldap_dn, ldap_err2string(ret));
       return -1;
     }
@@ -1126,7 +1126,7 @@
       return DECLINED(cmd);
     }

-    if ((ret = ldap_simple_bind_s(ld_auth, ldap_authbind_dn, cmd->argv[2]) != LDAP_SUCCESS)) {
+    if ((ret = ldap_simple_bind_s(ld_auth, ldap_authbind_dn, cmd->argv[2])) != LDAP_SUCCESS) {
       if (ret != LDAP_INVALID_CREDENTIALS)
         pr_log_pri(PR_LOG_ERR, "mod_ldap: handle_ldap_check(): pr_ldap_connect() failed: %s", ldap_err2string(ret));
       ldap_unbind(ld_auth);

NOW it works just fine.

-- 
Alex.