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 );
if( rc != 0 ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,

View File

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

View File

@ -64,18 +64,8 @@ main( int argc, char **argv )
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 */
if( e->e_ndn == '\0' ) {
if( !e->e_nname.bv_len ) {
fprintf( stderr, "%s: empty dn=\"%s\" (line=%d)\n",
progname, e->e_dn, lineno );
rc = EXIT_FAILURE;

View File

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