From 0fa9578f48c1e19e1080ce792aa8cb919183dfe1 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Mon, 26 Dec 2005 16:55:50 +0000 Subject: [PATCH] handle when URIs are null --- servers/slapd/back-monitor/database.c | 36 ++++++++++++++++----------- 1 file changed, 21 insertions(+), 15 deletions(-) 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) */ } -- 2.39.5