ITS#3289 - exattrs support

This commit is contained in:
Jong Hyuk Choi 2004-08-29 22:28:28 +00:00
parent a6c08d747f
commit 6f9025423f
3 changed files with 47 additions and 1 deletions

View file

@ -3164,6 +3164,8 @@ add_syncrepl(
si->si_attrsonly = 0;
si->si_attrs = (char **) ch_calloc( 1, sizeof( char * ));
si->si_attrs[0] = NULL;
si->si_exattrs = (char **) ch_calloc( 1, sizeof( char * ));
si->si_exattrs[0] = NULL;
si->si_type = LDAP_SYNC_REFRESH_ONLY;
si->si_interval = 86400;
si->si_retryinterval = 0;
@ -3222,6 +3224,14 @@ add_syncrepl(
}
ch_free( si_entry->si_attrs );
}
if ( si_entry->si_exattrs ) {
int i = 0;
while ( si_entry->si_exattrs[i] != NULL ) {
ch_free( si_entry->si_exattrs[i] );
i++;
}
ch_free( si_entry->si_exattrs );
}
}
while ( !LDAP_STAILQ_EMPTY( &be->be_syncinfo )) {
@ -3275,6 +3285,7 @@ add_syncrepl(
#define SCOPESTR "scope"
#define ATTRSSTR "attrs"
#define ATTRSONLYSTR "attrsonly"
#define EXATTRSSTR "exattrs"
#define TYPESTR "type"
#define INTERVALSTR "interval"
#define LASTMODSTR "lastmod"
@ -3456,6 +3467,11 @@ parse_syncrepl_line(
{
val = cargv[ i ] + sizeof( ATTRSSTR );
str2clist( &si->si_attrs, val, "," );
} else if ( !strncasecmp( cargv[ i ],
EXATTRSSTR, sizeof( EXATTRSSTR ) - 1 ) )
{
val = cargv[ i ] + sizeof( EXATTRSSTR );
str2clist( &si->si_exattrs, val, "," );
} else if ( !strncasecmp( cargv[ i ],
TYPESTR, sizeof( TYPESTR ) - 1 ) )
{

View file

@ -1437,6 +1437,7 @@ typedef struct syncinfo_s {
int si_scope;
int si_attrsonly;
char **si_attrs;
char **si_exattrs;
int si_type;
time_t si_interval;
time_t *si_retryinterval;

View file

@ -110,6 +110,22 @@ init_syncrepl(syncinfo_t *si)
si->si_attrs = tmp;
for ( n = 0; si->si_exattrs[ n ] != NULL; n++ ) /* empty */;
if ( n ) {
/* Delete Attributes from exattrs list */
for ( i = 0; sync_descs[i] != NULL; i++ ) {
for ( j = 0; si->si_exattrs[j] != NULL; j++ ) {
if ( strcmp( si->si_exattrs[j], sync_descs[i]->ad_cname.bv_val )
== 0 )
{
ch_free( si->si_exattrs[j] );
for ( k = j; si->si_exattrs[k] != NULL; k++ ) {
si->si_exattrs[k] = si->si_exattrs[k+1];
}
}
}
}
}
}
static int
@ -1077,7 +1093,20 @@ syncrepl_message_to_entry(
if ( mod->sml_desc->ad_type->sat_flags & SLAP_AT_DYNAMIC ) {
*modtail = mod->sml_next;
slap_mod_free( &mod->sml_mod, 0 );
free( mod );
ch_free( mod );
} else {
modtail = &mod->sml_next;
}
}
/* Strip out attrs in exattrs list */
for ( modtail = modlist; *modtail ; ) {
mod = *modtail;
if ( ldap_charray_inlist( si->si_exattrs,
mod->sml_desc->ad_type->sat_cname.bv_val )) {
*modtail = mod->sml_next;
slap_mod_free( &mod->sml_mod, 0 );
ch_free( mod );
} else {
modtail = &mod->sml_next;
}