A follow-on commit to the previous @oc support change to use anlist

This commit is contained in:
Jong Hyuk Choi 2004-09-23 19:23:17 +00:00
parent 5c0581b184
commit e4d199d7bb
4 changed files with 38 additions and 30 deletions

View File

@ -811,14 +811,7 @@ str2anlist( AttributeName *an, char *in, const char *brkstr )
adname.bv_val = &anew->an_name.bv_val[1];
slap_bv2ad(&adname, &anew->an_desc, &text);
if ( !anew->an_desc ) {
free( an );
free( str );
/*
* overwrites input string
* on error!
*/
strcpy( in, s );
return NULL;
goto reterr;
}
} break;
@ -830,14 +823,7 @@ str2anlist( AttributeName *an, char *in, const char *brkstr )
ocname.bv_val = &anew->an_name.bv_val[1];
anew->an_oc = oc_bvfind( &ocname );
if ( !anew->an_oc ) {
free( an );
free( str );
/*
* overwrites input string
* on error!
*/
strcpy( in, s );
return NULL;
goto reterr;
}
if ( anew->an_name.bv_val[0] == '!' ) {
@ -849,11 +835,7 @@ str2anlist( AttributeName *an, char *in, const char *brkstr )
/* old (deprecated) way */
anew->an_oc = oc_bvfind( &anew->an_name );
if ( !anew->an_oc ) {
free( an );
free( str );
/* overwrites input string on error! */
strcpy( in, s );
return NULL;
goto reterr;
}
}
}
@ -863,6 +845,19 @@ str2anlist( AttributeName *an, char *in, const char *brkstr )
anew->an_name.bv_val = NULL;
free( str );
return( an );
reterr:
for ( i = 0; an[i].an_name.bv_val; i++ ) {
free( an[i].an_name.bv_val );
}
free( an );
/*
* overwrites input string
* on error!
*/
strcpy( in, s );
free( str );
return NULL;
}
char **anlist2charray_x( AttributeName *an, int dup, void *ctx )
@ -964,6 +959,7 @@ anlist2attrs( AttributeName * anlist )
}
}
if ( i != n )
attrs = (char **) ch_realloc( attrs, (i+1) * sizeof( char * ));
return attrs;

View File

@ -483,12 +483,14 @@ int backend_destroy(void)
syncinfo_free( si_entry );
}
if ( bd->be_pending_csn_list ) {
LDAP_TAILQ_FOREACH( csne, bd->be_pending_csn_list, ce_csn_link ) {
LDAP_TAILQ_REMOVE( bd->be_pending_csn_list, csne, ce_csn_link );
ch_free( csne->ce_csn->bv_val );
ch_free( csne->ce_csn );
ch_free( csne );
}
}
if ( bd->bd_info->bi_db_destroy ) {
bd->bd_info->bi_db_destroy( bd );

View File

@ -2312,6 +2312,7 @@ add_syncrepl(
if ( rc < 0 || duplicated_replica_id ) {
Debug( LDAP_DEBUG_ANY, "failed to add syncinfo\n", 0, 0, 0 );
syncinfo_free( si );
return 1;
} else {
Debug( LDAP_DEBUG_CONFIG,

View File

@ -83,7 +83,9 @@ init_syncrepl(syncinfo_t *si)
i++;
}
}
attrs = ( char ** ) ch_realloc( attrs, (i + 1)*sizeof( char * ));
attrs = ( char ** ) ch_realloc( attrs, (i + 2)*sizeof( char * ));
attrs[i] = ch_strdup("*");
attrs[i + 1] = NULL;
} else if ( si->si_allopattrs ) {
i = 0;
while ( attrs[i] ) {
@ -97,7 +99,9 @@ init_syncrepl(syncinfo_t *si)
i++;
}
}
attrs = ( char ** ) ch_realloc( attrs, (i + 1)*sizeof( char * ));
attrs = ( char ** ) ch_realloc( attrs, (i + 2)*sizeof( char * ));
attrs[i] = ch_strdup("+");
attrs[i + 1] = NULL;
}
if ( !si->si_allopattrs ) {
@ -143,8 +147,11 @@ init_syncrepl(syncinfo_t *si)
exattrs = anlist2attrs( si->si_exanlist );
if ( exattrs ) {
for ( n = 0; exattrs[n] != NULL; n++ ) ;
for ( i = 0; sync_descs[i] != NULL; i++ ) {
j = 0;
while ( exattrs[j] != NULL ) {
@ -181,6 +188,8 @@ init_syncrepl(syncinfo_t *si)
}
for ( i = 0; exattrs[i] != NULL; i++ ) ;
if ( i != n )
exattrs = (char **) ch_realloc( exattrs, (i + 1)*sizeof(char *));
}