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."

-- 
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to the bug report.
https://bugs.launchpad.net/bugs/1602813

Title:
  openvpn-auth-ldap causing segfault on network timeout

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/openvpn-auth-ldap/+bug/1602813/+subscriptions

-- 
Ubuntu-server-bugs mailing list
Ubuntu-server-bugs@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server-bugs

Reply via email to