]> git.sur5r.net Git - openldap/commitdiff
add support to test exceptional behavior (abandon/cancel/ignore)
authorPierangelo Masarati <ando@openldap.org>
Sat, 13 Jan 2007 15:03:15 +0000 (15:03 +0000)
committerPierangelo Masarati <ando@openldap.org>
Sat, 13 Jan 2007 15:03:15 +0000 (15:03 +0000)
clients/tools/common.c

index 4cf7edcd401aa8dcd99b07ad869f212a3f41ca9d..fbacf5ad2991a30285f4cfc3dc931006b6e3db3c 100644 (file)
@@ -202,7 +202,9 @@ N_("             [!]preread[=<attrs>]   (a comma-separated attribute list)\n")
 #ifdef LDAP_DEVEL
 N_("             [!]relax\n")
 #endif
-N_("             abandon, cancel (SIGINT sends abandon/cancel; not really controls)\n"),
+N_("             abandon, cancel, ignore (SIGINT sends abandon/cancel,\n"
+   "             or ignores response; if critical, doesn't wait for SIGINT.\n"
+   "             not really controls)\n")
 N_("  -f file    read operations from `file'\n"),
 N_("  -h host    LDAP server\n"),
 N_("  -H URI     LDAP Uniform Resource Indentifier(s)\n"),
@@ -502,9 +504,21 @@ tool_args( int argc, char **argv )
                        /* this shouldn't go here, really; but it's a feature... */
                        } else if ( strcasecmp( control, "abandon" ) == 0 ) {
                                abcan = LDAP_REQ_ABANDON;
+                               if ( crit ) {
+                                       gotintr = abcan;
+                               }
 
                        } else if ( strcasecmp( control, "cancel" ) == 0 ) {
                                abcan = LDAP_REQ_EXTENDED;
+                               if ( crit ) {
+                                       gotintr = abcan;
+                               }
+
+                       } else if ( strcasecmp( control, "ignore" ) == 0 ) {
+                               abcan = -1;
+                               if ( crit ) {
+                                       gotintr = abcan;
+                               }
 
                        } else {
                                fprintf( stderr, "Invalid general control name: %s\n",
@@ -1424,6 +1438,10 @@ tool_check_abandon( LDAP *ld, int msgid )
                fprintf( stderr, "got interrupt, abandon got %d: %s\n",
                                rc, ldap_err2string( rc ) );
                return -1;
+
+       case -1:
+               /* just unbind, ignoring the request */
+               return -1;
        }
 
        return 0;