]> git.sur5r.net Git - openldap/commitdiff
control updates
authorKurt Zeilenga <kurt@openldap.org>
Fri, 30 Aug 2002 03:07:01 +0000 (03:07 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Fri, 30 Aug 2002 03:07:01 +0000 (03:07 +0000)
clients/tools/ldapcompare.c
clients/tools/ldapdelete.c
clients/tools/ldapmodify.c
clients/tools/ldapmodrdn.c
clients/tools/ldappasswd.c
clients/tools/ldapsearch.c
clients/tools/ldapwhoami.c
clients/tools/ldapwhoami.dsp [new file with mode: 0644]

index c47f609ea4f7ceac6dfa6e9bd5f348fea9498553..4786bd991cb4d7da3e2cd9636d12a8a12e5bb3e7 100644 (file)
@@ -47,6 +47,9 @@ usage( const char *s )
 "Common options:\n"
 "  -d level   set LDAP debugging level to `level'\n"
 "  -D binddn  bind DN\n"
+"  -e [!]<ctrl>[=<ctrlparam>] general controls (! indicates criticality)\n"
+"             [!]manageDSAit   (alternate form, see -M)\n"
+"             [!]noop\n"
 "  -h host    LDAP server\n"
 "  -H URI     LDAP Uniform Resource Indentifier(s)\n"
 "  -I         use SASL Interactive mode\n"
@@ -105,14 +108,15 @@ main( int argc, char **argv )
 {
        char    *compdn = NULL, *attrs = NULL;
        char    *sep;
-       int             rc, i, manageDSAit, quiet;
+       int             rc, i, crit, manageDSAit, noop, quiet;
        int             referrals, debug;
        int             authmethod, version, want_bindpw;
        LDAP    *ld = NULL;
        struct berval bvalue = { 0, NULL };
        char    *pw_file = NULL;
+       char    *control, *cvalue;
 
-       debug = verbose = not = referrals =
+       debug = verbose = not = referrals = noop =
                manageDSAit = want_bindpw = quiet = 0;
 
        version = -1;
@@ -122,9 +126,34 @@ main( int argc, char **argv )
        prog = lutil_progname( "ldapcompare", argc, argv );
 
        while (( i = getopt( argc, argv,
-               "Cd:D:h:H:IkKMnO:p:P:qQR:U:vw:WxX:y:Y:zZ")) != EOF )
+               "Cd:D:e:h:H:IkKMnO:p:P:qQR:U:vw:WxX:y:Y:zZ")) != EOF )
        {
                switch( i ) {
+       case 'E': /* compare controls */
+               if( version == LDAP_VERSION2 ) {
+                       fprintf( stderr, "%s: -E incompatible with LDAPv%d\n",
+                               prog, version );
+                       return EXIT_FAILURE;
+               }
+
+               /* should be extended to support comma separated list of
+                *      [!]key[=value] parameters, e.g.  -E !foo,bar=567
+                */
+
+               crit = 0;
+               cvalue = NULL;
+               if( optarg[0] == '!' ) {
+                       crit = 1;
+                       optarg++;
+               }
+
+               control = strdup( optarg );
+               if ( (cvalue = strchr( control, '=' )) != NULL ) {
+                       *cvalue++ = '\0';
+               }
+               fprintf( stderr, "Invalid compare control name: %s\n", control );
+               usage(prog);
+               return EXIT_FAILURE;
 
                /* Common Options */
                case 'C':
@@ -140,6 +169,57 @@ main( int argc, char **argv )
                        }
                        binddn = strdup( optarg );
                        break;
+
+       case 'e': /* general controls */
+               if( version == LDAP_VERSION2 ) {
+                       fprintf( stderr, "%s: -e incompatible with LDAPv%d\n",
+                               prog, version );
+                       return EXIT_FAILURE;
+               }
+
+               /* should be extended to support comma separated list of
+                *      [!]key[=value] parameters, e.g.  -e !foo,bar=567
+                */
+
+               crit = 0;
+               cvalue = NULL;
+               if( optarg[0] == '!' ) {
+                       crit = 1;
+                       optarg++;
+               }
+
+               control = strdup( optarg );
+               if ( (cvalue = strchr( control, '=' )) != NULL ) {
+                       *cvalue++ = '\0';
+               }
+
+               if ( strcasecmp( control, "manageDSAit" ) == 0 ) {
+                       if( cvalue != NULL ) {
+                               fprintf( stderr, "manageDSAit: no control value expected" );
+                               usage(prog);
+                               return EXIT_FAILURE;
+                       }
+
+                       manageDSAit = 1 + crit;
+                       free( control );
+                       break;
+                       
+               } else if ( strcasecmp( control, "noop" ) == 0 ) {
+                       if( cvalue != NULL ) {
+                               fprintf( stderr, "noop: no control value expected" );
+                               usage(prog);
+                               return EXIT_FAILURE;
+                       }
+
+                       noop = 1 + crit;
+                       free( control );
+                       break;
+
+               } else {
+                       fprintf( stderr, "Invalid general control name: %s\n", control );
+                       usage(prog);
+                       return EXIT_FAILURE;
+               }
                case 'h':       /* ldap host */
                        if( ldapuri != NULL ) {
                                fprintf( stderr, "%s: -h incompatible with -H\n", prog );
@@ -646,24 +726,37 @@ main( int argc, char **argv )
                }
        }
 
-       if ( manageDSAit ) {
-               int err;
-               LDAPControl c;
-               LDAPControl *ctrls[2];
-               ctrls[0] = &c;
-               ctrls[1] = NULL;
+       if ( manageDSAit || noop ) {
+               int err, i = 0;
+               LDAPControl c1, c2;
+               LDAPControl *ctrls[3];
+
+               if ( manageDSAit ) {
+                       ctrls[i++] = &c1;
+                       ctrls[i] = NULL;
+                       c1.ldctl_oid = LDAP_CONTROL_MANAGEDSAIT;
+                       c1.ldctl_value.bv_val = NULL;
+                       c1.ldctl_value.bv_len = 0;
+                       c1.ldctl_iscritical = manageDSAit > 1;
+               }
 
-               c.ldctl_oid = LDAP_CONTROL_MANAGEDSAIT;
-               c.ldctl_value.bv_val = NULL;
-               c.ldctl_value.bv_len = 0;
-               c.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;
+               }
+       
                err = ldap_set_option( ld, LDAP_OPT_SERVER_CONTROLS, ctrls );
 
                if( err != LDAP_OPT_SUCCESS ) {
-                       fprintf( stderr, "Could not set ManageDSAit %scontrol\n",
-                               c.ldctl_iscritical ? "critical " : "" );
-                       if( c.ldctl_iscritical ) {
+                       fprintf( stderr, "Could not set %scontrols\n",
+                               (c1.ldctl_iscritical || c2.ldctl_iscritical)
+                               ? "critical " : "" );
+                       if ( c1.ldctl_iscritical && c2.ldctl_iscritical ) {
                                return EXIT_FAILURE;
                        }
                }
index 35e3d9f8b7f32903ce00a32afb9cca08e22922b9..f08bdba11faca5f167bdf55debd9e8e24f12260e 100644 (file)
@@ -62,6 +62,9 @@ usage( const char *s )
 "Common options:\n"
 "  -d level   set LDAP debugging level to `level'\n"
 "  -D binddn  bind DN\n"
+"  -e [!]<ctrl>[=<ctrlparam>] general controls (! indicates criticality)\n"
+"             [!]manageDSAit   (alternate form, see -M)\n"
+"             [!]noop\n"
 "  -f file    read operations from `file'\n"
 "  -h host    LDAP server\n"
 "  -H URI     LDAP Uniform Resource Indentifier(s)\n"
@@ -95,10 +98,12 @@ main( int argc, char **argv )
 {
        char            buf[ 4096 ];
        FILE            *fp;
-       int             i, rc, authmethod, referrals, want_bindpw, version, debug, manageDSAit;
+       int             i, rc, authmethod, referrals, want_bindpw, version, debug, manageDSAit, noop, crit;
        char    *pw_file;
+       char    *control, *cvalue;
 
-    not = verbose = contoper = want_bindpw = debug = manageDSAit = referrals = 0;
+    not = verbose = contoper = want_bindpw = debug
+               = manageDSAit = noop = referrals = 0;
     fp = NULL;
     authmethod = -1;
        version = -1;
@@ -107,13 +112,38 @@ main( int argc, char **argv )
     prog = lutil_progname( "ldapdelete", argc, argv );
 
     while (( i = getopt( argc, argv, "cf:r"
-               "Cd:D:h:H:IkKMnO:p:P:QR:U:vw:WxX:y:Y:Z" )) != EOF )
+               "Cd:D:e:h:H:IkKMnO:p:P:QR:U:vw:WxX:y:Y:Z" )) != EOF )
        {
        switch( i ) {
        /* Delete Specific Options */
        case 'c':       /* continuous operation mode */
            ++contoper;
            break;
+       case 'E': /* delete controls */
+               if( version == LDAP_VERSION2 ) {
+                       fprintf( stderr, "%s: -E incompatible with LDAPv%d\n",
+                               prog, version );
+                       return EXIT_FAILURE;
+               }
+
+               /* should be extended to support comma separated list of
+                *      [!]key[=value] parameters, e.g.  -E !foo,bar=567
+                */
+
+               crit = 0;
+               cvalue = NULL;
+               if( optarg[0] == '!' ) {
+                       crit = 1;
+                       optarg++;
+               }
+
+               control = strdup( optarg );
+               if ( (cvalue = strchr( control, '=' )) != NULL ) {
+                       *cvalue++ = '\0';
+               }
+               fprintf( stderr, "Invalid delete control name: %s\n", control );
+               usage(prog);
+               return EXIT_FAILURE;
        case 'f':       /* read DNs from a file */
                if( fp != NULL ) {
                        fprintf( stderr, "%s: -f previously specified\n", prog );
@@ -142,6 +172,56 @@ main( int argc, char **argv )
                }
            binddn = strdup( optarg );
            break;
+       case 'e': /* general controls */
+               if( version == LDAP_VERSION2 ) {
+                       fprintf( stderr, "%s: -e incompatible with LDAPv%d\n",
+                               prog, version );
+                       return EXIT_FAILURE;
+               }
+
+               /* should be extended to support comma separated list of
+                *      [!]key[=value] parameters, e.g.  -e !foo,bar=567
+                */
+
+               crit = 0;
+               cvalue = NULL;
+               if( optarg[0] == '!' ) {
+                       crit = 1;
+                       optarg++;
+               }
+
+               control = strdup( optarg );
+               if ( (cvalue = strchr( control, '=' )) != NULL ) {
+                       *cvalue++ = '\0';
+               }
+
+               if ( strcasecmp( control, "manageDSAit" ) == 0 ) {
+                       if( cvalue != NULL ) {
+                               fprintf( stderr, "manageDSAit: no control value expected" );
+                               usage(prog);
+                               return EXIT_FAILURE;
+                       }
+
+                       manageDSAit = 1 + crit;
+                       free( control );
+                       break;
+                       
+               } else if ( strcasecmp( control, "noop" ) == 0 ) {
+                       if( cvalue != NULL ) {
+                               fprintf( stderr, "noop: no control value expected" );
+                               usage(prog);
+                               return EXIT_FAILURE;
+                       }
+
+                       noop = 1 + crit;
+                       free( control );
+                       break;
+
+               } else {
+                       fprintf( stderr, "Invalid general control name: %s\n", control );
+                       usage(prog);
+                       return EXIT_FAILURE;
+               }
        case 'h':       /* ldap host */
                if( ldapuri != NULL ) {
                        fprintf( stderr, "%s: -h incompatible with -H\n", prog );
@@ -614,25 +694,38 @@ main( int argc, char **argv )
                }
        }
 
-       if ( manageDSAit ) {
-               int err;
-               LDAPControl c;
-               LDAPControl *ctrls[2];
-               ctrls[0] = &c;
-               ctrls[1] = NULL;
+       if ( manageDSAit || noop ) {
+               int err, i = 0;
+               LDAPControl c1, c2;
+               LDAPControl *ctrls[3];
 
-               c.ldctl_oid = LDAP_CONTROL_MANAGEDSAIT;
-               c.ldctl_value.bv_val = NULL;
-               c.ldctl_value.bv_len = 0;
-               c.ldctl_iscritical = manageDSAit > 1;
+               if ( manageDSAit ) {
+                       ctrls[i++] = &c1;
+                       ctrls[i] = NULL;
+                       c1.ldctl_oid = LDAP_CONTROL_MANAGEDSAIT;
+                       c1.ldctl_value.bv_val = NULL;
+                       c1.ldctl_value.bv_len = 0;
+                       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;
+               }
+       
                err = ldap_set_option( ld, LDAP_OPT_SERVER_CONTROLS, ctrls );
 
                if( err != LDAP_OPT_SUCCESS ) {
-                       fprintf( stderr, "Could not set ManageDSAit %scontrol\n",
-                               c.ldctl_iscritical ? "critical " : "" );
-                       if( c.ldctl_iscritical ) {
-                               exit( EXIT_FAILURE );
+                       fprintf( stderr, "Could not set %scontrols\n",
+                               (c1.ldctl_iscritical || c2.ldctl_iscritical)
+                               ? "critical " : "" );
+                       if ( c1.ldctl_iscritical && c2.ldctl_iscritical ) {
+                               return EXIT_FAILURE;
                        }
                }
        }
index 17ad97179a03282487289eb8483ddf5716331622..6ce9d99f9b69ec6a860c56a5e21154a37f253d2d 100644 (file)
@@ -105,13 +105,16 @@ usage( const char *prog )
 "Add or modify options:\n"
 "  -a         add values (default%s)\n"
 "  -c         continuous operation mode (do not stop on errors)\n"
-"  -f file    read operations from `file'\n"
 "  -F         force all changes records to be used\n"
 "  -S file    write skipped modifications to `file'\n"
 
 "Common options:\n"
 "  -d level   set LDAP debugging level to `level'\n"
 "  -D binddn  bind DN\n"
+"  -e [!]<ctrl>[=<ctrlparam>] general controls (! indicates criticality)\n"
+"             [!]manageDSAit   (alternate form, see -M)\n"
+"             [!]noop\n"
+"  -f file    read operations from `file'\n"
 "  -h host    LDAP server\n"
 "  -H URI     LDAP Uniform Resource Indentifier(s)\n"
 "  -I         use SASL Interactive mode\n"
@@ -145,9 +148,11 @@ main( int argc, char **argv )
     char               *infile, *rejfile, *rbuf, *start, *rejbuf = NULL;
     FILE               *fp, *rejfp;
        char            *matched_msg = NULL, *error_msg = NULL;
-       int             rc, i, authmethod, version, want_bindpw, debug, manageDSAit, referrals;
+       int             rc, i, authmethod, version, want_bindpw, debug, manageDSAit, noop, referrals;
        int count, len;
        char    *pw_file = NULL;
+       char    *control, *cvalue;
+       int             crit;
 
     prog = lutil_progname( "ldapmodify", argc, argv );
 
@@ -159,12 +164,12 @@ main( int argc, char **argv )
 
     infile = NULL;
     rejfile = NULL;
-    not = verbose = want_bindpw = debug = manageDSAit = referrals = 0;
+    not = verbose = want_bindpw = debug = manageDSAit = noop = referrals = 0;
     authmethod = -1;
        version = -1;
 
-    while (( i = getopt( argc, argv, "acrf:F"
-               "Cd:D:h:H:IkKMnO:p:P:QR:S:U:vw:WxX:y:Y:Z" )) != EOF )
+    while (( i = getopt( argc, argv, "acrf:E:F"
+               "Cd:D:e:h:H:IkKMnO:p:P:QR:S:U:vw:WxX:y:Y:Z" )) != EOF )
        {
        switch( i ) {
        /* Modify Options */
@@ -174,6 +179,31 @@ main( int argc, char **argv )
        case 'c':       /* continuous operation */
            contoper = 1;
            break;
+       case 'E': /* modify controls */
+               if( version == LDAP_VERSION2 ) {
+                       fprintf( stderr, "%s: -E incompatible with LDAPv%d\n",
+                               prog, version );
+                       return EXIT_FAILURE;
+               }
+
+               /* should be extended to support comma separated list of
+                *      [!]key[=value] parameters, e.g.  -E !foo,bar=567
+                */
+
+               crit = 0;
+               cvalue = NULL;
+               if( optarg[0] == '!' ) {
+                       crit = 1;
+                       optarg++;
+               }
+
+               control = strdup( optarg );
+               if ( (cvalue = strchr( control, '=' )) != NULL ) {
+                       *cvalue++ = '\0';
+               }
+               fprintf( stderr, "Invalid modify control name: %s\n", control );
+               usage(prog);
+               return EXIT_FAILURE;
        case 'f':       /* read from file */
                if( infile != NULL ) {
                        fprintf( stderr, "%s: -f previously specified\n", prog );
@@ -199,6 +229,56 @@ main( int argc, char **argv )
                }
            binddn = strdup( optarg );
            break;
+       case 'e': /* general controls */
+               if( version == LDAP_VERSION2 ) {
+                       fprintf( stderr, "%s: -e incompatible with LDAPv%d\n",
+                               prog, version );
+                       return EXIT_FAILURE;
+               }
+
+               /* should be extended to support comma separated list of
+                *      [!]key[=value] parameters, e.g.  -e !foo,bar=567
+                */
+
+               crit = 0;
+               cvalue = NULL;
+               if( optarg[0] == '!' ) {
+                       crit = 1;
+                       optarg++;
+               }
+
+               control = strdup( optarg );
+               if ( (cvalue = strchr( control, '=' )) != NULL ) {
+                       *cvalue++ = '\0';
+               }
+
+               if ( strcasecmp( control, "manageDSAit" ) == 0 ) {
+                       if( cvalue != NULL ) {
+                               fprintf( stderr, "manageDSAit: no control value expected" );
+                               usage(prog);
+                               return EXIT_FAILURE;
+                       }
+
+                       manageDSAit = 1 + crit;
+                       free( control );
+                       break;
+                       
+               } else if ( strcasecmp( control, "noop" ) == 0 ) {
+                       if( cvalue != NULL ) {
+                               fprintf( stderr, "noop: no control value expected" );
+                               usage(prog);
+                               return EXIT_FAILURE;
+                       }
+
+                       noop = 1 + crit;
+                       free( control );
+                       break;
+
+               } else {
+                       fprintf( stderr, "Invalid general control name: %s\n", control );
+                       usage(prog);
+                       return EXIT_FAILURE;
+               }
        case 'h':       /* ldap host */
                if( ldapuri != NULL ) {
                        fprintf( stderr, "%s: -h incompatible with -H\n", prog );
@@ -701,25 +781,38 @@ main( int argc, char **argv )
 
     rc = 0;
 
-       if ( manageDSAit ) {
-               int err;
-               LDAPControl c;
-               LDAPControl *ctrls[2];
-               ctrls[0] = &c;
-               ctrls[1] = NULL;
+       if ( manageDSAit || noop ) {
+               int err, i = 0;
+               LDAPControl c1, c2;
+               LDAPControl *ctrls[3];
+
+               if ( manageDSAit ) {
+                       ctrls[i++] = &c1;
+                       ctrls[i] = NULL;
+                       c1.ldctl_oid = LDAP_CONTROL_MANAGEDSAIT;
+                       c1.ldctl_value.bv_val = NULL;
+                       c1.ldctl_value.bv_len = 0;
+                       c1.ldctl_iscritical = manageDSAit > 1;
+               }
 
-               c.ldctl_oid = LDAP_CONTROL_MANAGEDSAIT;
-               c.ldctl_value.bv_val = NULL;
-               c.ldctl_value.bv_len = 0;
-               c.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;
+               }
+       
                err = ldap_set_option( ld, LDAP_OPT_SERVER_CONTROLS, ctrls );
 
                if( err != LDAP_OPT_SUCCESS ) {
-                       fprintf( stderr, "Could not set ManageDSAit %scontrol\n",
-                               c.ldctl_iscritical ? "critical " : "" );
-                       if( c.ldctl_iscritical ) {
-                               exit( EXIT_FAILURE );
+                       fprintf( stderr, "Could not set %scontrols\n",
+                               (c1.ldctl_iscritical || c2.ldctl_iscritical)
+                               ? "critical " : "" );
+                       if ( c1.ldctl_iscritical && c2.ldctl_iscritical ) {
+                               return EXIT_FAILURE;
                        }
                }
        }
index 5e69273144d89bcde3178a529a0951019c57b7ab..68633b8439305a8e20ee012f5dc7e48b86f51ebc 100644 (file)
@@ -76,6 +76,9 @@ usage( const char *s )
 "Common options:\n"
 "  -d level   set LDAP debugging level to `level'\n"
 "  -D binddn  bind DN\n"
+"  -e [!]<ctrl>[=<ctrlparam>] general controls (! indicates criticality)\n"
+"             [!]manageDSAit   (alternate form, see -M)\n"
+"             [!]noop\n"
 "  -f file    read operations from `file'\n"
 "  -h host    LDAP server\n"
 "  -H URI     LDAP Uniform Resource Indentifier(s)\n"
@@ -108,27 +111,53 @@ main(int argc, char **argv)
 {
     char               *infile, *entrydn = NULL, *rdn = NULL, buf[ 4096 ];
     FILE               *fp;
-       int             rc, i, remove, havedn, authmethod, version, want_bindpw, debug, manageDSAit;
+       int             rc, i, remove, havedn, authmethod, version, want_bindpw, debug, manageDSAit, noop, crit;
        int             referrals;
     char       *newSuperior=NULL;
        char    *pw_file = NULL;
+       char    *control, *cvalue;
 
     infile = NULL;
     not = contoper = verbose = remove = want_bindpw =
-               debug = manageDSAit = referrals = 0;
+               debug = manageDSAit = noop = referrals = 0;
     authmethod = -1;
        version = -1;
 
     prog = lutil_progname( "ldapmodrdn", argc, argv );
 
     while (( i = getopt( argc, argv, "cf:rs:"
-               "Cd:D:h:H:IkKMnO:p:P:QR:U:vw:WxX:y:Y:Z" )) != EOF )
+               "Cd:D:e:h:H:IkKMnO:p:P:QR:U:vw:WxX:y:Y:Z" )) != EOF )
        {
        switch( i ) {
        /* Modrdn Options */
        case 'c':
                contoper++;
                break;
+       case 'E': /* modrdn controls */
+               if( version == LDAP_VERSION2 ) {
+                       fprintf( stderr, "%s: -E incompatible with LDAPv%d\n",
+                               prog, version );
+                       return EXIT_FAILURE;
+               }
+
+               /* should be extended to support comma separated list of
+                *      [!]key[=value] parameters, e.g.  -E !foo,bar=567
+                */
+
+               crit = 0;
+               cvalue = NULL;
+               if( optarg[0] == '!' ) {
+                       crit = 1;
+                       optarg++;
+               }
+
+               control = strdup( optarg );
+               if ( (cvalue = strchr( control, '=' )) != NULL ) {
+                       *cvalue++ = '\0';
+               }
+               fprintf( stderr, "Invalid modrdn control name: %s\n", control );
+               usage(prog);
+               return EXIT_FAILURE;
        case 'f':       /* read from file */
                if( infile != NULL ) {
                        fprintf( stderr, "%s: -f previously specified\n", prog );
@@ -163,6 +192,56 @@ main(int argc, char **argv)
                }
            binddn = strdup( optarg );
            break;
+       case 'e': /* general controls */
+               if( version == LDAP_VERSION2 ) {
+                       fprintf( stderr, "%s: -e incompatible with LDAPv%d\n",
+                               prog, version );
+                       return EXIT_FAILURE;
+               }
+
+               /* should be extended to support comma separated list of
+                *      [!]key[=value] parameters, e.g.  -e !foo,bar=567
+                */
+
+               crit = 0;
+               cvalue = NULL;
+               if( optarg[0] == '!' ) {
+                       crit = 1;
+                       optarg++;
+               }
+
+               control = strdup( optarg );
+               if ( (cvalue = strchr( control, '=' )) != NULL ) {
+                       *cvalue++ = '\0';
+               }
+
+               if ( strcasecmp( control, "manageDSAit" ) == 0 ) {
+                       if( cvalue != NULL ) {
+                               fprintf( stderr, "manageDSAit: no control value expected" );
+                               usage(prog);
+                               return EXIT_FAILURE;
+                       }
+
+                       manageDSAit = 1 + crit;
+                       free( control );
+                       break;
+                       
+               } else if ( strcasecmp( control, "noop" ) == 0 ) {
+                       if( cvalue != NULL ) {
+                               fprintf( stderr, "noop: no control value expected" );
+                               usage(prog);
+                               return EXIT_FAILURE;
+                       }
+
+                       noop = 1 + crit;
+                       free( control );
+                       break;
+
+               } else {
+                       fprintf( stderr, "Invalid general control name: %s\n", control );
+                       usage(prog);
+                       return EXIT_FAILURE;
+               }
        case 'h':       /* ldap host */
                if( ldapuri != NULL ) {
                        fprintf( stderr, "%s: -h incompatible with -H\n", prog );
@@ -650,25 +729,38 @@ main(int argc, char **argv)
                }
        }
 
-       if ( manageDSAit ) {
-               int err;
-               LDAPControl c;
-               LDAPControl *ctrls[2];
-               ctrls[0] = &c;
-               ctrls[1] = NULL;
+       if ( manageDSAit || noop ) {
+               int err, i = 0;
+               LDAPControl c1, c2;
+               LDAPControl *ctrls[3];
 
-               c.ldctl_oid = LDAP_CONTROL_MANAGEDSAIT;
-               c.ldctl_value.bv_val = NULL;
-               c.ldctl_value.bv_len = 0;
-               c.ldctl_iscritical = manageDSAit > 1;
+               if ( manageDSAit ) {
+                       ctrls[i++] = &c1;
+                       ctrls[i] = NULL;
+                       c1.ldctl_oid = LDAP_CONTROL_MANAGEDSAIT;
+                       c1.ldctl_value.bv_val = NULL;
+                       c1.ldctl_value.bv_len = 0;
+                       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;
+               }
+       
                err = ldap_set_option( ld, LDAP_OPT_SERVER_CONTROLS, ctrls );
 
                if( err != LDAP_OPT_SUCCESS ) {
-                       fprintf( stderr, "Could not set ManageDSAit %scontrol\n",
-                               c.ldctl_iscritical ? "critical " : "" );
-                       if( c.ldctl_iscritical ) {
-                               exit( EXIT_FAILURE );
+                       fprintf( stderr, "Could not set %scontrols\n",
+                               (c1.ldctl_iscritical || c2.ldctl_iscritical)
+                               ? "critical " : "" );
+                       if ( c1.ldctl_iscritical && c2.ldctl_iscritical ) {
+                               return EXIT_FAILURE;
                        }
                }
        }
index f78d5ce5c4c09be4809737f788a618c53ab806d3..dda3651ab5685f04bac10e50354715f76d783852 100644 (file)
@@ -40,6 +40,9 @@ usage(const char *s)
 "Common options:\n"
 "  -d level   set LDAP debugging level to `level'\n"
 "  -D binddn  bind DN\n"
+"  -e [!]<ctrl>[=<ctrlparam>] general controls (! indicates criticality)\n"
+"             [!]manageDSAit   (alternate form, see -M)\n"
+"             [!]noop\n"
 "  -f file    read operations from `file'\n"
 "  -h host    LDAP server(s)\n"
 "  -H URI     LDAP Uniform Resource Indentifier(s)\n"
@@ -88,6 +91,9 @@ main( int argc, char *argv[] )
        int             version = -1;
        int             authmethod = -1;
        int             manageDSAit = 0;
+       int             noop = 0;
+       int             crit;
+       char    *control, *cvalue;
 #ifdef HAVE_CYRUS_SASL
        unsigned        sasl_flags = LDAP_SASL_AUTOMATIC;
        char            *sasl_realm = NULL;
@@ -110,7 +116,7 @@ main( int argc, char *argv[] )
     prog = lutil_progname( "ldappasswd", argc, argv );
 
        while( (i = getopt( argc, argv, "Aa:Ss:"
-               "Cd:D:h:H:InO:p:QR:U:vw:WxX:Y:Z" )) != EOF )
+               "Cd:D:e:h:H:InO:p:QR:U:vw:WxX:Y:Z" )) != EOF )
        {
                switch (i) {
                /* Password Options */
@@ -130,6 +136,31 @@ main( int argc, char *argv[] )
                        }
                        break;
 
+       case 'E': /* passwd controls */
+               if( version == LDAP_VERSION2 ) {
+                       fprintf( stderr, "%s: -E incompatible with LDAPv%d\n",
+                               prog, version );
+                       return EXIT_FAILURE;
+               }
+
+               /* should be extended to support comma separated list of
+                *      [!]key[=value] parameters, e.g.  -E !foo,bar=567
+                */
+
+               crit = 0;
+               cvalue = NULL;
+               if( optarg[0] == '!' ) {
+                       crit = 1;
+                       optarg++;
+               }
+
+               control = strdup( optarg );
+               if ( (cvalue = strchr( control, '=' )) != NULL ) {
+                       *cvalue++ = '\0';
+               }
+               fprintf( stderr, "Invalid passwd control name: %s\n", control );
+               usage(prog);
+               return EXIT_FAILURE;
                case 'S':       /* prompt for user password */
                        want_newpw++;
                        break;
@@ -159,6 +190,56 @@ main( int argc, char *argv[] )
                }
            binddn = strdup( optarg );
            break;
+       case 'e': /* general controls */
+               if( version == LDAP_VERSION2 ) {
+                       fprintf( stderr, "%s: -e incompatible with LDAPv%d\n",
+                               prog, version );
+                       return EXIT_FAILURE;
+               }
+
+               /* should be extended to support comma separated list of
+                *      [!]key[=value] parameters, e.g.  -e !foo,bar=567
+                */
+
+               crit = 0;
+               cvalue = NULL;
+               if( optarg[0] == '!' ) {
+                       crit = 1;
+                       optarg++;
+               }
+
+               control = strdup( optarg );
+               if ( (cvalue = strchr( control, '=' )) != NULL ) {
+                       *cvalue++ = '\0';
+               }
+
+               if ( strcasecmp( control, "manageDSAit" ) == 0 ) {
+                       if( cvalue != NULL ) {
+                               fprintf( stderr, "manageDSAit: no control value expected" );
+                               usage(prog);
+                               return EXIT_FAILURE;
+                       }
+
+                       manageDSAit = 1 + crit;
+                       free( control );
+                       break;
+                       
+               } else if ( strcasecmp( control, "noop" ) == 0 ) {
+                       if( cvalue != NULL ) {
+                               fprintf( stderr, "noop: no control value expected" );
+                               usage(prog);
+                               return EXIT_FAILURE;
+                       }
+
+                       noop = 1 + crit;
+                       free( control );
+                       break;
+
+               } else {
+                       fprintf( stderr, "Invalid general control name: %s\n", control );
+                       usage(prog);
+                       return EXIT_FAILURE;
+               }
        case 'h':       /* ldap host */
                if( ldapuri != NULL ) {
                        fprintf( stderr, "%s: -h incompatible with -H\n", prog );
@@ -648,6 +729,42 @@ main( int argc, char *argv[] )
                }
        }
 
+       if ( manageDSAit || noop ) {
+               int err, i = 0;
+               LDAPControl c1, c2;
+               LDAPControl *ctrls[3];
+
+               if ( manageDSAit ) {
+                       ctrls[i++] = &c1;
+                       ctrls[i] = NULL;
+                       c1.ldctl_oid = LDAP_CONTROL_MANAGEDSAIT;
+                       c1.ldctl_value.bv_val = NULL;
+                       c1.ldctl_value.bv_len = 0;
+                       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;
+               }
+       
+               err = ldap_set_option( ld, LDAP_OPT_SERVER_CONTROLS, ctrls );
+
+               if( err != LDAP_OPT_SUCCESS ) {
+                       fprintf( stderr, "Could not set %scontrols\n",
+                               (c1.ldctl_iscritical || c2.ldctl_iscritical)
+                               ? "critical " : "" );
+                       if ( c1.ldctl_iscritical && c2.ldctl_iscritical ) {
+                               return EXIT_FAILURE;
+                       }
+               }
+       }
+
        if( user != NULL || oldpw != NULL || newpw != NULL ) {
                /* build change password control */
                BerElement *ber = ber_alloc_t( LBER_USE_DER );
index 2dd5615eb7a96c1c78c5e196b6f5c0deeb65a76f..885bfc36a03669a90722e1637f44fe4c60fee087 100644 (file)
@@ -54,6 +54,8 @@ usage( const char *s )
 "  -a deref   one of never (default), always, search, or find\n"
 "  -A         retrieve attribute names only (no values)\n"
 "  -b basedn  base dn for search\n"
+"  -E [!]<ctrl>[=<ctrlparam>] search controls (! indicates criticality)\n"
+"             [!]mv=<filter>   (matched values filter)\n"
 "  -F prefix  URL prefix for files (default: %s)\n"
 "  -l limit   time limit (in seconds) for search\n"
 "  -L         print responses in LDIFv1 format\n"
@@ -71,6 +73,9 @@ usage( const char *s )
 "Common options:\n"
 "  -d level   set LDAP debugging level to `level'\n"
 "  -D binddn  bind DN\n"
+"  -e [!]<ctrl>[=<ctrlparam>] general controls (! indicates criticality)\n"
+"             [!]manageDSAit   (alternate form, see -M)\n"
+"             [!]noop\n"
 "  -f file    read operations from `file'\n"
 "  -h host    LDAP server\n"
 "  -H URI     LDAP Uniform Resource Indentifier(s)\n"
@@ -181,20 +186,20 @@ main( int argc, char **argv )
 {
        char            *infile, *filtpattern, **attrs = NULL, line[BUFSIZ];
        FILE            *fp = NULL;
-       int                     rc, i, first, scope, deref, attrsonly, manageDSAit;
+       int                     rc, i, first, scope, deref, attrsonly, manageDSAit, noop, crit;
        int                     referrals, timelimit, sizelimit, debug;
        int             authmethod, version, want_bindpw;
        LDAP            *ld = NULL;
        int             valuesReturnFilter;
        BerElement      *ber = NULL;
        struct berval   *bvalp = NULL;
-       char    *vrFilter  = NULL, *control  = NULL, *s;
+       char    *vrFilter  = NULL, *control = NULL, *cvalue;
        char    *pw_file = NULL;
 
 
        infile = NULL;
        debug = verbose = not = vals2tmp = referrals = valuesReturnFilter =
-               attrsonly = manageDSAit = ldif = want_bindpw = 0;
+               attrsonly = manageDSAit = noop = ldif = want_bindpw = 0;
 
        prog = lutil_progname( "ldapsearch", argc, argv );
 
@@ -228,7 +233,7 @@ main( int argc, char **argv )
        urlize( def_urlpre );
 
        while (( i = getopt( argc, argv, "Aa:b:E:F:f:Ll:S:s:T:tuz:"
-               "Cd:D:h:H:IkKMnO:p:P:QR:U:vw:WxX:y:Y:Z")) != EOF )
+               "Cd:e:D:h:H:IkKMnO:p:P:QR:U:vw:WxX:y:Y:Z")) != EOF )
        {
        switch( i ) {
        /* Search Options */
@@ -252,45 +257,44 @@ main( int argc, char **argv )
        case 'b': /* search base */
                base = strdup( optarg );
                break;
-       case 'f':       /* input file */
-               if( infile != NULL ) {
-                       fprintf( stderr, "%s: -f previously specified\n", prog );
-                       return EXIT_FAILURE;
-               }
-               infile = strdup( optarg );
-               break;
-       case 'E': /* controls */
+       case 'E': /* search controls */
                if( version == LDAP_VERSION2 ) {
-                       fprintf( stderr, "%s: -C incompatible with LDAPv%d\n",
+                       fprintf( stderr, "%s: -E incompatible with LDAPv%d\n",
                                prog, version );
                        return EXIT_FAILURE;
                }
 
                /* should be extended to support comma separated list of
-                *      key/value pairs:  -E foo=123,bar=567
+                *      [!]key[=value] parameters, e.g.  -E !foo,bar=567
                 */
 
+               crit = 0;
+               cvalue = NULL;
+               if( optarg[0] == '!' ) {
+                       crit = 1;
+                       optarg++;
+               }
+
                control = strdup( optarg );
-               if ( (s = strchr( control, '=' )) == NULL ) {
-                       return EXIT_FAILURE;
+               if ( (cvalue = strchr( control, '=' )) != NULL ) {
+                       *cvalue++ = '\0';
                }
 
-               *s++ = '\0';
                if ( strcasecmp( control, "mv" ) == 0 ) {
                        /* ValuesReturnFilter control */
                        if (valuesReturnFilter!=0) {
                                fprintf( stderr, "ValuesReturnFilter previously specified");
                                return EXIT_FAILURE;
                        }
+                       valuesReturnFilter= 1 + crit;
 
-                       if ( *s == '!' ){
-                               s++;
-                               valuesReturnFilter=2;
-                       } else {
-                               valuesReturnFilter=1;
+                       if ( cvalue == NULL ) {
+                               fprintf( stderr,
+                                       "missing filter in ValuesReturnFilter control\n");
+                               return EXIT_FAILURE;
                        }
 
-                       vrFilter = s;
+                       vrFilter = cvalue;
                        version = LDAP_VERSION3;
                        break;
 
@@ -299,7 +303,13 @@ main( int argc, char **argv )
                        usage(prog);
                        return EXIT_FAILURE;
                }
-
+       case 'f':       /* input file */
+               if( infile != NULL ) {
+                       fprintf( stderr, "%s: -f previously specified\n", prog );
+                       return EXIT_FAILURE;
+               }
+               infile = strdup( optarg );
+               break;
        case 'F':       /* uri prefix */
                if( urlpre ) free( urlpre );
                urlpre = strdup( optarg );
@@ -358,6 +368,56 @@ main( int argc, char **argv )
                }
            binddn = strdup( optarg );
            break;
+       case 'e': /* general controls */
+               if( version == LDAP_VERSION2 ) {
+                       fprintf( stderr, "%s: -e incompatible with LDAPv%d\n",
+                               prog, version );
+                       return EXIT_FAILURE;
+               }
+
+               /* should be extended to support comma separated list of
+                *      [!]key[=value] parameters, e.g.  -e !foo,bar=567
+                */
+
+               crit = 0;
+               cvalue = NULL;
+               if( optarg[0] == '!' ) {
+                       crit = 1;
+                       optarg++;
+               }
+
+               control = strdup( optarg );
+               if ( (cvalue = strchr( control, '=' )) != NULL ) {
+                       *cvalue++ = '\0';
+               }
+
+               if ( strcasecmp( control, "manageDSAit" ) == 0 ) {
+                       if( cvalue != NULL ) {
+                               fprintf( stderr, "manageDSAit: no control value expected" );
+                               usage(prog);
+                               return EXIT_FAILURE;
+                       }
+
+                       manageDSAit = 1 + crit;
+                       free( control );
+                       break;
+                       
+               } else if ( strcasecmp( control, "noop" ) == 0 ) {
+                       if( cvalue != NULL ) {
+                               fprintf( stderr, "noop: no control value expected" );
+                               usage(prog);
+                               return EXIT_FAILURE;
+                       }
+
+                       noop = 1 + crit;
+                       free( control );
+                       break;
+
+               } else {
+                       fprintf( stderr, "Invalid general control name: %s\n", control );
+                       usage(prog);
+                       return EXIT_FAILURE;
+               }
        case 'h':       /* ldap host */
                if( ldapuri != NULL ) {
                        fprintf( stderr, "%s: -h incompatible with -H\n", prog );
@@ -922,7 +982,7 @@ main( int argc, char **argv )
 
                        c2.ldctl_value=(*bvalp);
                }
-       
+
                err = ldap_set_option( ld, LDAP_OPT_SERVER_CONTROLS, ctrls );
 
                ber_bvfree(bvalp);
index 3a894ceb4ee81f1e980c85e0f3ff14440ed11673..841a0487901c3c64ee33deed698a8d78c86748d1 100644 (file)
@@ -34,6 +34,9 @@ usage(const char *s)
 "Common options:\n"
 "  -d level   set LDAP debugging level to `level'\n"
 "  -D binddn  bind DN\n"
+"  -e [!]<ctrl>[=<ctrlparam>] general controls (! indicates criticality)\n"
+"             [!]manageDSAit   (alternate form, see -M)\n"
+"             [!]noop\n"
 "  -f file    read operations from `file'\n"
 "  -h host    LDAP server(s)\n"
 "  -H URI     LDAP Uniform Resource Indentifier(s)\n"
@@ -90,6 +93,9 @@ main( int argc, char *argv[] )
        int             use_tls = 0;
        int             referrals = 0;
        LDAP           *ld = NULL;
+       int     manageDSAit=0, noop=0;
+       char    *control, *cvalue;
+       int             crit;
 
        int id, code = LDAP_OTHER;
        LDAPMessage *res;
@@ -100,9 +106,35 @@ main( int argc, char *argv[] )
        prog = lutil_progname( "ldapwhoami", argc, argv );
 
        while( (i = getopt( argc, argv, 
-               "Cd:D:h:H:InO:p:QR:U:vw:WxX:y:Y:Z" )) != EOF )
+               "Cd:D:e:h:H:InO:p:QR:U:vw:WxX:y:Y:Z" )) != EOF )
        {
                switch (i) {
+       case 'E': /* whoami controls */
+               if( version == LDAP_VERSION2 ) {
+                       fprintf( stderr, "%s: -E incompatible with LDAPv%d\n",
+                               prog, version );
+                       return EXIT_FAILURE;
+               }
+
+               /* should be extended to support comma separated list of
+                *      [!]key[=value] parameters, e.g.  -E !foo,bar=567
+                */
+
+               crit = 0;
+               cvalue = NULL;
+               if( optarg[0] == '!' ) {
+                       crit = 1;
+                       optarg++;
+               }
+
+               control = strdup( optarg );
+               if ( (cvalue = strchr( control, '=' )) != NULL ) {
+                       *cvalue++ = '\0';
+               }
+               fprintf( stderr, "Invalid whoami control name: %s\n", control );
+               usage(prog);
+               return EXIT_FAILURE;
+
        /* Common Options (including options we don't use) */
        case 'C':
                referrals++;
@@ -117,6 +149,56 @@ main( int argc, char *argv[] )
                }
            binddn = strdup( optarg );
            break;
+       case 'e': /* general controls */
+               if( version == LDAP_VERSION2 ) {
+                       fprintf( stderr, "%s: -e incompatible with LDAPv%d\n",
+                               prog, version );
+                       return EXIT_FAILURE;
+               }
+
+               /* should be extended to support comma separated list of
+                *      [!]key[=value] parameters, e.g.  -e !foo,bar=567
+                */
+
+               crit = 0;
+               cvalue = NULL;
+               if( optarg[0] == '!' ) {
+                       crit = 1;
+                       optarg++;
+               }
+
+               control = strdup( optarg );
+               if ( (cvalue = strchr( control, '=' )) != NULL ) {
+                       *cvalue++ = '\0';
+               }
+
+               if ( strcasecmp( control, "manageDSAit" ) == 0 ) {
+                       if( cvalue != NULL ) {
+                               fprintf( stderr, "manageDSAit: no control value expected" );
+                               usage(prog);
+                               return EXIT_FAILURE;
+                       }
+
+                       manageDSAit = 1 + crit;
+                       free( control );
+                       break;
+                       
+               } else if ( strcasecmp( control, "noop" ) == 0 ) {
+                       if( cvalue != NULL ) {
+                               fprintf( stderr, "noop: no control value expected" );
+                               usage(prog);
+                               return EXIT_FAILURE;
+                       }
+
+                       noop = 1 + crit;
+                       free( control );
+                       break;
+
+               } else {
+                       fprintf( stderr, "Invalid general control name: %s\n", control );
+                       usage(prog);
+                       return EXIT_FAILURE;
+               }
        case 'h':       /* ldap host */
                if( ldapuri != NULL ) {
                        fprintf( stderr, "%s: -h incompatible with -H\n", prog );
@@ -580,6 +662,42 @@ main( int argc, char *argv[] )
                goto skip;
        }
 
+       if ( manageDSAit || noop ) {
+               int err, i = 0;
+               LDAPControl c1, c2;
+               LDAPControl *ctrls[3];
+
+               if ( manageDSAit ) {
+                       ctrls[i++] = &c1;
+                       ctrls[i] = NULL;
+                       c1.ldctl_oid = LDAP_CONTROL_MANAGEDSAIT;
+                       c1.ldctl_value.bv_val = NULL;
+                       c1.ldctl_value.bv_len = 0;
+                       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;
+               }
+       
+               err = ldap_set_option( ld, LDAP_OPT_SERVER_CONTROLS, ctrls );
+
+               if( err != LDAP_OPT_SUCCESS ) {
+                       fprintf( stderr, "Could not set %scontrols\n",
+                               (c1.ldctl_iscritical || c2.ldctl_iscritical)
+                               ? "critical " : "" );
+                       if ( c1.ldctl_iscritical && c2.ldctl_iscritical ) {
+                               return EXIT_FAILURE;
+                       }
+               }
+       }
+
        rc = ldap_extended_operation( ld,
                LDAP_EXOP_X_WHO_AM_I, NULL, 
                NULL, NULL, &id );
diff --git a/clients/tools/ldapwhoami.dsp b/clients/tools/ldapwhoami.dsp
new file mode 100644 (file)
index 0000000..5e44a4f
--- /dev/null
@@ -0,0 +1,145 @@
+# Microsoft Developer Studio Project File - Name="ldapwhoami" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 5.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=ldapwhoami - Win32 Single Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "ldapwhoami.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "ldapwhoami.mak" CFG="ldapwhoami - Win32 Single Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "ldapwhoami - Win32 Release" (based on\
+ "Win32 (x86) Console Application")
+!MESSAGE "ldapwhoami - Win32 Debug" (based on\
+ "Win32 (x86) Console Application")
+!MESSAGE "ldapwhoami - Win32 Single Debug" (based on\
+ "Win32 (x86) Console Application")
+!MESSAGE "ldapwhoami - Win32 Single Release" (based on\
+ "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "ldapwhoami - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "ldappass"
+# PROP BASE Intermediate_Dir "ldappass"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "..\..\Release"
+# PROP Intermediate_Dir "..\..\Release\ldapwhoami"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 sasl.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\Release"
+
+!ELSEIF  "$(CFG)" == "ldapwhoami - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "ldappas0"
+# PROP BASE Intermediate_Dir "ldappas0"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "..\..\Debug"
+# PROP Intermediate_Dir "..\..\Debug\ldapwhoami"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\Debug"
+
+!ELSEIF  "$(CFG)" == "ldapwhoami - Win32 Single Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Single Debug"
+# PROP BASE Intermediate_Dir "Single Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "..\..\SDebug"
+# PROP Intermediate_Dir "..\..\SDebug\ldapwhoami"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\SDebug"
+
+!ELSEIF  "$(CFG)" == "ldapwhoami - Win32 Single Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Single Release"
+# PROP BASE Intermediate_Dir "Single Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "..\..\SRelease"
+# PROP Intermediate_Dir "..\..\SRelease\ldapwhoami"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 sasl.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\SRelease"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "ldapwhoami - Win32 Release"
+# Name "ldapwhoami - Win32 Debug"
+# Name "ldapwhoami - Win32 Single Debug"
+# Name "ldapwhoami - Win32 Single Release"
+# Begin Source File
+
+SOURCE=.\ldapwhoami.c
+# End Source File
+# End Target
+# End Project