]> git.sur5r.net Git - openldap/commitdiff
Fix empty dn.
authorKurt Zeilenga <kurt@openldap.org>
Fri, 13 Aug 1999 22:43:21 +0000 (22:43 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Fri, 13 Aug 1999 22:43:21 +0000 (22:43 +0000)
servers/slapd/tools/ldif2id2children-bdb2.c
servers/slapd/tools/ldif2id2children.c

index 367f86a08fa8950b6a4ea628da0a3f5985dcabfc..caa49a82a0955faecf69b73b380f58677cb2ff31 100644 (file)
@@ -103,9 +103,11 @@ main( int argc, char **argv )
                                        fprintf( stderr, "entry %ld has no dn\n",
                                            id );
                                } else {
-                                       (void) dn_normalize_case( val );
+                                       if( val != NULL ) {
+                                               (void) dn_normalize_case( val );
+                                       }
                                        key.dptr = val;
-                                       key.dsize = strlen( val ) + 1;
+                                       key.dsize = strlen( val != NULL ? val : "" ) + 1;
                                        data.dptr = (char *) &id;
                                        data.dsize = sizeof(ID);
                                        if ( ldbm_store( db->dbc_db, key, data,
index ae07c18d83a810fbd7c3236b4ed84ae29039dcb6..cb60859c32906d8b663314c91849f1c4bc7d6012 100644 (file)
@@ -88,14 +88,17 @@ main( int argc, char **argv )
                                        fprintf( stderr, "entry %ld has no dn\n",
                                            id );
                                } else {
-                                       (void) dn_normalize_case( val );
+                                       if( val != NULL ) {
+                                               (void) dn_normalize_case( val );
+                                       }
 #ifndef DN_INDICES
                                        key.dptr = val;
-                                       key.dsize = strlen( val ) + 1;
+                                       key.dsize = strlen( val != NULL ? val : "" ) + 1;
 #else
-                                       key.dsize = strlen( val ) + 2;
+                                       key.dsize = strlen( val != NULL ? val : "" ) + 2;
                                        key.dptr = ch_malloc( key.dsize );
-                                       sprintf( key.dptr, "%c%s", DN_BASE_PREFIX, val );
+                                       sprintf( key.dptr, "%c%s", DN_BASE_PREFIX,
+                                               val != NULL ? val : "" );
 #endif
                                        data.dptr = (char *) &id;
                                        data.dsize = sizeof(ID);