From: Pierangelo Masarati Date: Mon, 26 Dec 2005 16:55:50 +0000 (+0000) Subject: handle when URIs are null X-Git-Tag: OPENLDAP_REL_ENG_2_4_BP~503 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=0fa9578f48c1e19e1080ce792aa8cb919183dfe1;p=openldap handle when URIs are null --- diff --git a/servers/slapd/back-monitor/database.c b/servers/slapd/back-monitor/database.c index 6672c611cf..2d532c77e2 100644 --- a/servers/slapd/back-monitor/database.c +++ b/servers/slapd/back-monitor/database.c @@ -361,19 +361,22 @@ monitor_subsys_database_init( li->li_bvuri, NULL ); #else char **urls = ldap_str2charray( li->li_uri, " " ); - int u; - for ( u = 0; urls[ u ] != NULL; u++ ) { - struct berval bv; + if ( urls != NULL ) { + int u; + + for ( u = 0; urls[ u ] != NULL; u++ ) { + struct berval bv; - ber_str2bv( urls[ u ], 0, 0, &bv ); + ber_str2bv( urls[ u ], 0, 0, &bv ); - attr_merge_normalize_one( e, + attr_merge_normalize_one( e, slap_schema.si_ad_labeledURI, &bv, NULL ); - } + } - ldap_charray_free( urls ); + ldap_charray_free( urls ); + } #endif #endif /* defined(SLAPD_LDAP) */ @@ -384,18 +387,21 @@ monitor_subsys_database_init( for ( t = 0; t < mi->mi_ntargets; t++ ) { char **urls = ldap_str2charray( mi->mi_targets[ t ].mt_uri, " " ); - int u; - for ( u = 0; urls[ u ] != NULL; u++ ) { - struct berval bv; + if ( urls != NULL ) { + int u; - ber_str2bv( urls[ u ], 0, 0, &bv ); + for ( u = 0; urls[ u ] != NULL; u++ ) { + struct berval bv; - attr_merge_normalize_one( e, - slap_schema.si_ad_labeledURI, - &bv, NULL ); + ber_str2bv( urls[ u ], 0, 0, &bv ); + + attr_merge_normalize_one( e, + slap_schema.si_ad_labeledURI, + &bv, NULL ); + } + ldap_charray_free( urls ); } - ldap_charray_free( urls ); } #endif /* defined(SLAPD_META) */ }