Comment 14 for bug 1602813

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

The code was just checking for a -1 return value, which means "something bad", and missed the timeout case. Since we missed the timeout return value, the followupcheck for the LDAP_TIMEOUT err was never reached:

- if (ldap_result(ldapConn, msgid, 1, &timeout, &res) == -1) {
+ if (ldap_result(ldapConn, msgid, 1, &timeout, &res) <= 0) {
   err = ldap_get_errno(ldapConn);
   if (err == LDAP_TIMEOUT)

The function's "result" *parameter* can't be used in any case:

       int ldap_result( LDAP *ld, int msgid, int all,
            struct timeval *timeout, LDAPMessage **result );

"Upon success, the type of the result received is returned and the result parameter will contain the result of the operation; otherwise, the result parameter is undefined."