#include <stdio.h>
#include <ac/string.h>
+#include "lutil.h"
+
#include "back-bdb.h"
#include "external.h"
EntryInfo *suffix_ei;
Entry *ctxcsn_e;
int ctxcsn_added = 0;
+ char csnbuf[ LDAP_LUTIL_CSNSTR_BUFSIZE ];
+ struct berval csn;
LDAPControl **preread_ctrl = NULL;
LDAPControl *ctrls[SLAP_MAX_RESPONSE_CONTROLS];
op->o_req_dn.bv_val, 0, 0 );
#endif
+ slap_get_csn( op, csnbuf, sizeof(csnbuf), &csn, 1 );
+
if( 0 ) {
retry: /* transaction retry */
if( e != NULL ) {
}
if ( rs->sr_err == LDAP_SUCCESS && !op->o_no_psearch ) {
+ Attribute *a;
+ a = attr_find( e->e_attrs, slap_schema.si_ad_entryCSN );
+ if ( a ) {
+ if( (void *) e->e_attrs != (void *) (e+1)) {
+ attr_delete( &e->e_attrs, slap_schema.si_ad_entryCSN );
+ attr_merge_normalize_one( e, slap_schema.si_ad_entryCSN,
+ &csn, NULL );
+ } else {
+ a->a_vals[0] = csn;
+ }
+ } else {
+ /* Hm, the entryCSN ought to exist. ??? */
+ }
ldap_pvt_thread_rdwr_wlock( &bdb->bi_pslist_rwlock );
LDAP_LIST_FOREACH( ps_list, &bdb->bi_psearch_list, o_ps_link ) {
rc = bdb_psearch( op, rs, ps_list, e, LDAP_PSEARCH_BY_DELETE );
} else if ( strcasecmp( cargv[0], "allows" ) == 0 ||
strcasecmp( cargv[0], "allow" ) == 0 )
{
- slap_mask_t allows;
+ slap_mask_t allows = 0;
if ( be != NULL ) {
#ifdef NEW_LOGGING
return( 1 );
}
- allows = 0;
-
for( i=1; i < cargc; i++ ) {
if( strcasecmp( cargv[i], "bind_v2" ) == 0 ) {
allows |= SLAP_ALLOW_BIND_V2;
} else if( strcasecmp( cargv[i], "update_anon" ) == 0 ) {
allows |= SLAP_ALLOW_UPDATE_ANON;
- } else if( strcasecmp( cargv[i], "none" ) != 0 ) {
+ } else {
#ifdef NEW_LOGGING
LDAP_LOG( CONFIG, CRIT, "%s: line %d: "
"unknown feature %s in \"allow <features>\" line.\n",
fname, lineno, cargv[i] );
#endif
- return( 1 );
+ return 1;
}
}
- global_allows = allows;
+ global_allows |= allows;
/* disallow these features */
} else if ( strcasecmp( cargv[0], "disallows" ) == 0 ||
strcasecmp( cargv[0], "disallow" ) == 0 )
{
- slap_mask_t disallows;
+ slap_mask_t disallows = 0;
if ( be != NULL ) {
#ifdef NEW_LOGGING
return( 1 );
}
- disallows = 0;
-
for( i=1; i < cargc; i++ ) {
if( strcasecmp( cargv[i], "bind_anon" ) == 0 ) {
disallows |= SLAP_DISALLOW_BIND_ANON;
} else if( strcasecmp( cargv[i], "tls_authc" ) == 0 ) {
disallows |= SLAP_DISALLOW_TLS_AUTHC;
- } else if( strcasecmp( cargv[i], "none" ) != 0 ) {
+ } else {
#ifdef NEW_LOGGING
LDAP_LOG( CONFIG, CRIT,
"%s: line %d: unknown feature %s in "
fname, lineno, cargv[i] );
#endif
- return( 1 );
+ return 1;
}
}
- global_disallows = disallows;
+ global_disallows |= disallows;
/* require these features */
} else if ( strcasecmp( cargv[0], "requires" ) == 0 ||
strcasecmp( cargv[0], "require" ) == 0 )
{
- slap_mask_t requires;
+ slap_mask_t requires = 0;
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
return( 1 );
}
- requires = 0;
-
for( i=1; i < cargc; i++ ) {
if( strcasecmp( cargv[i], "bind" ) == 0 ) {
requires |= SLAP_REQUIRE_BIND;
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;
}