From e918c3b5a7a460fb681bce53da639cb5b7698a52 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Thu, 28 Nov 2002 05:56:19 +0000 Subject: [PATCH] Add -e authzid argument processing --- clients/tools/ldapdelete.c | 22 +++++++++++++++++++++- clients/tools/ldapmodify.c | 22 +++++++++++++++++++++- clients/tools/ldapmodrdn.c | 22 +++++++++++++++++++++- clients/tools/ldappasswd.c | 22 +++++++++++++++++++++- clients/tools/ldapsearch.c | 22 +++++++++++++++++++++- clients/tools/ldapwhoami.c | 22 +++++++++++++++++++++- 6 files changed, 126 insertions(+), 6 deletions(-) diff --git a/clients/tools/ldapdelete.c b/clients/tools/ldapdelete.c index fe0e33f808..a326248a04 100644 --- a/clients/tools/ldapdelete.c +++ b/clients/tools/ldapdelete.c @@ -197,7 +197,27 @@ main( int argc, char **argv ) *cvalue++ = '\0'; } - if ( strcasecmp( control, "manageDSAit" ) == 0 ) { + if ( strcasecmp( control, "authzid" ) == 0 ) { + if( authzid != NULL ) { + fprintf( stderr, "authzid control previously specified"); + return EXIT_FAILURE; + } + if( cvalue == NULL ) { + fprintf( stderr, "authzid: control value expected" ); + usage(prog); + return EXIT_FAILURE; + } + if( !crit ) { + fprintf( stderr, "authzid: must be marked critical" ); + usage(prog); + return EXIT_FAILURE; + } + + assert( authzid == NULL ); + authzid = control; + break; + + } else if ( strcasecmp( control, "manageDSAit" ) == 0 ) { if( manageDSAit ) { fprintf( stderr, "manageDSAit control previously specified"); return EXIT_FAILURE; diff --git a/clients/tools/ldapmodify.c b/clients/tools/ldapmodify.c index adf0403306..8d4a25da10 100644 --- a/clients/tools/ldapmodify.c +++ b/clients/tools/ldapmodify.c @@ -261,7 +261,27 @@ main( int argc, char **argv ) *cvalue++ = '\0'; } - if ( strcasecmp( control, "manageDSAit" ) == 0 ) { + if ( strcasecmp( control, "authzid" ) == 0 ) { + if( authzid != NULL ) { + fprintf( stderr, "authzid control previously specified"); + return EXIT_FAILURE; + } + if( cvalue == NULL ) { + fprintf( stderr, "authzid: control value expected" ); + usage(prog); + return EXIT_FAILURE; + } + if( !crit ) { + fprintf( stderr, "authzid: must be marked critical" ); + usage(prog); + return EXIT_FAILURE; + } + + assert( authzid == NULL ); + authzid = control; + break; + + } else if ( strcasecmp( control, "manageDSAit" ) == 0 ) { if( manageDSAit ) { fprintf( stderr, "manageDSAit control previously specified"); return EXIT_FAILURE; diff --git a/clients/tools/ldapmodrdn.c b/clients/tools/ldapmodrdn.c index 60fd986adb..e2052ca01f 100644 --- a/clients/tools/ldapmodrdn.c +++ b/clients/tools/ldapmodrdn.c @@ -217,7 +217,27 @@ main(int argc, char **argv) *cvalue++ = '\0'; } - if ( strcasecmp( control, "manageDSAit" ) == 0 ) { + if ( strcasecmp( control, "authzid" ) == 0 ) { + if( authzid != NULL ) { + fprintf( stderr, "authzid control previously specified"); + return EXIT_FAILURE; + } + if( cvalue == NULL ) { + fprintf( stderr, "authzid: control value expected" ); + usage(prog); + return EXIT_FAILURE; + } + if( !crit ) { + fprintf( stderr, "authzid: must be marked critical" ); + usage(prog); + return EXIT_FAILURE; + } + + assert( authzid == NULL ); + authzid = control; + break; + + } else if ( strcasecmp( control, "manageDSAit" ) == 0 ) { if( manageDSAit ) { fprintf( stderr, "manageDSAit control previously specified"); return EXIT_FAILURE; diff --git a/clients/tools/ldappasswd.c b/clients/tools/ldappasswd.c index 4d3bfb29fc..bb3536f227 100644 --- a/clients/tools/ldappasswd.c +++ b/clients/tools/ldappasswd.c @@ -217,7 +217,27 @@ main( int argc, char *argv[] ) *cvalue++ = '\0'; } - if ( strcasecmp( control, "manageDSAit" ) == 0 ) { + if ( strcasecmp( control, "authzid" ) == 0 ) { + if( authzid != NULL ) { + fprintf( stderr, "authzid control previously specified"); + return EXIT_FAILURE; + } + if( cvalue == NULL ) { + fprintf( stderr, "authzid: control value expected" ); + usage(prog); + return EXIT_FAILURE; + } + if( !crit ) { + fprintf( stderr, "authzid: must be marked critical" ); + usage(prog); + return EXIT_FAILURE; + } + + assert( authzid == NULL ); + authzid = control; + break; + + } else if ( strcasecmp( control, "manageDSAit" ) == 0 ) { if( manageDSAit ) { fprintf( stderr, "manageDSAit control previously specified"); return EXIT_FAILURE; diff --git a/clients/tools/ldapsearch.c b/clients/tools/ldapsearch.c index 5ad8b5610e..2011f89612 100644 --- a/clients/tools/ldapsearch.c +++ b/clients/tools/ldapsearch.c @@ -454,7 +454,27 @@ main( int argc, char **argv ) *cvalue++ = '\0'; } - if ( strcasecmp( control, "manageDSAit" ) == 0 ) { + if ( strcasecmp( control, "authzid" ) == 0 ) { + if( authzid != NULL ) { + fprintf( stderr, "authzid control previously specified"); + return EXIT_FAILURE; + } + if( cvalue == NULL ) { + fprintf( stderr, "authzid: control value expected" ); + usage(prog); + return EXIT_FAILURE; + } + if( !crit ) { + fprintf( stderr, "authzid: must be marked critical" ); + usage(prog); + return EXIT_FAILURE; + } + + assert( authzid == NULL ); + authzid = control; + break; + + } else if ( strcasecmp( control, "manageDSAit" ) == 0 ) { if( manageDSAit ) { fprintf( stderr, "manageDSAit control previously specified"); return EXIT_FAILURE; diff --git a/clients/tools/ldapwhoami.c b/clients/tools/ldapwhoami.c index 37289e6235..182cfa40a6 100644 --- a/clients/tools/ldapwhoami.c +++ b/clients/tools/ldapwhoami.c @@ -173,7 +173,27 @@ main( int argc, char *argv[] ) *cvalue++ = '\0'; } - if ( strcasecmp( control, "manageDSAit" ) == 0 ) { + if ( strcasecmp( control, "authzid" ) == 0 ) { + if( authzid != NULL ) { + fprintf( stderr, "authzid control previously specified"); + return EXIT_FAILURE; + } + if( cvalue == NULL ) { + fprintf( stderr, "authzid: control value expected" ); + usage(prog); + return EXIT_FAILURE; + } + if( !crit ) { + fprintf( stderr, "authzid: must be marked critical" ); + usage(prog); + return EXIT_FAILURE; + } + + assert( authzid == NULL ); + authzid = control; + break; + + } else if ( strcasecmp( control, "manageDSAit" ) == 0 ) { if( manageDSAit ) { fprintf( stderr, "manageDSAit control previously specified"); return EXIT_FAILURE; -- 2.39.5