mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-06 10:46:21 +08:00
A follow-on commit to the previous @oc support change to use anlist
This commit is contained in:
parent
5c0581b184
commit
e4d199d7bb
@ -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,7 +959,8 @@ anlist2attrs( AttributeName * anlist )
|
||||
}
|
||||
}
|
||||
|
||||
attrs = (char **) ch_realloc( attrs, (i+1) * sizeof( char * ));
|
||||
if ( i != n )
|
||||
attrs = (char **) ch_realloc( attrs, (i+1) * sizeof( char * ));
|
||||
|
||||
return attrs;
|
||||
}
|
||||
|
@ -483,11 +483,13 @@ int backend_destroy(void)
|
||||
syncinfo_free( si_entry );
|
||||
}
|
||||
|
||||
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->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 ) {
|
||||
|
@ -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,
|
||||
|
@ -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,7 +188,9 @@ init_syncrepl(syncinfo_t *si)
|
||||
}
|
||||
|
||||
for ( i = 0; exattrs[i] != NULL; i++ ) ;
|
||||
exattrs = (char **) ch_realloc( exattrs, (i + 1)*sizeof(char *));
|
||||
|
||||
if ( i != n )
|
||||
exattrs = (char **) ch_realloc( exattrs, (i + 1)*sizeof(char *));
|
||||
}
|
||||
|
||||
si->si_exattrs = exattrs;
|
||||
|
Loading…
Reference in New Issue
Block a user