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;
}
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 )) {
#define SCOPESTR "scope"
#define ATTRSSTR "attrs"
#define ATTRSONLYSTR "attrsonly"
+#define EXATTRSSTR "exattrs"
#define TYPESTR "type"
#define INTERVALSTR "interval"
#define LASTMODSTR "lastmod"
{
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 ) )
{
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
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;
}