]> git.sur5r.net Git - openldap/commitdiff
handle when URIs are null
authorPierangelo Masarati <ando@openldap.org>
Mon, 26 Dec 2005 16:55:50 +0000 (16:55 +0000)
committerPierangelo Masarati <ando@openldap.org>
Mon, 26 Dec 2005 16:55:50 +0000 (16:55 +0000)
servers/slapd/back-monitor/database.c

index 6672c611cfa3522247dcb412edb3402dff5daebf..2d532c77e21ffa9ae6eddf92df9bea13896f5086 100644 (file)
@@ -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) */
                }