]> git.sur5r.net Git - openldap/commitdiff
Misc cleanup, but doesn't fix tests.
authorKurt Zeilenga <kurt@openldap.org>
Mon, 24 Dec 2001 19:21:42 +0000 (19:21 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Mon, 24 Dec 2001 19:21:42 +0000 (19:21 +0000)
servers/slapd/entry.c
servers/slapd/modify.c
servers/slapd/tools/slapadd.c
servers/slapd/tools/slapcommon.c

index b0f6511219260d7c1a0d8e453fe9594adde2790f..523bbd79ed6f734dbd0f37e50d2b3476ce79bf33 100644 (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,
index 58e2d9acb4996f5781981bcf56be1bb39f75bc27..1bcf5b5c7c5d1d1820d1d2d410f7326813bf0ec4 100644 (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 );
index 41c654bb919300d968c02012130826b56c9768fc..6f5ddeb6fa77ad9820ac16f442724f332c4cf26f 100644 (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;
index 3143550611ceee2d0502344d11e19d8b5162ec5e..7cee79bbb63001f437b7eed634a5b4af6c149e2d 100644 (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",