X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libraries%2Flibldap%2Fresult.c;h=05580b793cfa8215566cb412215f35021927bf8b;hb=a5cad3f18a4b8fbbbb1bfc5db9d00022d9ebbfc4;hp=ad62a02d30749e00d16a9dcd38f86825ad630ca3;hpb=82d17d860eb8d1d97c34e862847423ed3873ef84;p=openldap diff --git a/libraries/libldap/result.c b/libraries/libldap/result.c index ad62a02d30..05580b793c 100644 --- a/libraries/libldap/result.c +++ b/libraries/libldap/result.c @@ -2,7 +2,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * - * Copyright 1998-2009 The OpenLDAP Foundation. + * Copyright 1998-2010 The OpenLDAP Foundation. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -276,7 +276,7 @@ wait4msg( } #endif /* LDAP_DEBUG */ - if ( timeout != NULL ) { + if ( timeout != NULL && timeout->tv_sec != -1 ) { tv0 = *timeout; tv = *timeout; tvp = &tv; @@ -747,8 +747,9 @@ nextresp2: } /* Do we need to check for referrals? */ - if ( LDAP_BOOL_GET(&ld->ld_options, LDAP_BOOL_REFERRALS) || - lr->lr_parent != NULL ) + if ( tag != LDAP_RES_BIND && + ( LDAP_BOOL_GET(&ld->ld_options, LDAP_BOOL_REFERRALS) || + lr->lr_parent != NULL )) { char **refs = NULL; ber_len_t len; @@ -845,6 +846,10 @@ nextresp2: return( -1 ); /* fatal error */ } lr->lr_res_errno = LDAP_SUCCESS; /* sucessfully chased referral */ + if ( lr->lr_res_matched ) { + LDAP_FREE( lr->lr_res_matched ); + lr->lr_res_matched = NULL; + } } else { if ( lr->lr_outrefcnt <= 0 && lr->lr_parent == NULL ) { @@ -989,6 +994,7 @@ nextresp2: /* need to return -1, because otherwise * a valid result is expected */ + ld->ld_errno = lderr; return -1; } }