From: Kurt Zeilenga Date: Fri, 13 Aug 1999 22:43:21 +0000 (+0000) Subject: Fix empty dn. X-Git-Tag: TWEB_OL_BASE~224 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=5007e92278c5ec68cc99cd32ddfc7965f288d41c;p=openldap Fix empty dn. --- diff --git a/servers/slapd/tools/ldif2id2children-bdb2.c b/servers/slapd/tools/ldif2id2children-bdb2.c index 367f86a08f..caa49a82a0 100644 --- a/servers/slapd/tools/ldif2id2children-bdb2.c +++ b/servers/slapd/tools/ldif2id2children-bdb2.c @@ -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, diff --git a/servers/slapd/tools/ldif2id2children.c b/servers/slapd/tools/ldif2id2children.c index ae07c18d83..cb60859c32 100644 --- a/servers/slapd/tools/ldif2id2children.c +++ b/servers/slapd/tools/ldif2id2children.c @@ -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);