]> git.sur5r.net Git - openldap/commitdiff
fix resource handling
authorPierangelo Masarati <ando@openldap.org>
Mon, 9 Jan 2006 16:14:26 +0000 (16:14 +0000)
committerPierangelo Masarati <ando@openldap.org>
Mon, 9 Jan 2006 16:14:26 +0000 (16:14 +0000)
tests/progs/slapd-search.c

index b0469cbcd060507e2909497a47653ea21aaac944..27dcca656370e0746c5e160df1877008473e4ab3 100644 (file)
@@ -181,11 +181,11 @@ retry:;
        rc = ldap_bind_s( ld, manager, passwd, LDAP_AUTH_SIMPLE );
        if ( rc != LDAP_SUCCESS ) {
                ldap_perror( ld, "ldap_bind" );
-               ldap_unbind_ext( ld, NULL, NULL );
                switch ( rc ) {
                case LDAP_BUSY:
                case LDAP_UNAVAILABLE:
                        if ( do_retry > 0 ) {
+                               ldap_unbind_ext( ld, NULL, NULL );
                                do_retry--;
                                if ( delay != 0 ) {
                                    sleep( delay );
@@ -206,8 +206,8 @@ retry:;
                                filter, attrs, 0, &res );
                if ( rc != LDAP_SUCCESS ) {
                        ldap_perror( ld, "ldap_search" );
-                       ldap_unbind_ext( ld, NULL, NULL );
                        if ( rc == LDAP_BUSY && do_retry > 0 ) {
+                               ldap_unbind_ext( ld, NULL, NULL );
                                do_retry--;
                                goto retry;
                        }