From e0ad0fbd8d1def6e6dc6f825a8bf3a1f9e7993e0 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Sat, 20 Dec 2008 22:49:53 +0000 Subject: [PATCH] honor RFC4528 assertion control for LDAP add operations (ITS#5861) --- servers/slapd/back-bdb/add.c | 7 +++++++ servers/slapd/controls.c | 3 +-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/servers/slapd/back-bdb/add.c b/servers/slapd/back-bdb/add.c index 402c837b9c..1c73bf6366 100644 --- a/servers/slapd/back-bdb/add.c +++ b/servers/slapd/back-bdb/add.c @@ -112,6 +112,13 @@ txnReturn: goto return_results; } + if ( get_assert( op ) && + ( test_filter( op, op->ora_e, get_assertion( op )) != LDAP_COMPARE_TRUE )) + { + rs->sr_err = LDAP_ASSERTION_FAILED; + goto return_results; + } + subentry = is_entry_subentry( op->oq_add.rs_e ); /* Get our reader TXN */ diff --git a/servers/slapd/controls.c b/servers/slapd/controls.c index f952b1dd94..1a0e42b82d 100644 --- a/servers/slapd/controls.c +++ b/servers/slapd/controls.c @@ -123,8 +123,7 @@ static char *session_tracking_extops[] = { static struct slap_control control_defs[] = { { LDAP_CONTROL_ASSERT, (int)offsetof(struct slap_control_ids, sc_assert), - SLAP_CTRL_DELETE|SLAP_CTRL_MODIFY|SLAP_CTRL_RENAME| - SLAP_CTRL_COMPARE|SLAP_CTRL_SEARCH, + SLAP_CTRL_UPDATE|SLAP_CTRL_COMPARE|SLAP_CTRL_SEARCH, NULL, NULL, parseAssert, LDAP_SLIST_ENTRY_INITIALIZER(next) }, { LDAP_CONTROL_PRE_READ, -- 2.39.5