2 commits - ldap/servers
by Noriko Hosoi
ldap/servers/plugins/acl/aclparse.c | 19 +++++++++++++------
ldap/servers/plugins/acl/aclutil.c | 2 +-
ldap/servers/slapd/back-ldbm/ldbm_add.c | 2 +-
ldap/servers/slapd/back-ldbm/ldbm_modify.c | 2 +-
ldap/servers/slapd/back-ldbm/ldbm_modrdn.c | 4 ++--
5 files changed, 18 insertions(+), 11 deletions(-)
New commits:
commit 07c1bc25508a9c1e71dd8e717fd4ce455ddfeff0
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Oct 10 11:50:13 2014 -0700
Ticket #47922 - dynamically added macro aci is not evaluated on the fly
Bug Description: When macro aci is dynamically added and if the aci's
macro target dn is not normalized, the following operation that requires
the aci could fail with Insufficient access since matching the target dn
and the macro target dn fails since the code expects normalized macro
target dn.
Fix Description: Before setting the macro target dn, process the dn by
slapi_create_dn_string_case.
https://fedorahosted.org/389/ticket/47922
Reviewed by lkrispen(a)redhat.com and rmeggins(a)redhat.com (Thank you, Ludwig and Rich!!)
diff --git a/ldap/servers/plugins/acl/aclparse.c b/ldap/servers/plugins/acl/aclparse.c
index ea64fa7..be86c8b 100644
--- a/ldap/servers/plugins/acl/aclparse.c
+++ b/ldap/servers/plugins/acl/aclparse.c
@@ -1849,9 +1849,9 @@ static int
acl_check_for_target_macro( aci_t *aci_item, char *value)
{
- char *str = NULL;
+ char *str = NULL;
- str = strstr(value, ACL_TARGET_MACRO_DN_KEY /* ($dn) */);
+ str = PL_strcasestr(value, ACL_TARGET_MACRO_DN_KEY /* ($dn) */);
if (str != NULL) {
char *p0 = NULL, *p1 = NULL;
@@ -1871,10 +1871,17 @@ acl_check_for_target_macro( aci_t *aci_item, char *value)
aci_item->aci_type &= ~ACI_TARGET_DN;
aci_item->aci_type |= ACI_TARGET_MACRO_DN;
aci_item->aci_macro = (aciMacro *)slapi_ch_malloc(sizeof(aciMacro));
- aci_item->aci_macro->match_this = slapi_ch_strdup(value);
- aci_item->aci_macro->macro_ptr = strstr( aci_item->aci_macro->match_this,
- ACL_TARGET_MACRO_DN_KEY);
- return(1);
+ /* Macro dn needs to normalize. E.g., "ou=Groups, ($dN), dn=example,dn=com" */
+ aci_item->aci_macro->match_this = slapi_create_dn_string_case("%s", value);
+ if (NULL == aci_item->aci_macro->match_this) {
+ slapi_log_error(SLAPI_LOG_FATAL, plugin_name,
+ "acl_check_for_target_macro: Error: Invalid macro target dn: \"%s\"\n", value);
+ aci_item->aci_type &= ~ACI_TARGET_MACRO_DN;
+ slapi_ch_free((void **)&aci_item->aci_macro);
+ return -1;
+ }
+ aci_item->aci_macro->macro_ptr = PL_strcasestr(aci_item->aci_macro->match_this, ACL_TARGET_MACRO_DN_KEY);
+ return(1);
}
return(0);
diff --git a/ldap/servers/plugins/acl/aclutil.c b/ldap/servers/plugins/acl/aclutil.c
index e865a95..0720dae 100644
--- a/ldap/servers/plugins/acl/aclutil.c
+++ b/ldap/servers/plugins/acl/aclutil.c
@@ -785,7 +785,7 @@ acl_match_macro_in_target( const char *ndn, char * match_this,
macro_prefix = slapi_ch_strdup(match_this);
/* we know it's got a $(dn) */
- tmp_ptr = strstr(macro_prefix, ACL_TARGET_MACRO_DN_KEY);
+ tmp_ptr = PL_strcasestr(macro_prefix, ACL_TARGET_MACRO_DN_KEY);
if (!tmp_ptr) {
LDAPDebug(LDAP_DEBUG_ACL,"acl_match_macro_in_target: "
"Target macro DN key \"%s\" not found in \"%s\".\n",
commit 2aabb017bd4eec6d30bf00486eb027f59129cf74
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Oct 8 10:38:02 2014 -0700
Ticket #47897 - Need to move slapi_pblock_set(pb, SLAPI_MODRDN_EXISTING_ENTRY, original_entry->ep_entry) prior to original_entry overwritten
Bug Description: In the DEADLOCK retry code in ldbm_back_modrdn,
SLAPI_MODRDN_EXISTING_ENTRY in pblock is reset with the new entry
to be renamed. The location of the setting entry was inappropriate,
thus instead of the entry, but its backup is set in pblock.
Fix Description: Moving the slapi_pblock_set(SLAPI_MODRDN_EXISTING_
ENTRY) to the correct position.
Plus, in the DEADLOCK retry code, original_entry is duplicated and
used for the next loop. The source of the duplication has to be
the clean entry before updated in the backend code, but in ldbm_add,
ldbm_modify, and ldbm_modrdn, the current entry was duplicated and
set to the original entry, which could have been updated in the
previous loop. This patch fixes it, as well.
https://fedorahosted.org/389/ticket/47897
Reviewed by tbordaz(a)redhat.com (Thank you, Theirry!!)
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_add.c b/ldap/servers/slapd/back-ldbm/ldbm_add.c
index b74154a..75cb0dc 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_add.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_add.c
@@ -225,7 +225,7 @@ ldbm_back_add( Slapi_PBlock *pb )
slapi_pblock_set(pb, SLAPI_TXN, parent_txn);
/* must duplicate addingentry before returning it to cache,
* which could free the entry. */
- if ( (tmpentry = backentry_dup( addingentry )) == NULL ) {
+ if ((tmpentry = backentry_dup(originalentry?originalentry:addingentry)) == NULL) {
ldap_result_code= LDAP_OPERATIONS_ERROR;
goto error_return;
}
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_modify.c b/ldap/servers/slapd/back-ldbm/ldbm_modify.c
index d15b050..b9f754d 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_modify.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_modify.c
@@ -521,7 +521,7 @@ ldbm_back_modify( Slapi_PBlock *pb )
if (ec) {
/* must duplicate ec before returning it to cache,
* which could free the entry. */
- if ( (tmpentry = backentry_dup( ec )) == NULL ) {
+ if ((tmpentry = backentry_dup(original_entry?original_entry:ec)) == NULL) {
ldap_result_code= LDAP_OPERATIONS_ERROR;
goto error_return;
}
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
index 7bcbcee..6a4982c 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
@@ -275,7 +275,7 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
orig_dn_newsuperiordn = slapi_sdn_dup(orig_dn_newsuperiordn);
/* must duplicate ec before returning it to cache,
* which could free the entry. */
- if ( (tmpentry = backentry_dup( ec )) == NULL ) {
+ if ((tmpentry = backentry_dup(original_entry?original_entry:ec)) == NULL) {
ldap_result_code= LDAP_OPERATIONS_ERROR;
goto error_return;
}
@@ -295,10 +295,10 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
slapi_entry_free(ent);
slapi_pblock_set( pb, SLAPI_MODRDN_EXISTING_ENTRY, NULL );
}
+ slapi_pblock_set( pb, SLAPI_MODRDN_EXISTING_ENTRY, original_entry->ep_entry );
ec = original_entry;
original_entry = tmpentry;
tmpentry = NULL;
- slapi_pblock_set( pb, SLAPI_MODRDN_EXISTING_ENTRY, original_entry->ep_entry );
free_modrdn_existing_entry = 0; /* owned by original_entry now */
if (!cache_is_in_cache(&inst->inst_cache, ec)) {
/* Put the resetted entry 'ec' into the cache again. */
9 years, 6 months
Branch '389-ds-base-1.3.2' - dirsrvtests/tickets ldap/servers
by thierry bordaz
dirsrvtests/tickets/ticket47920_test.py | 251 ++++++++++++++++++++++++++++++++
ldap/servers/slapd/result.c | 2
2 files changed, 252 insertions(+), 1 deletion(-)
New commits:
commit 78feffcd9666f2f01bb0b79044e9cd25d72b99a6
Author: Thierry bordaz (tbordaz) <tbordaz(a)redhat.com>
Date: Thu Oct 9 14:31:11 2014 +0200
Ticket 47920: Encoding of SearchResultEntry is missing tag
Bug Description:
The encoding of the PreReadControl,PostReadControl does not
contain the tag (LDAP_RES_SEARCH_ENTRY = constructed+application).
The server should return SearchResultEntry (http://tools.ietf.org/html/rfc4527 3.1 & 3.2)
That is
SearchResultEntry ::= [APPLICATION 4] SEQUENCE {
objectName LDAPDN,
attributes PartialAttributeList }
Fix Description:
Add the tag to the ber encoding
https://fedorahosted.org/389/ticket/47920
Reviewed by: Noriko (thanks !)
Platforms tested: F17
Flag Day: no
Doc impact: no
diff --git a/dirsrvtests/tickets/ticket47920_test.py b/dirsrvtests/tickets/ticket47920_test.py
new file mode 100644
index 0000000..1e04626
--- /dev/null
+++ b/dirsrvtests/tickets/ticket47920_test.py
@@ -0,0 +1,251 @@
+import os
+import sys
+import time
+import ldap
+import logging
+import socket
+import time
+import logging
+import pytest
+import re
+from lib389 import DirSrv, Entry, tools
+from lib389.tools import DirSrvTools
+from lib389._constants import *
+from lib389.properties import *
+from constants import *
+from ldap.controls.readentry import PreReadControl,PostReadControl
+
+
+SCOPE_IN_CN = 'in'
+SCOPE_OUT_CN = 'out'
+SCOPE_IN_DN = 'cn=%s,%s' % (SCOPE_IN_CN, SUFFIX)
+SCOPE_OUT_DN = 'cn=%s,%s' % (SCOPE_OUT_CN, SUFFIX)
+
+PROVISIONING_CN = "provisioning"
+PROVISIONING_DN = "cn=%s,%s" % (PROVISIONING_CN, SCOPE_IN_DN)
+
+
+
+
+ACTIVE_CN = "accounts"
+STAGE_CN = "staged users"
+DELETE_CN = "deleted users"
+ACTIVE_DN = "cn=%s,%s" % (ACTIVE_CN, SCOPE_IN_DN)
+STAGE_DN = "cn=%s,%s" % (STAGE_CN, PROVISIONING_DN)
+DELETE_DN = "cn=%s,%s" % (DELETE_CN, PROVISIONING_DN)
+
+STAGE_USER_CN = "stage guy"
+STAGE_USER_DN = "cn=%s,%s" % (STAGE_USER_CN, STAGE_DN)
+
+ACTIVE_USER_CN = "active guy"
+ACTIVE_USER_DN = "cn=%s,%s" % (ACTIVE_USER_CN, ACTIVE_DN)
+
+OUT_USER_CN = "out guy"
+OUT_USER_DN = "cn=%s,%s" % (OUT_USER_CN, SCOPE_OUT_DN)
+
+STAGE_GROUP_CN = "stage group"
+STAGE_GROUP_DN = "cn=%s,%s" % (STAGE_GROUP_CN, STAGE_DN)
+
+ACTIVE_GROUP_CN = "active group"
+ACTIVE_GROUP_DN = "cn=%s,%s" % (ACTIVE_GROUP_CN, ACTIVE_DN)
+
+OUT_GROUP_CN = "out group"
+OUT_GROUP_DN = "cn=%s,%s" % (OUT_GROUP_CN, SCOPE_OUT_DN)
+
+INDIRECT_ACTIVE_GROUP_CN = "indirect active group"
+INDIRECT_ACTIVE_GROUP_DN = "cn=%s,%s" % (INDIRECT_ACTIVE_GROUP_CN, ACTIVE_DN)
+
+INITIAL_DESC="inital description"
+FINAL_DESC ="final description"
+
+
+
+log = logging.getLogger(__name__)
+
+installation_prefix = None
+
+
+class TopologyStandalone(object):
+ def __init__(self, standalone):
+ standalone.open()
+ self.standalone = standalone
+
+
+
+(a)pytest.fixture(scope="module")
+def topology(request):
+ '''
+ This fixture is used to standalone topology for the 'module'.
+ At the beginning, It may exists a standalone instance.
+ It may also exists a backup for the standalone instance.
+
+ Principle:
+ If standalone instance exists:
+ restart it
+ If backup of standalone exists:
+ create/rebind to standalone
+
+ restore standalone instance from backup
+ else:
+ Cleanup everything
+ remove instance
+ remove backup
+ Create instance
+ Create backup
+ '''
+ global installation_prefix
+
+ if installation_prefix:
+ args_instance[SER_DEPLOYED_DIR] = installation_prefix
+
+ standalone = DirSrv(verbose=False)
+
+ # Args for the standalone instance
+ args_instance[SER_HOST] = HOST_STANDALONE
+ args_instance[SER_PORT] = PORT_STANDALONE
+ args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
+ args_standalone = args_instance.copy()
+ standalone.allocate(args_standalone)
+
+ # Get the status of the backups
+ backup_standalone = standalone.checkBackupFS()
+
+ # Get the status of the instance and restart it if it exists
+ instance_standalone = standalone.exists()
+ if instance_standalone:
+ # assuming the instance is already stopped, just wait 5 sec max
+ standalone.stop(timeout=5)
+ standalone.start(timeout=10)
+
+ if backup_standalone:
+ # The backup exist, assuming it is correct
+ # we just re-init the instance with it
+ if not instance_standalone:
+ standalone.create()
+ # Used to retrieve configuration information (dbdir, confdir...)
+ standalone.open()
+
+ # restore standalone instance from backup
+ standalone.stop(timeout=10)
+ standalone.restoreFS(backup_standalone)
+ standalone.start(timeout=10)
+
+ else:
+ # We should be here only in two conditions
+ # - This is the first time a test involve standalone instance
+ # - Something weird happened (instance/backup destroyed)
+ # so we discard everything and recreate all
+
+ # Remove the backup. So even if we have a specific backup file
+ # (e.g backup_standalone) we clear backup that an instance may have created
+ if backup_standalone:
+ standalone.clearBackupFS()
+
+ # Remove the instance
+ if instance_standalone:
+ standalone.delete()
+
+ # Create the instance
+ standalone.create()
+
+ # Used to retrieve configuration information (dbdir, confdir...)
+ standalone.open()
+
+ # Time to create the backups
+ standalone.stop(timeout=10)
+ standalone.backupfile = standalone.backupFS()
+ standalone.start(timeout=10)
+
+ # clear the tmp directory
+ standalone.clearTmpDir(__file__)
+
+ #
+ # Here we have standalone instance up and running
+ # Either coming from a backup recovery
+ # or from a fresh (re)init
+ # Time to return the topology
+ return TopologyStandalone(standalone)
+
+def _header(topology, label):
+ topology.standalone.log.info("\n\n###############################################")
+ topology.standalone.log.info("#######")
+ topology.standalone.log.info("####### %s" % label)
+ topology.standalone.log.info("#######")
+ topology.standalone.log.info("###############################################")
+
+def _add_user(topology, type='active'):
+ if type == 'active':
+ topology.standalone.add_s(Entry((ACTIVE_USER_DN, {
+ 'objectclass': "top person inetuser".split(),
+ 'sn': ACTIVE_USER_CN,
+ 'cn': ACTIVE_USER_CN,
+ 'description': INITIAL_DESC})))
+ elif type == 'stage':
+ topology.standalone.add_s(Entry((STAGE_USER_DN, {
+ 'objectclass': "top person inetuser".split(),
+ 'sn': STAGE_USER_CN,
+ 'cn': STAGE_USER_CN})))
+ else:
+ topology.standalone.add_s(Entry((OUT_USER_DN, {
+ 'objectclass': "top person inetuser".split(),
+ 'sn': OUT_USER_CN,
+ 'cn': OUT_USER_CN})))
+
+def test_ticket47920_init(topology):
+ topology.standalone.add_s(Entry((SCOPE_IN_DN, {
+ 'objectclass': "top nscontainer".split(),
+ 'cn': SCOPE_IN_DN})))
+ topology.standalone.add_s(Entry((ACTIVE_DN, {
+ 'objectclass': "top nscontainer".split(),
+ 'cn': ACTIVE_CN})))
+
+ # add users
+ _add_user(topology, 'active')
+
+
+def test_ticket47920_mod_readentry_ctrl(topology):
+ _header(topology, 'MOD: with a readentry control')
+
+ topology.standalone.log.info("Check the initial value of the entry")
+ ent = topology.standalone.getEntry(ACTIVE_USER_DN, ldap.SCOPE_BASE, "(objectclass=*)", ['description'])
+ assert ent.hasAttr('description')
+ assert ent.getValue('description') == INITIAL_DESC
+
+ pr = PostReadControl(criticality=True,attrList=['cn', 'description'])
+ _,_,_,resp_ctrls = topology.standalone.modify_ext_s(ACTIVE_USER_DN, [(ldap.MOD_REPLACE, 'description', [FINAL_DESC])], serverctrls= [pr])
+
+ assert resp_ctrls[0].dn == ACTIVE_USER_DN
+ assert resp_ctrls[0].entry.has_key('description')
+ assert resp_ctrls[0].entry.has_key('cn')
+ print resp_ctrls[0].entry['description']
+
+ ent = topology.standalone.getEntry(ACTIVE_USER_DN, ldap.SCOPE_BASE, "(objectclass=*)", ['description'])
+ assert ent.hasAttr('description')
+ assert ent.getValue('description') == FINAL_DESC
+
+def test_ticket47920_final(topology):
+ topology.standalone.stop(timeout=10)
+
+
+
+def run_isolated():
+ '''
+ run_isolated is used to run these test cases independently of a test scheduler (xunit, py.test..)
+ To run isolated without py.test, you need to
+ - edit this file and comment '@pytest.fixture' line before 'topology' function.
+ - set the installation prefix
+ - run this program
+ '''
+ global installation_prefix
+ installation_prefix = None
+
+ topo = topology(True)
+ test_ticket47920_init(topo)
+
+ test_ticket47920_mod_readentry_ctrl(topo)
+
+ test_ticket47920_final(topo)
+
+if __name__ == '__main__':
+ run_isolated()
+
diff --git a/ldap/servers/slapd/result.c b/ldap/servers/slapd/result.c
index ef4179d..05a3b67 100644
--- a/ldap/servers/slapd/result.c
+++ b/ldap/servers/slapd/result.c
@@ -2160,7 +2160,7 @@ encode_read_entry (Slapi_PBlock *pb, Slapi_Entry *e, char **attrs, int alluserat
}
/* Start the ber encoding with the DN */
- rc = ber_printf( ber, "{s{", slapi_entry_get_dn_const(e) );
+ rc = ber_printf( ber, "t{s{", LDAP_RES_SEARCH_ENTRY, slapi_entry_get_dn_const(e) );
if ( rc == -1 ) {
rc = -1;
goto cleanup;
9 years, 6 months
Branch '389-ds-base-1.3.3' - dirsrvtests/tickets ldap/servers
by thierry bordaz
dirsrvtests/tickets/ticket47920_test.py | 251 ++++++++++++++++++++++++++++++++
ldap/servers/slapd/result.c | 2
2 files changed, 252 insertions(+), 1 deletion(-)
New commits:
commit 90939dc9c965ea1cb88b88eec0cb735ab97ae551
Author: Thierry bordaz (tbordaz) <tbordaz(a)redhat.com>
Date: Thu Oct 9 14:31:11 2014 +0200
Ticket 47920: Encoding of SearchResultEntry is missing tag
Bug Description:
The encoding of the PreReadControl,PostReadControl does not
contain the tag (LDAP_RES_SEARCH_ENTRY = constructed+application).
The server should return SearchResultEntry (http://tools.ietf.org/html/rfc4527 3.1 & 3.2)
That is
SearchResultEntry ::= [APPLICATION 4] SEQUENCE {
objectName LDAPDN,
attributes PartialAttributeList }
Fix Description:
Add the tag to the ber encoding
https://fedorahosted.org/389/ticket/47920
Reviewed by: Noriko (thanks !)
Platforms tested: F17
Flag Day: no
Doc impact: no
diff --git a/dirsrvtests/tickets/ticket47920_test.py b/dirsrvtests/tickets/ticket47920_test.py
new file mode 100644
index 0000000..1e04626
--- /dev/null
+++ b/dirsrvtests/tickets/ticket47920_test.py
@@ -0,0 +1,251 @@
+import os
+import sys
+import time
+import ldap
+import logging
+import socket
+import time
+import logging
+import pytest
+import re
+from lib389 import DirSrv, Entry, tools
+from lib389.tools import DirSrvTools
+from lib389._constants import *
+from lib389.properties import *
+from constants import *
+from ldap.controls.readentry import PreReadControl,PostReadControl
+
+
+SCOPE_IN_CN = 'in'
+SCOPE_OUT_CN = 'out'
+SCOPE_IN_DN = 'cn=%s,%s' % (SCOPE_IN_CN, SUFFIX)
+SCOPE_OUT_DN = 'cn=%s,%s' % (SCOPE_OUT_CN, SUFFIX)
+
+PROVISIONING_CN = "provisioning"
+PROVISIONING_DN = "cn=%s,%s" % (PROVISIONING_CN, SCOPE_IN_DN)
+
+
+
+
+ACTIVE_CN = "accounts"
+STAGE_CN = "staged users"
+DELETE_CN = "deleted users"
+ACTIVE_DN = "cn=%s,%s" % (ACTIVE_CN, SCOPE_IN_DN)
+STAGE_DN = "cn=%s,%s" % (STAGE_CN, PROVISIONING_DN)
+DELETE_DN = "cn=%s,%s" % (DELETE_CN, PROVISIONING_DN)
+
+STAGE_USER_CN = "stage guy"
+STAGE_USER_DN = "cn=%s,%s" % (STAGE_USER_CN, STAGE_DN)
+
+ACTIVE_USER_CN = "active guy"
+ACTIVE_USER_DN = "cn=%s,%s" % (ACTIVE_USER_CN, ACTIVE_DN)
+
+OUT_USER_CN = "out guy"
+OUT_USER_DN = "cn=%s,%s" % (OUT_USER_CN, SCOPE_OUT_DN)
+
+STAGE_GROUP_CN = "stage group"
+STAGE_GROUP_DN = "cn=%s,%s" % (STAGE_GROUP_CN, STAGE_DN)
+
+ACTIVE_GROUP_CN = "active group"
+ACTIVE_GROUP_DN = "cn=%s,%s" % (ACTIVE_GROUP_CN, ACTIVE_DN)
+
+OUT_GROUP_CN = "out group"
+OUT_GROUP_DN = "cn=%s,%s" % (OUT_GROUP_CN, SCOPE_OUT_DN)
+
+INDIRECT_ACTIVE_GROUP_CN = "indirect active group"
+INDIRECT_ACTIVE_GROUP_DN = "cn=%s,%s" % (INDIRECT_ACTIVE_GROUP_CN, ACTIVE_DN)
+
+INITIAL_DESC="inital description"
+FINAL_DESC ="final description"
+
+
+
+log = logging.getLogger(__name__)
+
+installation_prefix = None
+
+
+class TopologyStandalone(object):
+ def __init__(self, standalone):
+ standalone.open()
+ self.standalone = standalone
+
+
+
+(a)pytest.fixture(scope="module")
+def topology(request):
+ '''
+ This fixture is used to standalone topology for the 'module'.
+ At the beginning, It may exists a standalone instance.
+ It may also exists a backup for the standalone instance.
+
+ Principle:
+ If standalone instance exists:
+ restart it
+ If backup of standalone exists:
+ create/rebind to standalone
+
+ restore standalone instance from backup
+ else:
+ Cleanup everything
+ remove instance
+ remove backup
+ Create instance
+ Create backup
+ '''
+ global installation_prefix
+
+ if installation_prefix:
+ args_instance[SER_DEPLOYED_DIR] = installation_prefix
+
+ standalone = DirSrv(verbose=False)
+
+ # Args for the standalone instance
+ args_instance[SER_HOST] = HOST_STANDALONE
+ args_instance[SER_PORT] = PORT_STANDALONE
+ args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
+ args_standalone = args_instance.copy()
+ standalone.allocate(args_standalone)
+
+ # Get the status of the backups
+ backup_standalone = standalone.checkBackupFS()
+
+ # Get the status of the instance and restart it if it exists
+ instance_standalone = standalone.exists()
+ if instance_standalone:
+ # assuming the instance is already stopped, just wait 5 sec max
+ standalone.stop(timeout=5)
+ standalone.start(timeout=10)
+
+ if backup_standalone:
+ # The backup exist, assuming it is correct
+ # we just re-init the instance with it
+ if not instance_standalone:
+ standalone.create()
+ # Used to retrieve configuration information (dbdir, confdir...)
+ standalone.open()
+
+ # restore standalone instance from backup
+ standalone.stop(timeout=10)
+ standalone.restoreFS(backup_standalone)
+ standalone.start(timeout=10)
+
+ else:
+ # We should be here only in two conditions
+ # - This is the first time a test involve standalone instance
+ # - Something weird happened (instance/backup destroyed)
+ # so we discard everything and recreate all
+
+ # Remove the backup. So even if we have a specific backup file
+ # (e.g backup_standalone) we clear backup that an instance may have created
+ if backup_standalone:
+ standalone.clearBackupFS()
+
+ # Remove the instance
+ if instance_standalone:
+ standalone.delete()
+
+ # Create the instance
+ standalone.create()
+
+ # Used to retrieve configuration information (dbdir, confdir...)
+ standalone.open()
+
+ # Time to create the backups
+ standalone.stop(timeout=10)
+ standalone.backupfile = standalone.backupFS()
+ standalone.start(timeout=10)
+
+ # clear the tmp directory
+ standalone.clearTmpDir(__file__)
+
+ #
+ # Here we have standalone instance up and running
+ # Either coming from a backup recovery
+ # or from a fresh (re)init
+ # Time to return the topology
+ return TopologyStandalone(standalone)
+
+def _header(topology, label):
+ topology.standalone.log.info("\n\n###############################################")
+ topology.standalone.log.info("#######")
+ topology.standalone.log.info("####### %s" % label)
+ topology.standalone.log.info("#######")
+ topology.standalone.log.info("###############################################")
+
+def _add_user(topology, type='active'):
+ if type == 'active':
+ topology.standalone.add_s(Entry((ACTIVE_USER_DN, {
+ 'objectclass': "top person inetuser".split(),
+ 'sn': ACTIVE_USER_CN,
+ 'cn': ACTIVE_USER_CN,
+ 'description': INITIAL_DESC})))
+ elif type == 'stage':
+ topology.standalone.add_s(Entry((STAGE_USER_DN, {
+ 'objectclass': "top person inetuser".split(),
+ 'sn': STAGE_USER_CN,
+ 'cn': STAGE_USER_CN})))
+ else:
+ topology.standalone.add_s(Entry((OUT_USER_DN, {
+ 'objectclass': "top person inetuser".split(),
+ 'sn': OUT_USER_CN,
+ 'cn': OUT_USER_CN})))
+
+def test_ticket47920_init(topology):
+ topology.standalone.add_s(Entry((SCOPE_IN_DN, {
+ 'objectclass': "top nscontainer".split(),
+ 'cn': SCOPE_IN_DN})))
+ topology.standalone.add_s(Entry((ACTIVE_DN, {
+ 'objectclass': "top nscontainer".split(),
+ 'cn': ACTIVE_CN})))
+
+ # add users
+ _add_user(topology, 'active')
+
+
+def test_ticket47920_mod_readentry_ctrl(topology):
+ _header(topology, 'MOD: with a readentry control')
+
+ topology.standalone.log.info("Check the initial value of the entry")
+ ent = topology.standalone.getEntry(ACTIVE_USER_DN, ldap.SCOPE_BASE, "(objectclass=*)", ['description'])
+ assert ent.hasAttr('description')
+ assert ent.getValue('description') == INITIAL_DESC
+
+ pr = PostReadControl(criticality=True,attrList=['cn', 'description'])
+ _,_,_,resp_ctrls = topology.standalone.modify_ext_s(ACTIVE_USER_DN, [(ldap.MOD_REPLACE, 'description', [FINAL_DESC])], serverctrls= [pr])
+
+ assert resp_ctrls[0].dn == ACTIVE_USER_DN
+ assert resp_ctrls[0].entry.has_key('description')
+ assert resp_ctrls[0].entry.has_key('cn')
+ print resp_ctrls[0].entry['description']
+
+ ent = topology.standalone.getEntry(ACTIVE_USER_DN, ldap.SCOPE_BASE, "(objectclass=*)", ['description'])
+ assert ent.hasAttr('description')
+ assert ent.getValue('description') == FINAL_DESC
+
+def test_ticket47920_final(topology):
+ topology.standalone.stop(timeout=10)
+
+
+
+def run_isolated():
+ '''
+ run_isolated is used to run these test cases independently of a test scheduler (xunit, py.test..)
+ To run isolated without py.test, you need to
+ - edit this file and comment '@pytest.fixture' line before 'topology' function.
+ - set the installation prefix
+ - run this program
+ '''
+ global installation_prefix
+ installation_prefix = None
+
+ topo = topology(True)
+ test_ticket47920_init(topo)
+
+ test_ticket47920_mod_readentry_ctrl(topo)
+
+ test_ticket47920_final(topo)
+
+if __name__ == '__main__':
+ run_isolated()
+
diff --git a/ldap/servers/slapd/result.c b/ldap/servers/slapd/result.c
index fa1788c..92573d5 100644
--- a/ldap/servers/slapd/result.c
+++ b/ldap/servers/slapd/result.c
@@ -2176,7 +2176,7 @@ encode_read_entry (Slapi_PBlock *pb, Slapi_Entry *e, char **attrs, int alluserat
}
/* Start the ber encoding with the DN */
- rc = ber_printf( ber, "{s{", slapi_entry_get_dn_const(e) );
+ rc = ber_printf( ber, "t{s{", LDAP_RES_SEARCH_ENTRY, slapi_entry_get_dn_const(e) );
if ( rc == -1 ) {
rc = -1;
goto cleanup;
9 years, 6 months
dirsrvtests/tickets ldap/servers
by thierry bordaz
dirsrvtests/tickets/ticket47920_test.py | 251 ++++++++++++++++++++++++++++++++
ldap/servers/slapd/result.c | 2
2 files changed, 252 insertions(+), 1 deletion(-)
New commits:
commit c7a78f442d6d18d20e23fda4afad8ddf2042a262
Author: Thierry bordaz (tbordaz) <tbordaz(a)redhat.com>
Date: Thu Oct 9 14:31:11 2014 +0200
Ticket 47920: Encoding of SearchResultEntry is missing tag
Bug Description:
The encoding of the PreReadControl,PostReadControl does not
contain the tag (LDAP_RES_SEARCH_ENTRY = constructed+application).
The server should return SearchResultEntry (http://tools.ietf.org/html/rfc4527 3.1 & 3.2)
That is
SearchResultEntry ::= [APPLICATION 4] SEQUENCE {
objectName LDAPDN,
attributes PartialAttributeList }
Fix Description:
Add the tag to the ber encoding
https://fedorahosted.org/389/ticket/47920
Reviewed by: Noriko (thanks !)
Platforms tested: F17
Flag Day: no
Doc impact: no
diff --git a/dirsrvtests/tickets/ticket47920_test.py b/dirsrvtests/tickets/ticket47920_test.py
new file mode 100644
index 0000000..1e04626
--- /dev/null
+++ b/dirsrvtests/tickets/ticket47920_test.py
@@ -0,0 +1,251 @@
+import os
+import sys
+import time
+import ldap
+import logging
+import socket
+import time
+import logging
+import pytest
+import re
+from lib389 import DirSrv, Entry, tools
+from lib389.tools import DirSrvTools
+from lib389._constants import *
+from lib389.properties import *
+from constants import *
+from ldap.controls.readentry import PreReadControl,PostReadControl
+
+
+SCOPE_IN_CN = 'in'
+SCOPE_OUT_CN = 'out'
+SCOPE_IN_DN = 'cn=%s,%s' % (SCOPE_IN_CN, SUFFIX)
+SCOPE_OUT_DN = 'cn=%s,%s' % (SCOPE_OUT_CN, SUFFIX)
+
+PROVISIONING_CN = "provisioning"
+PROVISIONING_DN = "cn=%s,%s" % (PROVISIONING_CN, SCOPE_IN_DN)
+
+
+
+
+ACTIVE_CN = "accounts"
+STAGE_CN = "staged users"
+DELETE_CN = "deleted users"
+ACTIVE_DN = "cn=%s,%s" % (ACTIVE_CN, SCOPE_IN_DN)
+STAGE_DN = "cn=%s,%s" % (STAGE_CN, PROVISIONING_DN)
+DELETE_DN = "cn=%s,%s" % (DELETE_CN, PROVISIONING_DN)
+
+STAGE_USER_CN = "stage guy"
+STAGE_USER_DN = "cn=%s,%s" % (STAGE_USER_CN, STAGE_DN)
+
+ACTIVE_USER_CN = "active guy"
+ACTIVE_USER_DN = "cn=%s,%s" % (ACTIVE_USER_CN, ACTIVE_DN)
+
+OUT_USER_CN = "out guy"
+OUT_USER_DN = "cn=%s,%s" % (OUT_USER_CN, SCOPE_OUT_DN)
+
+STAGE_GROUP_CN = "stage group"
+STAGE_GROUP_DN = "cn=%s,%s" % (STAGE_GROUP_CN, STAGE_DN)
+
+ACTIVE_GROUP_CN = "active group"
+ACTIVE_GROUP_DN = "cn=%s,%s" % (ACTIVE_GROUP_CN, ACTIVE_DN)
+
+OUT_GROUP_CN = "out group"
+OUT_GROUP_DN = "cn=%s,%s" % (OUT_GROUP_CN, SCOPE_OUT_DN)
+
+INDIRECT_ACTIVE_GROUP_CN = "indirect active group"
+INDIRECT_ACTIVE_GROUP_DN = "cn=%s,%s" % (INDIRECT_ACTIVE_GROUP_CN, ACTIVE_DN)
+
+INITIAL_DESC="inital description"
+FINAL_DESC ="final description"
+
+
+
+log = logging.getLogger(__name__)
+
+installation_prefix = None
+
+
+class TopologyStandalone(object):
+ def __init__(self, standalone):
+ standalone.open()
+ self.standalone = standalone
+
+
+
+(a)pytest.fixture(scope="module")
+def topology(request):
+ '''
+ This fixture is used to standalone topology for the 'module'.
+ At the beginning, It may exists a standalone instance.
+ It may also exists a backup for the standalone instance.
+
+ Principle:
+ If standalone instance exists:
+ restart it
+ If backup of standalone exists:
+ create/rebind to standalone
+
+ restore standalone instance from backup
+ else:
+ Cleanup everything
+ remove instance
+ remove backup
+ Create instance
+ Create backup
+ '''
+ global installation_prefix
+
+ if installation_prefix:
+ args_instance[SER_DEPLOYED_DIR] = installation_prefix
+
+ standalone = DirSrv(verbose=False)
+
+ # Args for the standalone instance
+ args_instance[SER_HOST] = HOST_STANDALONE
+ args_instance[SER_PORT] = PORT_STANDALONE
+ args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
+ args_standalone = args_instance.copy()
+ standalone.allocate(args_standalone)
+
+ # Get the status of the backups
+ backup_standalone = standalone.checkBackupFS()
+
+ # Get the status of the instance and restart it if it exists
+ instance_standalone = standalone.exists()
+ if instance_standalone:
+ # assuming the instance is already stopped, just wait 5 sec max
+ standalone.stop(timeout=5)
+ standalone.start(timeout=10)
+
+ if backup_standalone:
+ # The backup exist, assuming it is correct
+ # we just re-init the instance with it
+ if not instance_standalone:
+ standalone.create()
+ # Used to retrieve configuration information (dbdir, confdir...)
+ standalone.open()
+
+ # restore standalone instance from backup
+ standalone.stop(timeout=10)
+ standalone.restoreFS(backup_standalone)
+ standalone.start(timeout=10)
+
+ else:
+ # We should be here only in two conditions
+ # - This is the first time a test involve standalone instance
+ # - Something weird happened (instance/backup destroyed)
+ # so we discard everything and recreate all
+
+ # Remove the backup. So even if we have a specific backup file
+ # (e.g backup_standalone) we clear backup that an instance may have created
+ if backup_standalone:
+ standalone.clearBackupFS()
+
+ # Remove the instance
+ if instance_standalone:
+ standalone.delete()
+
+ # Create the instance
+ standalone.create()
+
+ # Used to retrieve configuration information (dbdir, confdir...)
+ standalone.open()
+
+ # Time to create the backups
+ standalone.stop(timeout=10)
+ standalone.backupfile = standalone.backupFS()
+ standalone.start(timeout=10)
+
+ # clear the tmp directory
+ standalone.clearTmpDir(__file__)
+
+ #
+ # Here we have standalone instance up and running
+ # Either coming from a backup recovery
+ # or from a fresh (re)init
+ # Time to return the topology
+ return TopologyStandalone(standalone)
+
+def _header(topology, label):
+ topology.standalone.log.info("\n\n###############################################")
+ topology.standalone.log.info("#######")
+ topology.standalone.log.info("####### %s" % label)
+ topology.standalone.log.info("#######")
+ topology.standalone.log.info("###############################################")
+
+def _add_user(topology, type='active'):
+ if type == 'active':
+ topology.standalone.add_s(Entry((ACTIVE_USER_DN, {
+ 'objectclass': "top person inetuser".split(),
+ 'sn': ACTIVE_USER_CN,
+ 'cn': ACTIVE_USER_CN,
+ 'description': INITIAL_DESC})))
+ elif type == 'stage':
+ topology.standalone.add_s(Entry((STAGE_USER_DN, {
+ 'objectclass': "top person inetuser".split(),
+ 'sn': STAGE_USER_CN,
+ 'cn': STAGE_USER_CN})))
+ else:
+ topology.standalone.add_s(Entry((OUT_USER_DN, {
+ 'objectclass': "top person inetuser".split(),
+ 'sn': OUT_USER_CN,
+ 'cn': OUT_USER_CN})))
+
+def test_ticket47920_init(topology):
+ topology.standalone.add_s(Entry((SCOPE_IN_DN, {
+ 'objectclass': "top nscontainer".split(),
+ 'cn': SCOPE_IN_DN})))
+ topology.standalone.add_s(Entry((ACTIVE_DN, {
+ 'objectclass': "top nscontainer".split(),
+ 'cn': ACTIVE_CN})))
+
+ # add users
+ _add_user(topology, 'active')
+
+
+def test_ticket47920_mod_readentry_ctrl(topology):
+ _header(topology, 'MOD: with a readentry control')
+
+ topology.standalone.log.info("Check the initial value of the entry")
+ ent = topology.standalone.getEntry(ACTIVE_USER_DN, ldap.SCOPE_BASE, "(objectclass=*)", ['description'])
+ assert ent.hasAttr('description')
+ assert ent.getValue('description') == INITIAL_DESC
+
+ pr = PostReadControl(criticality=True,attrList=['cn', 'description'])
+ _,_,_,resp_ctrls = topology.standalone.modify_ext_s(ACTIVE_USER_DN, [(ldap.MOD_REPLACE, 'description', [FINAL_DESC])], serverctrls= [pr])
+
+ assert resp_ctrls[0].dn == ACTIVE_USER_DN
+ assert resp_ctrls[0].entry.has_key('description')
+ assert resp_ctrls[0].entry.has_key('cn')
+ print resp_ctrls[0].entry['description']
+
+ ent = topology.standalone.getEntry(ACTIVE_USER_DN, ldap.SCOPE_BASE, "(objectclass=*)", ['description'])
+ assert ent.hasAttr('description')
+ assert ent.getValue('description') == FINAL_DESC
+
+def test_ticket47920_final(topology):
+ topology.standalone.stop(timeout=10)
+
+
+
+def run_isolated():
+ '''
+ run_isolated is used to run these test cases independently of a test scheduler (xunit, py.test..)
+ To run isolated without py.test, you need to
+ - edit this file and comment '@pytest.fixture' line before 'topology' function.
+ - set the installation prefix
+ - run this program
+ '''
+ global installation_prefix
+ installation_prefix = None
+
+ topo = topology(True)
+ test_ticket47920_init(topo)
+
+ test_ticket47920_mod_readentry_ctrl(topo)
+
+ test_ticket47920_final(topo)
+
+if __name__ == '__main__':
+ run_isolated()
+
diff --git a/ldap/servers/slapd/result.c b/ldap/servers/slapd/result.c
index fa1788c..92573d5 100644
--- a/ldap/servers/slapd/result.c
+++ b/ldap/servers/slapd/result.c
@@ -2176,7 +2176,7 @@ encode_read_entry (Slapi_PBlock *pb, Slapi_Entry *e, char **attrs, int alluserat
}
/* Start the ber encoding with the DN */
- rc = ber_printf( ber, "{s{", slapi_entry_get_dn_const(e) );
+ rc = ber_printf( ber, "t{s{", LDAP_RES_SEARCH_ENTRY, slapi_entry_get_dn_const(e) );
if ( rc == -1 ) {
rc = -1;
goto cleanup;
9 years, 6 months
Branch '389-ds-base-1.3.3' - ldap/servers
by Noriko Hosoi
ldap/servers/slapd/back-ldbm/ldbm_delete.c | 48 ++++++++++++++---------------
1 file changed, 24 insertions(+), 24 deletions(-)
New commits:
commit 7df17293d7dff918e05bc9376064290db61d1f70
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Oct 7 14:02:20 2014 -0700
Ticket #47912 - Proper handling of "No original_tombstone for changenumber" errors
Bug Description: As analyzed by Ludwig Krispen in
https://fedorahosted.org/389/ticket/47912#comment:1,
an error message "No original_tombstone for ..." is always logged
if original_tombstone does not exist. It should be just for the
case create_tombstone_entry.
Fix Description: This patch place the original_tombstone handling
in "if (create_tombstone_entry)" clause.
https://fedorahosted.org/389/ticket/47912
Reviewed by lkrispen(a)redhat.com (Thank you, Ludwig!!)
(cherry picked from commit 36381c120773872d3d4d2cb2417f155e6ac790a6)
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_delete.c b/ldap/servers/slapd/back-ldbm/ldbm_delete.c
index 5f12ea3..9c19f08 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_delete.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_delete.c
@@ -225,33 +225,33 @@ ldbm_back_delete( Slapi_PBlock *pb )
free_delete_existing_entry = 1; /* must free the dup */
if (create_tombstone_entry) {
slapi_sdn_set_ndn_byval(&nscpEntrySDN, slapi_sdn_get_ndn(slapi_entry_get_sdn(e->ep_entry)));
- }
- /* reset tombstone entry */
- if (original_tombstone) {
- /* must duplicate tombstone before returning it to cache,
- * which could free the entry. */
- if ( (tmptombstone = backentry_dup( original_tombstone )) == NULL ) {
- ldap_result_code= LDAP_OPERATIONS_ERROR;
- goto error_return;
- }
- if (cache_is_in_cache(&inst->inst_cache, tombstone)) {
- CACHE_REMOVE(&inst->inst_cache, tombstone);
- }
- CACHE_RETURN(&inst->inst_cache, &tombstone);
- if (tombstone) {
+ /* reset tombstone entry */
+ if (original_tombstone) {
+ /* must duplicate tombstone before returning it to cache,
+ * which could free the entry. */
+ if ( (tmptombstone = backentry_dup( original_tombstone )) == NULL ) {
+ ldap_result_code= LDAP_OPERATIONS_ERROR;
+ goto error_return;
+ }
+ if (cache_is_in_cache(&inst->inst_cache, tombstone)) {
+ CACHE_REMOVE(&inst->inst_cache, tombstone);
+ }
+ CACHE_RETURN(&inst->inst_cache, &tombstone);
+ if (tombstone) {
+ slapi_log_error(SLAPI_LOG_FATAL, "ldbm_back_delete",
+ "conn=%lu op=%d [retry: %d] tombstone %s is not freed!!! refcnt %d, state %d\n",
+ conn_id, op_id, retry_count, slapi_entry_get_dn(tombstone->ep_entry),
+ tombstone->ep_refcnt, tombstone->ep_state);
+ }
+ tombstone = original_tombstone;
+ original_tombstone = tmptombstone;
+ tmptombstone = NULL;
+ } else {
slapi_log_error(SLAPI_LOG_FATAL, "ldbm_back_delete",
- "conn=%lu op=%d [retry: %d] tombstone %s is not freed!!! refcnt %d, state %d\n",
- conn_id, op_id, retry_count, slapi_entry_get_dn(tombstone->ep_entry),
- tombstone->ep_refcnt, tombstone->ep_state);
+ "conn=%lu op=%d [retry: %d] No original_tombstone for %s!!\n",
+ conn_id, op_id, retry_count, slapi_entry_get_dn(e->ep_entry));
}
- tombstone = original_tombstone;
- original_tombstone = tmptombstone;
- tmptombstone = NULL;
- } else {
- slapi_log_error(SLAPI_LOG_FATAL, "ldbm_back_delete",
- "conn=%lu op=%d [retry: %d] No original_tombstone for %s!!\n",
- conn_id, op_id, retry_count, slapi_entry_get_dn(e->ep_entry));
}
if (ruv_c_init) {
/* reset the ruv txn stuff */
9 years, 6 months
ldap/servers
by Noriko Hosoi
ldap/servers/slapd/back-ldbm/ldbm_delete.c | 48 ++++++++++++++---------------
1 file changed, 24 insertions(+), 24 deletions(-)
New commits:
commit 36381c120773872d3d4d2cb2417f155e6ac790a6
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Oct 7 14:02:20 2014 -0700
Ticket #47912 - Proper handling of "No original_tombstone for changenumber" errors
Bug Description: As analyzed by Ludwig Krispen in
https://fedorahosted.org/389/ticket/47912#comment:1,
an error message "No original_tombstone for ..." is always logged
if original_tombstone does not exist. It should be just for the
case create_tombstone_entry.
Fix Description: This patch place the original_tombstone handling
in "if (create_tombstone_entry)" clause.
https://fedorahosted.org/389/ticket/47912
Reviewed by lkrispen(a)redhat.com (Thank you, Ludwig!!)
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_delete.c b/ldap/servers/slapd/back-ldbm/ldbm_delete.c
index 5f12ea3..9c19f08 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_delete.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_delete.c
@@ -225,33 +225,33 @@ ldbm_back_delete( Slapi_PBlock *pb )
free_delete_existing_entry = 1; /* must free the dup */
if (create_tombstone_entry) {
slapi_sdn_set_ndn_byval(&nscpEntrySDN, slapi_sdn_get_ndn(slapi_entry_get_sdn(e->ep_entry)));
- }
- /* reset tombstone entry */
- if (original_tombstone) {
- /* must duplicate tombstone before returning it to cache,
- * which could free the entry. */
- if ( (tmptombstone = backentry_dup( original_tombstone )) == NULL ) {
- ldap_result_code= LDAP_OPERATIONS_ERROR;
- goto error_return;
- }
- if (cache_is_in_cache(&inst->inst_cache, tombstone)) {
- CACHE_REMOVE(&inst->inst_cache, tombstone);
- }
- CACHE_RETURN(&inst->inst_cache, &tombstone);
- if (tombstone) {
+ /* reset tombstone entry */
+ if (original_tombstone) {
+ /* must duplicate tombstone before returning it to cache,
+ * which could free the entry. */
+ if ( (tmptombstone = backentry_dup( original_tombstone )) == NULL ) {
+ ldap_result_code= LDAP_OPERATIONS_ERROR;
+ goto error_return;
+ }
+ if (cache_is_in_cache(&inst->inst_cache, tombstone)) {
+ CACHE_REMOVE(&inst->inst_cache, tombstone);
+ }
+ CACHE_RETURN(&inst->inst_cache, &tombstone);
+ if (tombstone) {
+ slapi_log_error(SLAPI_LOG_FATAL, "ldbm_back_delete",
+ "conn=%lu op=%d [retry: %d] tombstone %s is not freed!!! refcnt %d, state %d\n",
+ conn_id, op_id, retry_count, slapi_entry_get_dn(tombstone->ep_entry),
+ tombstone->ep_refcnt, tombstone->ep_state);
+ }
+ tombstone = original_tombstone;
+ original_tombstone = tmptombstone;
+ tmptombstone = NULL;
+ } else {
slapi_log_error(SLAPI_LOG_FATAL, "ldbm_back_delete",
- "conn=%lu op=%d [retry: %d] tombstone %s is not freed!!! refcnt %d, state %d\n",
- conn_id, op_id, retry_count, slapi_entry_get_dn(tombstone->ep_entry),
- tombstone->ep_refcnt, tombstone->ep_state);
+ "conn=%lu op=%d [retry: %d] No original_tombstone for %s!!\n",
+ conn_id, op_id, retry_count, slapi_entry_get_dn(e->ep_entry));
}
- tombstone = original_tombstone;
- original_tombstone = tmptombstone;
- tmptombstone = NULL;
- } else {
- slapi_log_error(SLAPI_LOG_FATAL, "ldbm_back_delete",
- "conn=%lu op=%d [retry: %d] No original_tombstone for %s!!\n",
- conn_id, op_id, retry_count, slapi_entry_get_dn(e->ep_entry));
}
if (ruv_c_init) {
/* reset the ruv txn stuff */
9 years, 6 months
Branch '389-ds-base-1.3.3' - ldap/servers
by Noriko Hosoi
ldap/servers/slapd/slapi-plugin.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit e7a26ddaf5825a77a4c9ea59086316e815b2c175
Author: Petr Viktorin <pviktori(a)redhat.com>
Date: Mon Sep 15 13:16:15 2014 +0200
Ticket 47899: Fix slapi_td_plugin_lock_init prototype
Description: FreeIPA compilation gives a GCC warning in a 389-ds header:
warning: function declaration isn't a prototype
Fixing the warning as follows:
-int slapi_td_plugin_lock_init();
+int slapi_td_plugin_lock_init(void);
Note: () takes any number of arguments, while (void) takes none.
(cherry picked from commit 3104346c574f17925c8113a30aa20116bf6a277c)
diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h
index f1ecfe8..268e465 100644
--- a/ldap/servers/slapd/slapi-plugin.h
+++ b/ldap/servers/slapd/slapi-plugin.h
@@ -5582,7 +5582,7 @@ void slapi_td_get_val(int indexType, void **value);
int slapi_td_dn_init(void);
int slapi_td_set_dn(char *dn);
void slapi_td_get_dn(char **dn);
-int slapi_td_plugin_lock_init();
+int slapi_td_plugin_lock_init(void);
int slapi_td_set_plugin_locked(int *value);
void slapi_td_get_plugin_locked(int **value);
9 years, 6 months
ldap/servers
by Noriko Hosoi
ldap/servers/slapd/slapi-plugin.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 3104346c574f17925c8113a30aa20116bf6a277c
Author: Petr Viktorin <pviktori(a)redhat.com>
Date: Mon Sep 15 13:16:15 2014 +0200
Ticket 47899: Fix slapi_td_plugin_lock_init prototype
Description: FreeIPA compilation gives a GCC warning in a 389-ds header:
warning: function declaration isn't a prototype
Fixing the warning as follows:
-int slapi_td_plugin_lock_init();
+int slapi_td_plugin_lock_init(void);
Note: () takes any number of arguments, while (void) takes none.
diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h
index f1ecfe8..268e465 100644
--- a/ldap/servers/slapd/slapi-plugin.h
+++ b/ldap/servers/slapd/slapi-plugin.h
@@ -5582,7 +5582,7 @@ void slapi_td_get_val(int indexType, void **value);
int slapi_td_dn_init(void);
int slapi_td_set_dn(char *dn);
void slapi_td_get_dn(char **dn);
-int slapi_td_plugin_lock_init();
+int slapi_td_plugin_lock_init(void);
int slapi_td_set_plugin_locked(int *value);
void slapi_td_get_plugin_locked(int **value);
9 years, 6 months
Branch '389-ds-base-1.3.1' - ldap/servers
by Noriko Hosoi
ldap/servers/slapd/back-ldbm/ldbm_modify.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
New commits:
commit b721da8061074126db6028e819e629bc51c37784
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Oct 7 12:12:28 2014 -0700
Ticket #47919 - ldbm_back_modify SLAPI_PLUGIN_BE_PRE_MODIFY_FN does not return even if one of the preop plugins fails.
Bug Description: In ldbm_back_modify, if one of the be_preop plugins
called at SLAPI_PLUGIN_BE_PRE_MODIFY_FN fail, ldbm_back_modify does
not return there but go to the real modify operation.
Fix Description: If an error is returned from be_preop plugins in
ldbm_back_modify, it returns the error there and does not proceed
the modify operation.
https://fedorahosted.org/389/ticket/47919
Reviewed by mreynolds(a)redhat.com (Thank you, Mark!!)
(cherry picked from commit cb173814ec579fafbfef515738c16a986a9749cd)
(cherry picked from commit 17294432e95bdb30c6816cefa7be5035df818a43)
(cherry picked from commit 65c73b4f909903b46655aee020b2e82c0cd4cfd0)
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_modify.c b/ldap/servers/slapd/back-ldbm/ldbm_modify.c
index e6ccf20..5f6d14d 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_modify.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_modify.c
@@ -596,11 +596,11 @@ ldbm_back_modify( Slapi_PBlock *pb )
if (SLAPI_PLUGIN_NOOP == opreturn) {
not_an_error = 1;
rc = opreturn = LDAP_SUCCESS;
- goto error_return;
} else if (!opreturn) {
- opreturn = -1;
+ opreturn = SLAPI_PLUGIN_FAILURE;
slapi_pblock_set(pb, SLAPI_PLUGIN_OPRETURN, &opreturn);
}
+ goto error_return;
}
/* The Plugin may have messed about with some of the PBlock parameters... ie. mods */
slapi_pblock_get( pb, SLAPI_MODIFY_MODS, &mods );
9 years, 6 months
Branch '389-ds-base-1.3.2' - ldap/servers
by Noriko Hosoi
ldap/servers/slapd/back-ldbm/ldbm_modify.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
New commits:
commit 65c73b4f909903b46655aee020b2e82c0cd4cfd0
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Oct 7 12:12:28 2014 -0700
Ticket #47919 - ldbm_back_modify SLAPI_PLUGIN_BE_PRE_MODIFY_FN does not return even if one of the preop plugins fails.
Bug Description: In ldbm_back_modify, if one of the be_preop plugins
called at SLAPI_PLUGIN_BE_PRE_MODIFY_FN fail, ldbm_back_modify does
not return there but go to the real modify operation.
Fix Description: If an error is returned from be_preop plugins in
ldbm_back_modify, it returns the error there and does not proceed
the modify operation.
https://fedorahosted.org/389/ticket/47919
Reviewed by mreynolds(a)redhat.com (Thank you, Mark!!)
(cherry picked from commit cb173814ec579fafbfef515738c16a986a9749cd)
(cherry picked from commit 17294432e95bdb30c6816cefa7be5035df818a43)
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_modify.c b/ldap/servers/slapd/back-ldbm/ldbm_modify.c
index 79c059a..13bc4b4 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_modify.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_modify.c
@@ -636,11 +636,11 @@ ldbm_back_modify( Slapi_PBlock *pb )
if (SLAPI_PLUGIN_NOOP == opreturn) {
not_an_error = 1;
rc = opreturn = LDAP_SUCCESS;
- goto error_return;
} else if (!opreturn) {
- opreturn = -1;
+ opreturn = SLAPI_PLUGIN_FAILURE;
slapi_pblock_set(pb, SLAPI_PLUGIN_OPRETURN, &opreturn);
}
+ goto error_return;
}
/* The Plugin may have messed about with some of the PBlock parameters... ie. mods */
slapi_pblock_get( pb, SLAPI_MODIFY_MODS, &mods );
9 years, 6 months