]> git.sur5r.net Git - openldap/blobdiff - clients/tools/ldapvc.c
Merge commit 'd53644f6'
[openldap] / clients / tools / ldapvc.c
index 73166b1d8ee61a083a976d564ce483b34c4552bf..409a4af9a619af096e84c6c8d34dac2d287abac4 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2011 The OpenLDAP Foundation.
+ * Copyright 1998-2012 The OpenLDAP Foundation.
  * Portions Copyright 2010 Kurt D. Zeilenga.
  * All rights reserved.
  *
@@ -382,7 +382,7 @@ main( int argc, char *argv[] )
                                ldap_get_option(ld, LDAP_OPT_DIAGNOSTIC_MESSAGE, (void*) &text);
                                tool_perror( "ldap_verify_credentials_interactive", rc, NULL, NULL, text, NULL);
                                ldap_memfree(text);
-                               exit(rc);
+                               tool_exit(ld, rc);
                        }
                } while (rc == LDAP_SASL_BIND_IN_PROGRESS);
 
@@ -415,7 +415,7 @@ main( int argc, char *argv[] )
                    struct timeval      tv;
 
                    if ( tool_check_abandon( ld, id ) ) {
-                           return LDAP_CANCELLED;
+                           tool_exit( ld, LDAP_CANCELLED );
                    }
 
                    tv.tv_sec = 0;
@@ -424,7 +424,7 @@ main( int argc, char *argv[] )
                    rc = ldap_result( ld, LDAP_RES_ANY, LDAP_MSG_ALL, &tv, &res );
                    if ( rc < 0 ) {
                            tool_perror( "ldap_result", rc, NULL, NULL, NULL, NULL );
-                           return rc;
+                           tool_exit( ld, rc );
                    }
 
                    if ( rc != 0 ) {
@@ -504,8 +504,5 @@ skip:
        free( cred.bv_val );
 
        /* disconnect from server */
-       tool_unbind( ld );
-       tool_destroy();
-
-       return code == LDAP_SUCCESS ? EXIT_SUCCESS : EXIT_FAILURE;
+       tool_exit( ld, code == LDAP_SUCCESS ? EXIT_SUCCESS : EXIT_FAILURE );
 }