]> git.sur5r.net Git - openldap/commitdiff
return the error code, much like the rest of the tools
authorPierangelo Masarati <ando@openldap.org>
Thu, 15 Dec 2005 18:01:00 +0000 (18:01 +0000)
committerPierangelo Masarati <ando@openldap.org>
Thu, 15 Dec 2005 18:01:00 +0000 (18:01 +0000)
clients/tools/common.c

index 5608a23a712b47911c505e86e5673bc2d64c9bce..bb79e9e0a0a9648b1a28266137ca6baa3fab457b 100644 (file)
@@ -946,7 +946,7 @@ tool_bind( LDAP *ld )
                                fprintf( stderr,
                                        "Could not set LDAP_OPT_X_SASL_SECPROPS: %s\n",
                                        sasl_secprops );
-                               exit( EXIT_FAILURE );
+                               exit( LDAP_OPERATIONS_ERROR );
                        }
                }
 
@@ -965,12 +965,12 @@ tool_bind( LDAP *ld )
                if( rc != LDAP_SUCCESS ) {
                        tool_perror( "ldap_sasl_interactive_bind_s",
                                rc, NULL, NULL, NULL, NULL );
-                       exit( EXIT_FAILURE );
+                       exit( rc );
                }
 #else
                fprintf( stderr, "%s: not compiled with SASL support\n",
                        prog );
-               exit( EXIT_FAILURE );
+               exit( rc );
 #endif
        } else {
                int msgid, err, rc;
@@ -988,7 +988,7 @@ tool_bind( LDAP *ld )
                        msgid = ldap_bind( ld, binddn, passwd.bv_val, authmethod );
                        if ( msgid == -1 ) {
                                tool_perror( "ldap_bind", -1, NULL, NULL, NULL, NULL );
-                               exit( EXIT_FAILURE );
+                               exit( LDAP_OPERATIONS_ERROR );
                        }
                } else
 #endif
@@ -999,20 +999,20 @@ tool_bind( LDAP *ld )
                        if ( msgid == -1 ) {
                                tool_perror( "ldap_sasl_bind(SIMPLE)", rc,
                                        NULL, NULL, NULL, NULL );
-                               exit( EXIT_FAILURE );
+                               exit( rc );
                        }
                }
 
                if ( ldap_result( ld, msgid, LDAP_MSG_ALL, NULL, &result ) == -1 ) {
                        tool_perror( "ldap_result", -1, NULL, NULL, NULL, NULL );
-                       exit( EXIT_FAILURE );
+                       exit( LDAP_OPERATIONS_ERROR );
                }
 
                rc = ldap_parse_result( ld, result, &err, &matched, &info, &refs,
                        &ctrls, 1 );
                if ( rc != LDAP_SUCCESS ) {
                        tool_perror( "ldap_bind parse result", rc, NULL, NULL, NULL, NULL );
-                       exit( EXIT_FAILURE );
+                       exit( LDAP_OPERATIONS_ERROR );
                }
 
 #ifdef LDAP_CONTROL_PASSWORDPOLICYREQUEST
@@ -1062,7 +1062,7 @@ tool_bind( LDAP *ld )
                        if( info ) ber_memfree( info );
                        if( refs ) ber_memvfree( (void **)refs );
 
-                       if ( err != LDAP_SUCCESS ) exit( EXIT_FAILURE );
+                       if ( err != LDAP_SUCCESS ) exit( err );
                }
        }
 }