Misc cleanup, but doesn't fix tests.

This commit is contained in:
Kurt Zeilenga 2001-12-24 19:21:42 +00:00
parent 5f28673792
commit 6441db83c0
4 changed files with 12 additions and 21 deletions

View File

@ -256,7 +256,6 @@ str2entry( char *s )
} }
rc = attr_merge( e, ad, vals ); rc = attr_merge( e, ad, vals );
if( rc != 0 ) { if( rc != 0 ) {
#ifdef NEW_LOGGING #ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1, LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,

View File

@ -530,7 +530,7 @@ int slap_modlist2mods(
* and pretty if appropriate * and pretty if appropriate
*/ */
for( nvals = 0; ml->ml_bvalues[nvals]; nvals++ ) { for( nvals = 0; ml->ml_bvalues[nvals]; nvals++ ) {
struct berval *pval; struct berval *pval = NULL;
if( pretty ) { if( pretty ) {
rc = pretty( ad->ad_type->sat_syntax, rc = pretty( ad->ad_type->sat_syntax,
ml->ml_bvalues[nvals], &pval ); ml->ml_bvalues[nvals], &pval );

View File

@ -64,18 +64,8 @@ main( int argc, char **argv )
break; break;
} }
/* make sure the DN is valid */
if( dn_normalize( e->e_ndn ) == NULL || e->e_ndn[0] == '\0' ) {
fprintf( stderr, "%s: invalid dn=\"%s\" (line=%d)\n",
progname, e->e_dn, lineno );
rc = EXIT_FAILURE;
entry_free( e );
if( continuemode ) continue;
break;
}
/* make sure the DN is not empty */ /* make sure the DN is not empty */
if( e->e_ndn == '\0' ) { if( !e->e_nname.bv_len ) {
fprintf( stderr, "%s: empty dn=\"%s\" (line=%d)\n", fprintf( stderr, "%s: empty dn=\"%s\" (line=%d)\n",
progname, e->e_dn, lineno ); progname, e->e_dn, lineno );
rc = EXIT_FAILURE; rc = EXIT_FAILURE;

View File

@ -80,7 +80,7 @@ slap_tool_init(
int argc, char **argv ) int argc, char **argv )
{ {
char *options; char *options;
char *base = NULL; struct berval base = { 0, NULL };
int rc, i, dbnum; int rc, i, dbnum;
int mode = SLAP_TOOL_MODE; int mode = SLAP_TOOL_MODE;
@ -120,7 +120,8 @@ slap_tool_init(
while ( (i = getopt( argc, argv, options )) != EOF ) { while ( (i = getopt( argc, argv, options )) != EOF ) {
switch ( i ) { switch ( i ) {
case 'b': case 'b':
base = strdup( optarg ); base.bv_val = strdup( optarg );
base.bv_len = strlen( optarg );
case 'c': /* enable continue mode */ case 'c': /* enable continue mode */
continuemode++; continuemode++;
@ -157,7 +158,7 @@ slap_tool_init(
} }
} }
if ( ( argc != optind ) || (dbnum >= 0 && base != NULL ) ) { if ( ( argc != optind ) || (dbnum >= 0 && base.bv_val != NULL ) ) {
usage( tool ); usage( tool );
} }
@ -210,17 +211,18 @@ slap_tool_init(
exit( EXIT_FAILURE ); exit( EXIT_FAILURE );
} }
if( base != NULL ) { if( base.bv_val != NULL ) {
char *tbase = ch_strdup( base ); struct berval *nbase = NULL;
if( dn_normalize( tbase ) == NULL ) { rc = dnNormalize( NULL, &base, &nbase );
if( rc != LDAP_SUCCESS ) {
fprintf( stderr, "%s: slap_init invalid suffix (\"%s\")\n", fprintf( stderr, "%s: slap_init invalid suffix (\"%s\")\n",
progname, base ); progname, base );
exit( EXIT_FAILURE ); exit( EXIT_FAILURE );
} }
be = select_backend( tbase, 0, 0 ); be = select_backend( nbase->bv_val, 0, 0 );
free( tbase ); ber_bvfree( nbase );
if( be == NULL ) { if( be == NULL ) {
fprintf( stderr, "%s: slap_init no backend for \"%s\"\n", fprintf( stderr, "%s: slap_init no backend for \"%s\"\n",