#define LDAP_CONTROL_PAGEDRESULTS "1.2.840.113556.1.4.319"
#endif
+#define LDAP_CLIENT_UPDATE 1
#ifdef LDAP_CLIENT_UPDATE
#define LDAP_CONTROL_CLIENT_UPDATE "1.3.6.1.4.1.4203.666.5.3"
#define LDAP_CONTROL_ENTRY_UPDATE "1.3.6.1.4.1.4203.666.5.4"
#ifdef LDAP_CLIENT_UPDATE
/* resultCode for LCUP */
-#define LCUP_RESOURCES_EXHAUSTED 0x62
-#define LCUP_SECURITY_VIOLATION 0x63
-#define LCUP_INVALID_COOKIE 0x64
-#define LCUP_UNSUPPORTED_SCHEME 0x65
-#define LCUP_CLIENT_DISCONNECT 0x66
-#define LCUP_RELOAD_REQUIRED 0x67
-#endif /* LDAP_CLIENT_UPDATE */
-
-#ifdef LDAP_CLIENT_UPDATE
-#define SYNCHRONIZE_ONLY 0x00
-#define SYNCHRONIZE_AND_PERSIST 0x01
-#define PERSIST_ONLY 0x02
-#endif /* LDAP_CLIENT_UPDATE */
-
-#ifdef LDAP_CLIENT_UPDATE
-#define LDAP_LCUP_DEFAULT_SEND_COOKIE_INTERVAL 0x01
+#define LDAP_CUP_RESOURCES_EXHAUSTED 0x62
+#define LDAP_CUP_SECURITY_VIOLATION 0x63
+#define LDAP_CUP_INVALID_COOKIE 0x64
+#define LDAP_CUP_UNSUPPORTED_SCHEME 0x65
+#define LDAP_CUP_CLIENT_DISCONNECT 0x66
+#define LDAP_CUP_RELOAD_REQUIRED 0x67
+
+/* LCUP update type */
+#define LDAP_CUP_SYNC_ONLY 0x00
+#define LDAP_CUP_SYNC_AND_PERSIST 0x01
+#define LDAP_CUP_PERSIST_ONLY 0x02
+
+/* LCUP default cookie interval */
+#define LDAP_CUP_DEFAULT_SEND_COOKIE_INTERVAL 0x01
#endif /* LDAP_CLIENT_UPDATE */
/*
int manageDSAit;
#ifdef LDAP_CLIENT_UPDATE
- Filter lcupf, csnfnot, csnfeq, csnfand, csnfge;
+ Filter lcupf, csnfnot, csnfeq, csnfand, csnfge;
AttributeAssertion aa_ge, aa_eq;
- LDAPControl ctrl;
+ LDAPControl ctrl;
int entry_count = 0;
#endif /* LDAP_CLIENT_UPDATE */
#endif /* SLAP_X_FILTER_HASSUBORDINATES */
#ifdef LDAP_CLIENT_UPDATE
- if ( op->o_clientupdatetype == SYNCHRONIZE_ONLY ||
- op->o_clientupdatetype == SYNCHRONIZE_AND_PERSIST ) {
- lcupf.f_choice = LDAP_FILTER_AND;
- lcupf.f_and = &csnfnot;
- lcupf.f_next = NULL;
-
- csnfnot.f_choice = LDAP_FILTER_NOT;
- csnfnot.f_not = &csnfeq;
- csnfnot.f_next = &csnfand;
-
- csnfeq.f_choice = LDAP_FILTER_EQUALITY;
- csnfeq.f_ava = &aa_eq;
- csnfeq.f_av_desc = slap_schema.si_ad_entryCSN;
- ber_dupbv(&csnfeq.f_av_value, op->o_clientupdatestate);
-
- csnfand.f_choice = LDAP_FILTER_AND;
- csnfand.f_and = &csnfge;
- csnfand.f_next = NULL;
-
- csnfge.f_choice = LDAP_FILTER_GE;
- csnfge.f_ava = &aa_ge;
- csnfge.f_av_desc = slap_schema.si_ad_entryCSN;
- ber_dupbv(&csnfge.f_av_value, op->o_clientupdatestate);
- csnfge.f_next = filter;
- }
+ if ( op->o_clientupdate_type & SLAP_LCUP_SYNC ) {
+ lcupf.f_choice = LDAP_FILTER_AND;
+ lcupf.f_and = &csnfnot;
+ lcupf.f_next = NULL;
+
+ csnfnot.f_choice = LDAP_FILTER_NOT;
+ csnfnot.f_not = &csnfeq;
+ csnfnot.f_next = &csnfand;
+
+ csnfeq.f_choice = LDAP_FILTER_EQUALITY;
+ csnfeq.f_ava = &aa_eq;
+ csnfeq.f_av_desc = slap_schema.si_ad_entryCSN;
+ ber_dupbv(&csnfeq.f_av_value, op->o_clientupdate_state);
+
+ csnfand.f_choice = LDAP_FILTER_AND;
+ csnfand.f_and = &csnfge;
+ csnfand.f_next = NULL;
+
+ csnfge.f_choice = LDAP_FILTER_GE;
+ csnfge.f_ava = &aa_ge;
+ csnfge.f_av_desc = slap_schema.si_ad_entryCSN;
+ ber_dupbv(&csnfge.f_av_value, op->o_clientupdate_state);
+ csnfge.f_next = filter;
+ }
#endif /* LDAP_CLIENT_UPDATE */
for ( id = bdb_idl_first( candidates, &cursor );
goto loop_continue;
}
- hasSubordinates = slap_operational_hasSubordinate( hs == LDAP_COMPARE_TRUE );
+ hasSubordinates = slap_operational_hasSubordinate(
+ hs == LDAP_COMPARE_TRUE );
+
if ( hasSubordinates == NULL ) {
goto loop_continue;
}
/* if it matches the filter and scope, send it */
#ifdef LDAP_CLIENT_UPDATE
- if ( op->o_clientupdatetype == SYNCHRONIZE_ONLY ||
- op->o_clientupdatetype == SYNCHRONIZE_AND_PERSIST ) {
- rc = test_filter( be, conn, op, e, &lcupf );
- }
- else {
- rc = test_filter( be, conn, op, e, filter );
- }
-#else /* LDAP_CLIENT_UPDATE */
- rc = test_filter( be, conn, op, e, filter );
+ if ( op->o_clientupdate_type & SLAP_LCUP_SYNC ) {
+ rc = test_filter( be, conn, op, e, &lcupf );
+ } else
#endif /* LDAP_CLIENT_UPDATE */
+ {
+ rc = test_filter( be, conn, op, e, filter );
+ }
#ifdef SLAP_X_FILTER_HASSUBORDINATES
if ( hasSubordinates ) {
loop_continue:
if( e != NULL ) {
/* free reader lock */
- bdb_cache_return_entry_r ( bdb->bi_dbenv, &bdb->bi_cache, e , &lock);
- e = NULL;
+ bdb_cache_return_entry_r( bdb->bi_dbenv,
+ &bdb->bi_cache, e , &lock);
+ e = NULL;
}
ldap_pvt_thread_yield();
int rc = LDAP_SUCCESS;
const char *errmsg = NULL;
-#ifdef LDAP_CLIENT_UPDATE
- op->o_clientupdatetype = -1;
-#endif
-
len = ber_pvt_ber_remaining(ber);
if( len == 0) {
struct berval scheme = { 0, NULL };
struct berval cookie = { 0, NULL };
- if ( op->o_noop != SLAP_NO_CONTROL ) {
+ if ( op->o_clientupdate != SLAP_NO_CONTROL ) {
*text = "LCUP client update control specified multiple times";
return LDAP_PROTOCOL_ERROR;
}
return LDAP_PROTOCOL_ERROR;
}
- if ( type != SYNCHRONIZE_ONLY &&
- type != SYNCHRONIZE_AND_PERSIST &&
- type != PERSIST_ONLY ) {
+ switch( type ) {
+ case LDAP_CUP_SYNC_ONLY:
+ type = SLAP_LCUP_SYNC;
+ break;
+ case LDAP_CUP_SYNC_AND_PERSIST:
+ type = SLAP_LCUP_SYNC_AND_PERSIST;
+ break;
+ case LDAP_CUP_PERSIST_ONLY:
+ type = SLAP_LCUP_PERSIST;
+ break;
+ default:
*text = "LCUP client update control : unknown update type";
return LDAP_PROTOCOL_ERROR;
}
if ( interval <= 0 ) {
/* server chooses interval */
- interval = LDAP_LCUP_DEFAULT_SEND_COOKIE_INTERVAL;
+ interval = LDAP_CUP_DEFAULT_SEND_COOKIE_INTERVAL;
}
- }
- else {
+
+ } else {
/* server chooses interval */
- interval = LDAP_LCUP_DEFAULT_SEND_COOKIE_INTERVAL;
+ interval = LDAP_CUP_DEFAULT_SEND_COOKIE_INTERVAL;
}
if ( (tag = ber_peek_tag( ber, &len )) == LBER_DEFAULT ) {
}
#endif
- op->o_clientupdatestate = ber_dupbv(NULL, &cookie);
+ op->o_clientupdate_state = ber_dupbv(NULL, &cookie);
(void) ber_free( ber, 1 );
- op->o_clientupdatetype = type;
- op->o_clientupdateinterval = interval;
+ op->o_clientupdate_type = (char) type;
+ op->o_clientupdate_interval = interval;
op->o_clientupdate = ctrl->ldctl_iscritical
? SLAP_CRITICAL_CONTROL
/*
* null terminated list of syntaxes compatible with this syntax
* note: when MS_EXT is set, this MUST NOT contain the assertion
- * syntax of the rule. When MS_EXT is not set, it MAY.
+ * syntax of the rule. When MS_EXT is not set, it MAY.
*/
Syntax **smr_compat_syntaxes;
#define SLAP_RESTRICT_OP_SEARCH 0x0080U
#define SLAP_RESTRICT_OP_READS \
- ( SLAP_RESTRICT_OP_COMPARE \
+ ( SLAP_RESTRICT_OP_COMPARE \
| SLAP_RESTRICT_OP_SEARCH )
#define SLAP_RESTRICT_OP_WRITES \
( SLAP_RESTRICT_OP_ADD \
struct berval be_rootdn; /* the magic "root" name (DN) for this db */
struct berval be_rootndn; /* the magic "root" normalized name (DN) for this db */
struct berval be_rootpw; /* the magic "root" password for this db */
- unsigned int be_max_deref_depth; /* limit for depth of an alias deref */
+ unsigned int be_max_deref_depth; /* limit for depth of an alias deref */
#define be_sizelimit be_def_limit.lms_s_soft
#define be_timelimit be_def_limit.lms_t_soft
struct slap_limits_set be_def_limit; /* default limits */
ber_int_t msgid));
typedef int (BI_op_extended) LDAP_P((
- BackendDB *be,
- struct slap_conn *conn,
- struct slap_op *op,
+ BackendDB *be,
+ struct slap_conn *conn,
+ struct slap_op *op,
const char *reqoid,
- struct berval * reqdata,
+ struct berval * reqdata,
char **rspoid,
- struct berval ** rspdata,
+ struct berval ** rspdata,
LDAPControl *** rspctrls,
const char ** text,
BerVarray *refs ));
#ifdef LDAP_CLIENT_UPDATE
char o_clientupdate;
- ber_int_t o_clientupdatetype;
- ber_int_t o_clientupdateinterval;
- struct berval* o_clientupdatestate;
+ char o_clientupdate_type;
+#define SLAP_LCUP_NONE (0x0)
+#define SLAP_LCUP_SYNC (0x1)
+#define SLAP_LCUP_PERSIST (0x2)
+#define SLAP_LCUP_SYNC_AND_PERSIST (0x3)
+ ber_int_t o_clientupdate_interval;
+ struct berval* o_clientupdate_state;
#endif
#ifdef LDAP_CONNECTIONLESS
fprintf( stderr, (fmt), (connid), (opid), (arg1), (arg2), (arg3) );\
if ( ldap_syslog & (level) ) \
syslog( ldap_syslog_level, (fmt), (connid), (opid), (arg1), \
- (arg2), (arg3) ); \
+ (arg2), (arg3) ); \
} while (0)
#else
#define Statslog( level, fmt, connid, opid, arg1, arg2, arg3 )