]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/error.c
ITS#399: timelimit/timeout handling
[openldap] / libraries / libldap / error.c
index 81de8d8a27ee6a2b65c9754314fd918071302cab..d1fefd66dfe3b0506b53e679829bc77987dd4027 100644 (file)
@@ -160,6 +160,7 @@ ldap_perror( LDAP *ld, LDAP_CONST char *str )
        fflush( stderr );
 }
 
+/* deprecated */
 int
 ldap_result2error( LDAP *ld, LDAPMessage *r, int freeit )
 {
@@ -316,7 +317,7 @@ ldap_parse_result(
        }
 
        if ( tag == LBER_ERROR ) {
-               errcode = LDAP_DECODING_ERROR;
+               ld->ld_errno = errcode = LDAP_DECODING_ERROR;
        }
 
        if( ber != NULL ) {
@@ -324,10 +325,10 @@ ldap_parse_result(
        }
 
        /* return */
+       if( errcodep != NULL ) {
+               *errcodep = ld->ld_errno;
+       }
        if ( errcode == LDAP_SUCCESS ) {
-               if( errcodep != NULL ) {
-                       *errcodep = ld->ld_errno;
-               }
                if( matcheddnp != NULL ) {
                        *matcheddnp = LDAP_STRDUP( ld->ld_matched );
                }