]> git.sur5r.net Git - openldap/commitdiff
Allow generation of no-op control
authorKurt Zeilenga <kurt@openldap.org>
Fri, 30 Aug 2002 04:14:26 +0000 (04:14 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Fri, 30 Aug 2002 04:14:26 +0000 (04:14 +0000)
clients/tools/ldapsearch.c

index 885bfc36a03669a90722e1637f44fe4c60fee087..2c76231943d41d6d1c2b7b9d4d02e9c9aa78b03c 100644 (file)
@@ -943,11 +943,11 @@ main( int argc, char **argv )
                }
        }
 
-       if ( manageDSAit || valuesReturnFilter ) {
+       if ( manageDSAit || noop || valuesReturnFilter ) {
                int err;
                int i=0;
-               LDAPControl c1,c2;
-               LDAPControl *ctrls[3];
+               LDAPControl c1,c2,c3;
+               LDAPControl *ctrls[4];
                
                if ( manageDSAit ) {
                        ctrls[i++]=&c1;
@@ -959,12 +959,22 @@ main( int argc, char **argv )
                        c1.ldctl_iscritical = manageDSAit > 1;
                }
 
+               if ( noop ) {
+                       ctrls[i++] = &c2;
+                       ctrls[i] = NULL;
+
+                       c2.ldctl_oid = LDAP_CONTROL_NOOP;
+                       c2.ldctl_value.bv_val = NULL;
+                       c2.ldctl_value.bv_len = 0;
+                       c2.ldctl_iscritical = noop > 1;
+               }
+
                if ( valuesReturnFilter ) {
-                       ctrls[i++]=&c2;
+                       ctrls[i++]=&c3;
                        ctrls[i] = NULL;
 
-                       c2.ldctl_oid = LDAP_CONTROL_VALUESRETURNFILTER;
-                       c2.ldctl_iscritical = valuesReturnFilter > 1;
+                       c3.ldctl_oid = LDAP_CONTROL_VALUESRETURNFILTER;
+                       c3.ldctl_iscritical = valuesReturnFilter > 1;
                    
                if (( ber = ber_alloc_t(LBER_USE_DER)) == NULL ) {
                                return EXIT_FAILURE;
@@ -980,7 +990,7 @@ main( int argc, char **argv )
                                return EXIT_FAILURE;
                        }
 
-                       c2.ldctl_value=(*bvalp);
+                       c3.ldctl_value=(*bvalp);
                }
 
                err = ldap_set_option( ld, LDAP_OPT_SERVER_CONTROLS, ctrls );
@@ -997,7 +1007,7 @@ main( int argc, char **argv )
                        }
                }
        }
-
+       
        if ( verbose ) {
                fprintf( stderr, "filter%s: %s\nrequesting: ",
                        infile != NULL ? " pattern" : "",