]> git.sur5r.net Git - openldap/blobdiff - clients/tools/ldapexop.c
Merge remote branch 'origin/mdb.master'
[openldap] / clients / tools / ldapexop.c
index f17e085d3a9508cefc526333aae12a6a4926635e..4e3f48ac6646b30c6db9a2bfbf918e1b745f6fc9 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2005-2011 The OpenLDAP Foundation.
+ * Copyright 2005-2012 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -213,7 +213,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;
@@ -247,7 +247,7 @@ main( int argc, char *argv[] )
                char            *retoid = NULL;
                struct berval   *retdata = NULL;
 
-               rc = ldap_parse_extended_result( ld, res, &retoid, &retdata, 1 );
+               rc = ldap_parse_extended_result( ld, res, &retoid, &retdata, 0 );
 
                if ( rc != LDAP_SUCCESS ) {
                        tool_perror( "ldap_parse_extended_result", rc, NULL, NULL, NULL, NULL );
@@ -294,7 +294,7 @@ main( int argc, char *argv[] )
                        printf(_("# extended operation response\n"));
                }
 
-               rc = ldap_parse_extended_result( ld, res, &retoid, &retdata, 1 );
+               rc = ldap_parse_extended_result( ld, res, &retoid, &retdata, 0 );
                if ( rc != LDAP_SUCCESS ) {
                        tool_perror( "ldap_parse_extended_result", rc, NULL, NULL, NULL, NULL );
                        rc = EXIT_FAILURE;
@@ -318,7 +318,8 @@ main( int argc, char *argv[] )
                }
        }
 
-       if( verbose || ( code != LDAP_SUCCESS ) || matcheddn || text || refs ) {
+       if( verbose || code != LDAP_SUCCESS ||
+               ( matcheddn && *matcheddn ) || ( text && *text ) || refs ) {
                printf( _("Result: %s (%d)\n"), ldap_err2string( code ), code );
 
                if( text && *text ) {
@@ -350,8 +351,5 @@ skip:
        /* disconnect from server */
        if ( res )
                ldap_msgfree( res );
-       tool_unbind( ld );
-       tool_destroy();
-
-       return code == LDAP_SUCCESS ? EXIT_SUCCESS : EXIT_FAILURE;
+       tool_exit( ld, code == LDAP_SUCCESS ? EXIT_SUCCESS : EXIT_FAILURE );
 }