case SLAPINDEX:
options = "\t[-n databasenumber | -b suffix]\n";
break;
+
+ case SLAPAUTH:
+ options = "\t[-U authcID] [-X authzID] ID [...]\n";
+ break;
}
if ( options != NULL ) {
{
char *options;
char *conffile = SLAPD_DEFAULT_CONFIGFILE;
- struct berval base = { 0, NULL };
+ struct berval base = BER_BVNULL;
char *subtree = NULL;
char *ldiffile = NULL;
int rc, i, dbnum;
int truncatemode = 0;
#ifdef CSRIMALLOC
- leakfilename = malloc( strlen( progname ) + sizeof(".leak") );
+ leakfilename = malloc( strlen( progname ) + STRLEOF( ".leak" ) - 1 );
sprintf( leakfilename, "%s.leak", progname );
if( ( leakfile = fopen( leakfilename, "w" )) == NULL ) {
leakfile = stderr;
options = "d:f:v";
break;
+ case SLAPAUTH:
+ options = "d:f:U:vX:";
+ break;
+
case SLAPINDEX:
options = "b:cd:f:n:v";
mode |= SLAP_TOOL_READMAIN;
while ( (i = getopt( argc, argv, options )) != EOF ) {
switch ( i ) {
case 'b':
- base.bv_val = strdup( optarg );
- base.bv_len = strlen( base.bv_val );
+ ber_str2bv( optarg, 0, 1, &base );
break;
case 'c': /* enable continue mode */
mode |= SLAP_TRUNCATE_MODE;
break;
+ case 'U':
+ ber_str2bv( optarg, 0, 0, &authcID );
+ break;
+
case 'u': /* dry run */
dryrun++;
break;
update_ctxcsn = SLAP_TOOL_CTXCSN_BATCH;
break;
+ case 'X':
+ ber_str2bv( optarg, 0, 0, &authzID );
+ break;
+
default:
usage( tool, progname );
break;
}
break;
+ case SLAPAUTH:
+ if ( argc == optind && BER_BVISNULL( &authcID ) ) {
+ usage( tool, progname );
+ }
+ break;
+
case SLAPTEST:
if ( argc != optind ) {
usage( tool, progname );
exit( EXIT_FAILURE );
}
+ if ( overlay_init() ) {
+ fprintf( stderr, "%s: overlay_init failed!\n", progname );
+ exit( EXIT_FAILURE );
+ }
+
rc = read_config( conffile, 0 );
if ( rc != 0 ) {
case SLAPTEST:
return;
+ case SLAPAUTH:
+ be = NULL;
+ goto startup;
+
default:
break;
}
if( subtree ) {
struct berval val;
- val.bv_val = subtree;
- val.bv_len = strlen( subtree );
+ ber_str2bv( subtree, 0, 0, &val );
rc = dnNormalize( 0, NULL, NULL, &val, &sub_ndn, NULL );
if( rc != LDAP_SUCCESS ) {
fprintf( stderr, "Invalid subtree DN '%s'\n", optarg );
exit( EXIT_FAILURE );
}
- if( base.bv_val == NULL && dbnum == -1 )
+ if ( BER_BVISNULL( &base ) && dbnum == -1 )
base = val;
else
free( subtree );
be = &backends[dbnum];
}
+startup:;
+
#ifdef CSRIMALLOC
mal_leaktrace(1);
#endif