AttributeName *anew;
/* find last element in list */
- for (i = 0; an && an[i].an_name.bv_val; i++);
+ if ( an != NULL ) {
+ for ( i = 0; !BER_BVISNULL( &an[ i ].an_name ) ; i++)
+ ;
+ }
/* protect the input string from strtok */
str = ch_strdup( in );
/* Count words in string */
- j=1;
+ j = 1;
for ( s = str; *s; s++ ) {
if ( strchr( brkstr, *s ) != NULL ) {
j++;
anew++;
}
- anew->an_name.bv_val = NULL;
+ BER_BVZERO( &anew->an_name );
free( str );
return( an );
}
acl_destroy( bd->be_acl, frontendDB->be_acl );
limits_destroy( bd->be_limits );
+ if ( bd->be_replogfile ) {
+ ch_free( bd->be_replogfile );
+ }
+ destroy_replica_info( bd );
+
if ( dynamic ) {
free( bd );
}
free( bd->be_rootpw.bv_val );
}
acl_destroy( bd->be_acl, frontendDB->be_acl );
+
+ assert( bd->be_replogfile == NULL );
+ assert( bd->be_replica == NULL );
}
return 0;
*/
LDAP_SLAPD_F (int) add_replica_info LDAP_P(( Backend *be,
const char *uri, const char *host ));
+LDAP_SLAPD_F (int) destroy_replica_info LDAP_P (( Backend *be ));
LDAP_SLAPD_F (int) add_replica_suffix LDAP_P(( Backend *be,
int nr, const char *suffix ));
LDAP_SLAPD_F (int) add_replica_attrs LDAP_P(( Backend *be,
int
add_replica_info(
- Backend *be,
- const char *uri,
- const char *host
-)
+ Backend *be,
+ const char *uri,
+ const char *host )
{
int i = 0;
return( i );
}
+int
+destroy_replica_info(
+ Backend *be )
+{
+ int i = 0;
+
+ assert( be );
+
+ if ( be->be_replica == NULL ) {
+ return 0;
+ }
+
+ for ( ; be->be_replica[ i ] != NULL; i++ ) {
+
+ ch_free( (char *)be->be_replica[ i ]->ri_uri );
+
+ ber_bvarray_free( be->be_replica[ i ]->ri_nsuffix );
+
+ if ( be->be_replica[ i ]->ri_attrs ) {
+ AttributeName *an = be->be_replica[ i ]->ri_attrs;
+ int j;
+
+ for ( j = 0; !BER_BVISNULL( &an[ j ].an_name ); j++ )
+ {
+ ch_free( an[ j ].an_name.bv_val );
+ }
+ ch_free( an );
+ }
+
+ bindconf_free( &be->be_replica[ i ]->ri_bindconf );
+
+ ch_free( be->be_replica[ i ] );
+ }
+
+ ch_free( be->be_replica );
+
+ return 0;
+}
+
int
add_replica_suffix(
Backend *be,