ldap/servers/slapd/back-ldbm/ldbm_add.c | 5 +++++
1 file changed, 5 insertions(+)
New commits:
commit 98b0853fe4f566cd213415ef6dbc6f9641dda050
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Tue Jun 17 17:23:07 2014 -0400
Ticket 47815 - Add operations rejected by betxn plugins remain in cache
Bug Description: When an add operation is rejected by a betxn post plugin
the "adding" entry is removed the cache(previously added
tentatively), it gets re-added back to the entry cache
when we call betxn post plugins just before the abort.
Fix Description: Remove the entry from the cache when the 2nd run of
the betxn postop plugins fails(just before we abort
the transaction).
https://fedorahosted.org/389/ticket/47815
valgrind: passed
jenkins: passed
Reviewed by: nhosoi(Thanks!)
(cherry picked from commit fe81bda5f2f2cef647cedadf9ba442f8b7851973)
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_add.c b/ldap/servers/slapd/back-ldbm/ldbm_add.c
index 2b79be3..fb487cc 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_add.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_add.c
@@ -1220,6 +1220,11 @@ diskfull_return:
opreturn = -1;
slapi_pblock_set(pb, SLAPI_PLUGIN_OPRETURN, &opreturn);
}
+ if (addingentry_in_cache && addingentry && inst) {
+ CACHE_REMOVE(&inst->inst_cache, addingentry);
+ /* tell frontend not to free this entry */
+ slapi_pblock_set(pb, SLAPI_ADD_ENTRY, NULL);
+ }
}
/* Release SERIAL LOCK */
ldap/servers/slapd/back-ldbm/ldbm_add.c | 5 +++++
1 file changed, 5 insertions(+)
New commits:
commit 887a72ef6f2cacdf256e340cb79732df0b220adb
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Tue Jun 17 17:23:07 2014 -0400
Ticket 47815 - Add operations rejected by betxn plugins remain in cache
Bug Description: When an add operation is rejected by a betxn post plugin
the "adding" entry is removed the cache(previously added
tentatively), it gets re-added back to the entry cache
when we call betxn post plugins just before the abort.
Fix Description: Remove the entry from the cache when the 2nd run of
the betxn postop plugins fails(just before we abort
the transaction).
https://fedorahosted.org/389/ticket/47815
valgrind: passed
jenkins: passed
Reviewed by: nhosoi(Thanks!)
(cherry picked from commit fe81bda5f2f2cef647cedadf9ba442f8b7851973)
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_add.c b/ldap/servers/slapd/back-ldbm/ldbm_add.c
index c99db8d..0dcb158 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_add.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_add.c
@@ -1220,6 +1220,11 @@ diskfull_return:
opreturn = -1;
slapi_pblock_set(pb, SLAPI_PLUGIN_OPRETURN, &opreturn);
}
+ if (addingentry_in_cache && addingentry && inst) {
+ CACHE_REMOVE(&inst->inst_cache, addingentry);
+ /* tell frontend not to free this entry */
+ slapi_pblock_set(pb, SLAPI_ADD_ENTRY, NULL);
+ }
}
/* Release SERIAL LOCK */
ldap/servers/slapd/back-ldbm/ldbm_add.c | 5 +++++
1 file changed, 5 insertions(+)
New commits:
commit fe81bda5f2f2cef647cedadf9ba442f8b7851973
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Tue Jun 17 17:23:07 2014 -0400
Ticket 47815 - Add operations rejected by betxn plugins remain in cache
Bug Description: When an add operation is rejected by a betxn post plugin
the "adding" entry is removed the cache(previously added
tentatively), it gets re-added back to the entry cache
when we call betxn post plugins just before the abort.
Fix Description: Remove the entry from the cache when the 2nd run of
the betxn postop plugins fails(just before we abort
the transaction).
https://fedorahosted.org/389/ticket/47815
valgrind: passed
jenkins: passed
Reviewed by: nhosoi(Thanks!)
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_add.c b/ldap/servers/slapd/back-ldbm/ldbm_add.c
index 5be1cd8..181c173 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_add.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_add.c
@@ -1222,6 +1222,11 @@ diskfull_return:
opreturn = -1;
slapi_pblock_set(pb, SLAPI_PLUGIN_OPRETURN, &opreturn);
}
+ if (addingentry_in_cache && addingentry && inst) {
+ CACHE_REMOVE(&inst->inst_cache, addingentry);
+ /* tell frontend not to free this entry */
+ slapi_pblock_set(pb, SLAPI_ADD_ENTRY, NULL);
+ }
}
/* Release SERIAL LOCK */
ldap/servers/slapd/back-ldbm/seq.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
New commits:
commit 958b4edfd966e3871d2f10f721e314f9362ce4e3
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Fri Jun 13 13:48:50 2014 -0400
Ticket 47602 - txn commit being performed too early
Bug Description: The transaction is committed too early, and this leads to
a deadlock when accessing the retro changelog.
Fix Description: Move the commit after we are done using the txn(id2entry, etc).
https://fedorahosted.org/389/ticket/47602
Reviewed by: nhosoi(Thanks!)
diff --git a/ldap/servers/slapd/back-ldbm/seq.c b/ldap/servers/slapd/back-ldbm/seq.c
index 29b3f6a..1874239 100644
--- a/ldap/servers/slapd/back-ldbm/seq.c
+++ b/ldap/servers/slapd/back-ldbm/seq.c
@@ -236,9 +236,6 @@ retry:
dbc->c_close(dbc);
if ((0 == return_value) || (DB_NOTFOUND == return_value)) {
- if (txn.back_txn_txn) {
- dblayer_read_txn_commit(be, &txn);
- }
/* Now check that the key we eventually settled on was an equality key ! */
if (key.data && *((char*)key.data) == EQ_PREFIX) {
/* Retrieve the idlist for this key */
@@ -255,6 +252,7 @@ retry:
if ((key.data != little_buffer) && (key.data != &keystring)) {
slapi_ch_free(&(key.data));
}
+ dblayer_read_txn_abort(be, &txn);
goto retry;
} else {
continue;
@@ -321,6 +319,14 @@ retry:
}
idl_free( &idl );
}
+ /* if success finally commit the transaction, otherwise abort if DB_NOTFOUND */
+ if(txn.back_txn_txn){
+ if (return_value == 0) {
+ dblayer_read_txn_commit(be, &txn);
+ } else if (DB_NOTFOUND == return_value){
+ dblayer_read_txn_abort(be, &txn);
+ }
+ }
dblayer_release_index_file( be, ai, db );
ldap/servers/plugins/acl/acl.c | 28 ++++++++++++++++++++++++++--
ldap/servers/plugins/acl/acl.h | 3 ++-
ldap/servers/plugins/acl/aclparse.c | 19 +++++++++++++++++++
3 files changed, 47 insertions(+), 3 deletions(-)
New commits:
commit d8f6af4242a8f546a2d60a10b48fd8e24a9e72d9
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Apr 30 10:22:59 2013 -0700
Ticket 47331 - Self entry access ACI not working properly
Description: Additional change to
commit 79346deb255ca8d7889d7590534d308d4e3a78da
which added a macro ACLPB_CACHE_RESULT_PER_ENTRY_SKIP, but
ACLPB_STATE_ALL was not updated to cover the bit.
This patch updates ACLPB_STATE_ALL to support the new bit.
(cherry picked from commit 86fea4b326b28912cd0d8de0d0cb3a2f8dea423e)
(cherry picked from commit 6d43552d862234334f94a5768132d71847bfcd20)
diff --git a/ldap/servers/plugins/acl/acl.h b/ldap/servers/plugins/acl/acl.h
index dbe5c11..8a9bec2 100644
--- a/ldap/servers/plugins/acl/acl.h
+++ b/ldap/servers/plugins/acl/acl.h
@@ -475,7 +475,7 @@ struct acl_pblock {
ACLPB_ACCESS_ALLOWED_ON_ENTRY | ACLPB_ATTR_STAR_MATCHED | \
ACLPB_FOUND_ATTR_RULE | ACLPB_EVALUATING_FIRST_ATTR | \
ACLPB_FOUND_A_ENTRY_TEST_RULE )
-#define ACLPB_STATE_ALL 0x3fffff
+#define ACLPB_STATE_ALL 0xffffff
int aclpb_res_type;
commit 46b06bb3f12be8df973579971c5cdf4312456974
Author: Thierry bordaz (tbordaz) <tbordaz(a)redhat.com>
Date: Mon Apr 22 14:15:33 2013 +0200
Ticket 47331 - Self entry access ACI not working properly
Bug Description:
There are two issues in that bug.
The first one is that for a given entry, the rights related to an attribute are evaluated and cached. Reusing this evaluation for a different entry is erronous.
The second one is that for each deny/allow aci, the results of the evaluation of the aci is cached. These results
are reset for aci type that are entry related. The parsing of the rule self entry access miss the setting
of ACI_USERDN_SELFRULE.
This flag allows to reset (in result cache) a result obtained on a previous entry. The consequence is that
a previous result was erronously reused.
Fix Description:
The fix for the first issue, is to prevent acl__match_handlesFromCache to reuse already evaluated attributes.
A new flag make acl__match_handlesFromCache to return if the evaluation is entry related.
The second fix is to set ACI_USERDN_SELFRULE, when we have a rule like 'userdn = ldap:///self'
https://fedorahosted.org/389/ticket/47331
Reviewed by: Noriko Hosoi, Ludwig Krispenz
Platforms tested: fedora 17
Flag Day: no
Doc impact: no
(cherry picked from commit 79346deb255ca8d7889d7590534d308d4e3a78da)
(cherry picked from commit 1580bcd71cbb60f0e97a36bf83faca6e079cd861)
diff --git a/ldap/servers/plugins/acl/acl.c b/ldap/servers/plugins/acl/acl.c
index 09f28ee..d27c0e1 100644
--- a/ldap/servers/plugins/acl/acl.c
+++ b/ldap/servers/plugins/acl/acl.c
@@ -2799,6 +2799,11 @@ acl__TestRights(Acl_PBlock *aclpb,int access, char **right, char ** map_generic,
if (access & ( SLAPI_ACL_SEARCH | SLAPI_ACL_READ)) {
+ /* We can not reused results obtained on a other entry */
+ if (aci->aci_type & ACI_CACHE_RESULT_PER_ENTRY) {
+ aclpb->aclpb_state |= ACLPB_CACHE_RESULT_PER_ENTRY_SKIP;
+ }
+
/*
* aclpb->aclpb_cache_result[0..aclpb->aclpb_last_cache_result] is
* a cache of info about whether applicable acis
@@ -3010,6 +3015,10 @@ acl__TestRights(Acl_PBlock *aclpb,int access, char **right, char ** map_generic,
if (access & ( SLAPI_ACL_SEARCH | SLAPI_ACL_READ)) {
+ /* We can not reused results obtained on a other entry */
+ if (aci->aci_type & ACI_CACHE_RESULT_PER_ENTRY) {
+ aclpb->aclpb_state |= ACLPB_CACHE_RESULT_PER_ENTRY_SKIP;
+ }
/*
* aclpb->aclpb_cache_result[0..aclpb->aclpb_last_cache_result] is
* a cache of info about whether applicable acis
@@ -3794,8 +3803,23 @@ acl__match_handlesFromCache ( Acl_PBlock *aclpb, char *attr, int access)
} else {
context_type = ACLPB_EVALCONTEXT_PREV;
c_evalContext = &aclpb->aclpb_prev_entryEval_context;
- }
-
+ }
+
+ /* we can not reused access evaluation done on a previous entry
+ * so just skip that cache
+ */
+ if (aclpb->aclpb_state & ACLPB_CACHE_RESULT_PER_ENTRY_SKIP) {
+ aclpb->aclpb_state &= ~ACLPB_MATCHES_ALL_ACLS;
+ aclpb->aclpb_state |= ACLPB_UPD_ACLCB_CACHE;
+ /* Did not match */
+ if (context_type == ACLPB_EVALCONTEXT_ACLCB) {
+ aclpb->aclpb_state &= ~ACLPB_HAS_ACLCB_EVALCONTEXT;
+ } else {
+ aclpb->aclpb_state |= ACLPB_COPY_EVALCONTEXT;
+ c_evalContext->acle_numof_tmatched_handles = 0;
+ }
+ return -1;
+ }
if ( aclpb->aclpb_res_type & (ACLPB_NEW_ENTRY | ACLPB_EFFECTIVE_RIGHTS) ) {
aclpb->aclpb_state |= ACLPB_MATCHES_ALL_ACLS;
diff --git a/ldap/servers/plugins/acl/acl.h b/ldap/servers/plugins/acl/acl.h
index c61ee70..dbe5c11 100644
--- a/ldap/servers/plugins/acl/acl.h
+++ b/ldap/servers/plugins/acl/acl.h
@@ -468,6 +468,7 @@ struct acl_pblock {
#define ACLPB_UPD_ACLCB_CACHE 0x100000
#define ACLPB_ATTR_RULE_EVALUATED 0x200000
#define ACLPB_DONOT_EVALUATE_PROXY 0x400000
+#define ACLPB_CACHE_RESULT_PER_ENTRY_SKIP 0x800000
#define ACLPB_RESET_MASK ( ACLPB_ACCESS_ALLOWED_ON_A_ATTR | ACLPB_ACCESS_DENIED_ON_ALL_ATTRS | \
diff --git a/ldap/servers/plugins/acl/aclparse.c b/ldap/servers/plugins/acl/aclparse.c
index 8b11471..26d57c4 100644
--- a/ldap/servers/plugins/acl/aclparse.c
+++ b/ldap/servers/plugins/acl/aclparse.c
@@ -784,6 +784,8 @@ normalize_nextACERule:
goto error;
}
} else if ( 0 == strncmp ( s, DS_LAS_USERDN, 6 )) {
+ char *prefix;
+
p = PL_strnchr (s, '=', end - s);
if (NULL == p) {
goto error;
@@ -808,6 +810,23 @@ normalize_nextACERule:
goto error;
}
+ /* skip the ldap prefix */
+ prefix = PL_strncasestr(p, LDAP_URL_prefix, end - p);
+ if (prefix) {
+ prefix += strlen(LDAP_URL_prefix);
+ } else {
+ prefix = PL_strncasestr(p, LDAPS_URL_prefix, end - p);
+ if (prefix) {
+ prefix += strlen(LDAPS_URL_prefix);
+ }
+ }
+ if (prefix == NULL) {
+ /* userdn value does not starts with LDAP(S)_URL_prefix */
+ goto error;
+ }
+ p = prefix;
+
+
/* we have a rule like userdn = "ldap:///blah". s points to blah now.
** let's find if we have a SELF rule like userdn = "ldap:///self".
** Since the resource changes on entry basis, we can't cache the
ldap/servers/plugins/acl/acl.c | 28 ++++++++++++++++++++++++++--
ldap/servers/plugins/acl/acl.h | 3 ++-
ldap/servers/plugins/acl/aclparse.c | 19 +++++++++++++++++++
3 files changed, 47 insertions(+), 3 deletions(-)
New commits:
commit 6d43552d862234334f94a5768132d71847bfcd20
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Apr 30 10:22:59 2013 -0700
Ticket 47331 - Self entry access ACI not working properly
Description: Additional change to
commit 79346deb255ca8d7889d7590534d308d4e3a78da
which added a macro ACLPB_CACHE_RESULT_PER_ENTRY_SKIP, but
ACLPB_STATE_ALL was not updated to cover the bit.
This patch updates ACLPB_STATE_ALL to support the new bit.
(cherry picked from commit 86fea4b326b28912cd0d8de0d0cb3a2f8dea423e)
diff --git a/ldap/servers/plugins/acl/acl.h b/ldap/servers/plugins/acl/acl.h
index abb0230..1d3698a 100644
--- a/ldap/servers/plugins/acl/acl.h
+++ b/ldap/servers/plugins/acl/acl.h
@@ -476,7 +476,7 @@ struct acl_pblock {
ACLPB_ACCESS_ALLOWED_ON_ENTRY | ACLPB_ATTR_STAR_MATCHED | \
ACLPB_FOUND_ATTR_RULE | ACLPB_EVALUATING_FIRST_ATTR | \
ACLPB_FOUND_A_ENTRY_TEST_RULE )
-#define ACLPB_STATE_ALL 0x3fffff
+#define ACLPB_STATE_ALL 0xffffff
int aclpb_res_type;
commit 1580bcd71cbb60f0e97a36bf83faca6e079cd861
Author: Thierry bordaz (tbordaz) <tbordaz(a)redhat.com>
Date: Mon Apr 22 14:15:33 2013 +0200
Ticket 47331 - Self entry access ACI not working properly
Bug Description:
There are two issues in that bug.
The first one is that for a given entry, the rights related to an attribute are evaluated and cached. Reusing this evaluation for a different entry is erronous.
The second one is that for each deny/allow aci, the results of the evaluation of the aci is cached. These results
are reset for aci type that are entry related. The parsing of the rule self entry access miss the setting
of ACI_USERDN_SELFRULE.
This flag allows to reset (in result cache) a result obtained on a previous entry. The consequence is that
a previous result was erronously reused.
Fix Description:
The fix for the first issue, is to prevent acl__match_handlesFromCache to reuse already evaluated attributes.
A new flag make acl__match_handlesFromCache to return if the evaluation is entry related.
The second fix is to set ACI_USERDN_SELFRULE, when we have a rule like 'userdn = ldap:///self'
https://fedorahosted.org/389/ticket/47331
Reviewed by: Noriko Hosoi, Ludwig Krispenz
Platforms tested: fedora 17
Flag Day: no
Doc impact: no
(cherry picked from commit 79346deb255ca8d7889d7590534d308d4e3a78da)
diff --git a/ldap/servers/plugins/acl/acl.c b/ldap/servers/plugins/acl/acl.c
index 600eb12..2337e0d 100644
--- a/ldap/servers/plugins/acl/acl.c
+++ b/ldap/servers/plugins/acl/acl.c
@@ -2807,6 +2807,11 @@ acl__TestRights(Acl_PBlock *aclpb,int access, const char **right, const char **
if (access & ( SLAPI_ACL_SEARCH | SLAPI_ACL_READ)) {
+ /* We can not reused results obtained on a other entry */
+ if (aci->aci_type & ACI_CACHE_RESULT_PER_ENTRY) {
+ aclpb->aclpb_state |= ACLPB_CACHE_RESULT_PER_ENTRY_SKIP;
+ }
+
/*
* aclpb->aclpb_cache_result[0..aclpb->aclpb_last_cache_result] is
* a cache of info about whether applicable acis
@@ -3030,6 +3035,10 @@ acl__TestRights(Acl_PBlock *aclpb,int access, const char **right, const char **
if (access & ( SLAPI_ACL_SEARCH | SLAPI_ACL_READ)) {
+ /* We can not reused results obtained on a other entry */
+ if (aci->aci_type & ACI_CACHE_RESULT_PER_ENTRY) {
+ aclpb->aclpb_state |= ACLPB_CACHE_RESULT_PER_ENTRY_SKIP;
+ }
/*
* aclpb->aclpb_cache_result[0..aclpb->aclpb_last_cache_result] is
* a cache of info about whether applicable acis
@@ -3830,8 +3839,23 @@ acl__match_handlesFromCache ( Acl_PBlock *aclpb, char *attr, int access)
} else {
context_type = ACLPB_EVALCONTEXT_PREV;
c_evalContext = &aclpb->aclpb_prev_entryEval_context;
- }
-
+ }
+
+ /* we can not reused access evaluation done on a previous entry
+ * so just skip that cache
+ */
+ if (aclpb->aclpb_state & ACLPB_CACHE_RESULT_PER_ENTRY_SKIP) {
+ aclpb->aclpb_state &= ~ACLPB_MATCHES_ALL_ACLS;
+ aclpb->aclpb_state |= ACLPB_UPD_ACLCB_CACHE;
+ /* Did not match */
+ if (context_type == ACLPB_EVALCONTEXT_ACLCB) {
+ aclpb->aclpb_state &= ~ACLPB_HAS_ACLCB_EVALCONTEXT;
+ } else {
+ aclpb->aclpb_state |= ACLPB_COPY_EVALCONTEXT;
+ c_evalContext->acle_numof_tmatched_handles = 0;
+ }
+ return -1;
+ }
if ( aclpb->aclpb_res_type & (ACLPB_NEW_ENTRY | ACLPB_EFFECTIVE_RIGHTS) ) {
aclpb->aclpb_state |= ACLPB_MATCHES_ALL_ACLS;
diff --git a/ldap/servers/plugins/acl/acl.h b/ldap/servers/plugins/acl/acl.h
index bf58f5c..abb0230 100644
--- a/ldap/servers/plugins/acl/acl.h
+++ b/ldap/servers/plugins/acl/acl.h
@@ -469,6 +469,7 @@ struct acl_pblock {
#define ACLPB_UPD_ACLCB_CACHE 0x100000
#define ACLPB_ATTR_RULE_EVALUATED 0x200000
#define ACLPB_DONOT_EVALUATE_PROXY 0x400000
+#define ACLPB_CACHE_RESULT_PER_ENTRY_SKIP 0x800000
#define ACLPB_RESET_MASK ( ACLPB_ACCESS_ALLOWED_ON_A_ATTR | ACLPB_ACCESS_DENIED_ON_ALL_ATTRS | \
diff --git a/ldap/servers/plugins/acl/aclparse.c b/ldap/servers/plugins/acl/aclparse.c
index 29203da..c9db473 100644
--- a/ldap/servers/plugins/acl/aclparse.c
+++ b/ldap/servers/plugins/acl/aclparse.c
@@ -826,6 +826,8 @@ normalize_nextACERule:
goto error;
}
} else if ( 0 == strncmp ( s, DS_LAS_USERDN, 6 )) {
+ char *prefix;
+
p = PL_strnchr (s, '=', end - s);
if (NULL == p) {
goto error;
@@ -850,6 +852,23 @@ normalize_nextACERule:
goto error;
}
+ /* skip the ldap prefix */
+ prefix = PL_strncasestr(p, LDAP_URL_prefix, end - p);
+ if (prefix) {
+ prefix += strlen(LDAP_URL_prefix);
+ } else {
+ prefix = PL_strncasestr(p, LDAPS_URL_prefix, end - p);
+ if (prefix) {
+ prefix += strlen(LDAPS_URL_prefix);
+ }
+ }
+ if (prefix == NULL) {
+ /* userdn value does not starts with LDAP(S)_URL_prefix */
+ goto error;
+ }
+ p = prefix;
+
+
/* we have a rule like userdn = "ldap:///blah". s points to blah now.
** let's find if we have a SELF rule like userdn = "ldap:///self".
** Since the resource changes on entry basis, we can't cache the