]> git.sur5r.net Git - openldap/commitdiff
fix extra controls in tools
authorPierangelo Masarati <ando@openldap.org>
Tue, 21 Aug 2007 14:50:08 +0000 (14:50 +0000)
committerPierangelo Masarati <ando@openldap.org>
Tue, 21 Aug 2007 14:50:08 +0000 (14:50 +0000)
clients/tools/common.c

index 1c84ff2a5aa16edff4ffdb2dbb0363493c296049..8c7469e010320c4143487b7347a0b782c8e39c17 100644 (file)
@@ -522,20 +522,9 @@ tool_args( int argc, char **argv )
                                        gotintr = abcan;
                                }
 
-                       } else {
-                               char            *ptr;
+                       } else if ( tool_is_oid( control ) ) {
                                LDAPControl     *tmpctrls, ctrl;
 
-                               for ( ptr = control; ptr[0] != '\0'; ptr++ ) {
-                                       if ( ptr[0] == '.' || isdigit( ptr[0] ) ) {
-                                               continue;
-                                       }
-
-                                       fprintf( stderr, "Invalid general control name: %s\n",
-                                               control );
-                                       usage();
-                               }
-
                                tmpctrls = (LDAPControl *)realloc( unknown_ctrls,
                                        (unknown_ctrls_num + 1)*sizeof( LDAPControl ) );
                                if ( tmpctrls == NULL ) {
@@ -572,6 +561,11 @@ tool_args( int argc, char **argv )
 
                                unknown_ctrls[ unknown_ctrls_num ] = ctrl;
                                unknown_ctrls_num++;
+
+                       } else {
+                               fprintf( stderr, "Invalid general control name: %s\n",
+                                       control );
+                               usage();
                        }
                        break;
                case 'f':       /* read from file */
@@ -1379,7 +1373,8 @@ tool_server_controls( LDAP *ld, LDAPControl *extra_c, int count )
 #ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR
                || chaining
 #endif /* LDAP_CONTROL_X_CHAINING_BEHAVIOR */
-               || count ) )
+               || count
+               || unknown_ctrls_num ) )
        {
                return;
        }