[tpop3d-discuss] tpop3d v1.4.1pre4

Prune prune at lecentre.net
Mon, 25 Feb 2002 12:00:32 +0100


Also, as I said earlier, this part has a bug :


   /* Try to bind to the LDAP server, reconnecting if it's gone away. */
    for (i = 0; i < 3; ++i) {
        if (ldapinfo.ldap && (ret = ldap_simple_bind_s(ldapinfo.ldap, 
ldapinfo.searchdn, ldapinfo.password)) != LDAP_SUCCESS) {
            log_print(LOG_ERR, "auth_ldap_new_user_pass: 
ldap_simple_bind_s: %s", ldap_err2string(ret));
            ldap_unbind(ldapinfo.ldap);  /* not much we can do if this 
fails.... */
            ldapinfo.ldap = NULL;
        }
        if (!ldapinfo.ldap)
            auth_ldap_connect();
    }


It ALWAYS bind 3 times (if no error)!
but it should bind only one time in case of success.
This is just in case tpop3d disconnect from the ldap server, it tries 3 
times for reconnect and bind.
When the connection is still valid, it actually bind 3 times...

maybe we could change this to :

   /* Try to bind to the LDAP server, reconnecting if it's gone away. */
    for (i = 0; i < 3; ++i) {
        if (ldapinfo.ldap && (ret = ldap_simple_bind_s(ldapinfo.ldap, 
ldapinfo.searchdn, ldapinfo.password)) != LDAP_SUCCESS) {
            log_print(LOG_ERR, "auth_ldap_new_user_pass: 
ldap_simple_bind_s: %s", ldap_err2string(ret));
            ldap_unbind(ldapinfo.ldap);  /* not much we can do if this 
fails.... */
            ldapinfo.ldap = NULL;
        }

        else break;

        if (!ldapinfo.ldap)
         auth_ldap_connect();
    }

-
Prune