Branch '389-ds-base-1.3.4' - ldap/servers
by Mark Reynolds
ldap/servers/slapd/back-ldbm/import.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit d2f46f5af86faa9f50b85eea8dea2df563501f28
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Mon Dec 19 12:26:59 2016 -0500
Ticket 49071 - Import with duplicate DNs throws unexpected errors
Bug Description: When an import fails there are unable to flush error
messages.
Fix Description: When an import fails close the database files before
deleting them.
Also fixed a small issue in DSUtil where we did not properly
check if an entry was valid.
https://fedorahosted.org/389/ticket/49071
Reviewed by: mreynolds(one line commit rule)
(cherry picked from commit 64b1ebffe5af118965bcdf3a84d62c0fc3efd196)
diff --git a/ldap/servers/slapd/back-ldbm/import.c b/ldap/servers/slapd/back-ldbm/import.c
index a59f980..b121ccb 100644
--- a/ldap/servers/slapd/back-ldbm/import.c
+++ b/ldap/servers/slapd/back-ldbm/import.c
@@ -1433,12 +1433,12 @@ error:
}
}
if (0 != ret) {
+ dblayer_instance_close(job->inst->inst_be);
if (!(job->flags & (FLAG_DRYRUN|FLAG_UPGRADEDNFORMAT_V1))) {
/* If not dryrun NOR upgradedn space */
/* if running in the dry run mode, don't touch the db */
dblayer_delete_instance_dir(be);
}
- dblayer_instance_close(job->inst->inst_be);
} else {
if (0 != (ret = dblayer_instance_close(job->inst->inst_be)) ) {
import_log_notice(job, "Failed to close database");
7 years, 4 months
Branch '389-ds-base-1.3.5' - ldap/admin ldap/servers
by Mark Reynolds
ldap/admin/src/scripts/DSUtil.pm.in | 2 +-
ldap/servers/slapd/back-ldbm/import.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
New commits:
commit 8ab4be536a39569cf2c74672aa73848b94b10503
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Mon Dec 19 12:26:59 2016 -0500
Ticket 49071 - Import with duplicate DNs throws unexpected errors
Bug Description: When an import fails there are unable to flush error
messages.
Fix Description: When an import fails close the database files before
deleting them.
Also fixed a small issue in DSUtil where we did not properly
check if an entry was valid.
https://fedorahosted.org/389/ticket/49071
Reviewed by: mreynolds(one line commit rule)
(cherry picked from commit 64b1ebffe5af118965bcdf3a84d62c0fc3efd196)
diff --git a/ldap/admin/src/scripts/DSUtil.pm.in b/ldap/admin/src/scripts/DSUtil.pm.in
index eac59a3..c972805 100644
--- a/ldap/admin/src/scripts/DSUtil.pm.in
+++ b/ldap/admin/src/scripts/DSUtil.pm.in
@@ -1262,7 +1262,7 @@ sub get_info {
last;
}
}
- if($foundcfg eq "yes"){
+ if($foundcfg eq "yes" && $entry){
$info{cacertfile} = $entry->getValues("CACertExtractFile");
if ($info{cacertfile}) {
$ENV{LDAPTLS_CACERT}=$info{cacertfile};
diff --git a/ldap/servers/slapd/back-ldbm/import.c b/ldap/servers/slapd/back-ldbm/import.c
index 78aefbf..b1ce6cd 100644
--- a/ldap/servers/slapd/back-ldbm/import.c
+++ b/ldap/servers/slapd/back-ldbm/import.c
@@ -1472,12 +1472,12 @@ error:
}
}
if (0 != ret) {
+ dblayer_instance_close(job->inst->inst_be);
if (!(job->flags & (FLAG_DRYRUN|FLAG_UPGRADEDNFORMAT_V1))) {
/* If not dryrun NOR upgradedn space */
/* if running in the dry run mode, don't touch the db */
dblayer_delete_instance_dir(be);
}
- dblayer_instance_close(job->inst->inst_be);
} else {
if (0 != (ret = dblayer_instance_close(job->inst->inst_be)) ) {
import_log_notice(job, "Failed to close database");
7 years, 4 months
ldap/admin ldap/servers
by Mark Reynolds
ldap/admin/src/scripts/DSUtil.pm.in | 2 +-
ldap/servers/slapd/back-ldbm/import.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
New commits:
commit 64b1ebffe5af118965bcdf3a84d62c0fc3efd196
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Mon Dec 19 12:26:59 2016 -0500
Ticket 49071 - Import with duplicate DNs throws unexpected errors
Bug Description: When an import fails there are unable to flush error
messages.
Fix Description: When an import fails close the database files before
deleting them.
Also fixed a small issue in DSUtil where we did not properly
check if an entry was valid.
https://fedorahosted.org/389/ticket/49071
Reviewed by: mreynolds(one line commit rule)
diff --git a/ldap/admin/src/scripts/DSUtil.pm.in b/ldap/admin/src/scripts/DSUtil.pm.in
index eac59a3..c972805 100644
--- a/ldap/admin/src/scripts/DSUtil.pm.in
+++ b/ldap/admin/src/scripts/DSUtil.pm.in
@@ -1262,7 +1262,7 @@ sub get_info {
last;
}
}
- if($foundcfg eq "yes"){
+ if($foundcfg eq "yes" && $entry){
$info{cacertfile} = $entry->getValues("CACertExtractFile");
if ($info{cacertfile}) {
$ENV{LDAPTLS_CACERT}=$info{cacertfile};
diff --git a/ldap/servers/slapd/back-ldbm/import.c b/ldap/servers/slapd/back-ldbm/import.c
index 0512194..d0cef1a 100644
--- a/ldap/servers/slapd/back-ldbm/import.c
+++ b/ldap/servers/slapd/back-ldbm/import.c
@@ -1485,12 +1485,12 @@ error:
}
}
if (0 != ret) {
+ dblayer_instance_close(job->inst->inst_be);
if (!(job->flags & (FLAG_DRYRUN|FLAG_UPGRADEDNFORMAT_V1))) {
/* If not dryrun NOR upgradedn space */
/* if running in the dry run mode, don't touch the db */
dblayer_delete_instance_dir(be);
}
- dblayer_instance_close(job->inst->inst_be);
} else {
if (0 != (ret = dblayer_instance_close(job->inst->inst_be)) ) {
import_log_notice(job, SLAPI_LOG_WARNING, "import_main_offline", "Failed to close database");
7 years, 4 months
Branch '389-ds-base-1.3.4' - dirsrvtests/tickets
by Mark Reynolds
dirsrvtests/tickets/ticket47966_test.py | 219 ++++++++++++++++++++++++++++++++
1 file changed, 219 insertions(+)
New commits:
commit 9f9dcdd6ed55f56b71a32d866773c849f1369b83
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Apr 10 14:10:40 2015 -0700
Ticket 47966 - CI test: added test cases for ticket 47966
Summary: slapd crashes during Dogtag clone reinstallation
Testing bulk import when the backend with VLV was recreated.
(cherry picked from commit 8309fd046c0e3ca9385fdb93f54515eb6004e69f)
diff --git a/dirsrvtests/tickets/ticket47966_test.py b/dirsrvtests/tickets/ticket47966_test.py
new file mode 100644
index 0000000..0e784af
--- /dev/null
+++ b/dirsrvtests/tickets/ticket47966_test.py
@@ -0,0 +1,219 @@
+import os
+import sys
+import time
+import ldap
+import logging
+import pytest
+from lib389 import DirSrv, Entry, tools, tasks
+from lib389.tools import DirSrvTools
+from lib389._constants import *
+from lib389.properties import *
+from lib389.tasks import *
+from lib389.utils import *
+
+logging.getLogger(__name__).setLevel(logging.DEBUG)
+log = logging.getLogger(__name__)
+
+installation1_prefix = None
+
+m1_m2_agmt = ""
+
+class TopologyReplication(object):
+ def __init__(self, master1, master2):
+ master1.open()
+ self.master1 = master1
+ master2.open()
+ self.master2 = master2
+
+
+(a)pytest.fixture(scope="module")
+def topology(request):
+ global installation1_prefix
+ if installation1_prefix:
+ args_instance[SER_DEPLOYED_DIR] = installation1_prefix
+
+ # Creating master 1...
+ master1 = DirSrv(verbose=False)
+ args_instance[SER_HOST] = HOST_MASTER_1
+ args_instance[SER_PORT] = PORT_MASTER_1
+ args_instance[SER_SERVERID_PROP] = SERVERID_MASTER_1
+ args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
+ args_master = args_instance.copy()
+ master1.allocate(args_master)
+ instance_master1 = master1.exists()
+ if instance_master1:
+ master1.delete()
+ master1.create()
+ master1.open()
+ master1.replica.enableReplication(suffix=DEFAULT_SUFFIX, role=REPLICAROLE_MASTER, replicaId=REPLICAID_MASTER_1)
+
+ # Creating master 2...
+ master2 = DirSrv(verbose=False)
+ args_instance[SER_HOST] = HOST_MASTER_2
+ args_instance[SER_PORT] = PORT_MASTER_2
+ args_instance[SER_SERVERID_PROP] = SERVERID_MASTER_2
+ args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
+ args_master = args_instance.copy()
+ master2.allocate(args_master)
+ instance_master2 = master2.exists()
+ if instance_master2:
+ master2.delete()
+ master2.create()
+ master2.open()
+ master2.replica.enableReplication(suffix=DEFAULT_SUFFIX, role=REPLICAROLE_MASTER, replicaId=REPLICAID_MASTER_2)
+
+ #
+ # Create all the agreements
+ #
+ # Creating agreement from master 1 to master 2
+ properties = {RA_NAME: r'meTo_$host:$port',
+ RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
+ RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
+ RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
+ RA_TRANSPORT_PROT: defaultProperties[REPLICATION_TRANSPORT]}
+ global m1_m2_agmt
+ m1_m2_agmt = master1.agreement.create(suffix=DEFAULT_SUFFIX, host=master2.host, port=master2.port, properties=properties)
+ if not m1_m2_agmt:
+ log.fatal("Fail to create a master -> master replica agreement")
+ sys.exit(1)
+ log.debug("%s created" % m1_m2_agmt)
+
+ # Creating agreement from master 2 to master 1
+ properties = {RA_NAME: r'meTo_$host:$port',
+ RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
+ RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
+ RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
+ RA_TRANSPORT_PROT: defaultProperties[REPLICATION_TRANSPORT]}
+ m2_m1_agmt = master2.agreement.create(suffix=DEFAULT_SUFFIX, host=master1.host, port=master1.port, properties=properties)
+ if not m2_m1_agmt:
+ log.fatal("Fail to create a master -> master replica agreement")
+ sys.exit(1)
+ log.debug("%s created" % m2_m1_agmt)
+
+ # Allow the replicas to get situated with the new agreements...
+ time.sleep(5)
+
+ #
+ # Initialize all the agreements
+ #
+ master1.agreement.init(DEFAULT_SUFFIX, HOST_MASTER_2, PORT_MASTER_2)
+ master1.waitForReplInit(m1_m2_agmt)
+
+ # Check replication is working...
+ if master1.testReplication(DEFAULT_SUFFIX, master2):
+ log.info('Replication is working.')
+ else:
+ log.fatal('Replication is not working.')
+ assert False
+
+ # Clear out the tmp dir
+ master1.clearTmpDir(__file__)
+
+ return TopologyReplication(master1, master2)
+
+
+def test_ticket47966(topology):
+ '''
+ Testing bulk import when the backend with VLV was recreated.
+ If the test passes without the server crash, 47966 is verified.
+ '''
+ log.info('Testing Ticket 47966 - [VLV] slapd crashes during Dogtag clone reinstallation')
+ M1 = topology.master1
+ M2 = topology.master2
+
+ log.info('0. Create a VLV index on Master 2.')
+ # get the backend entry
+ be = M2.replica.conn.backend.list(suffix=DEFAULT_SUFFIX)
+ if not be:
+ log.fatal("ticket47966: enable to retrieve the backend for %s" % DEFAULT_SUFFIX)
+ raise ValueError("no backend for suffix %s" % DEFAULT_SUFFIX)
+ bent = be[0]
+ beName = bent.getValue('cn')
+ beDn = "cn=%s,cn=ldbm database,cn=plugins,cn=config" % beName
+
+ # generate vlvSearch entry
+ vlvSrchDn = "cn=vlvSrch,%s" % beDn
+ log.info('0-1. vlvSearch dn: %s' % vlvSrchDn)
+ vlvSrchEntry = Entry(vlvSrchDn)
+ vlvSrchEntry.setValues('objectclass', 'top', 'vlvSearch')
+ vlvSrchEntry.setValues('cn', 'vlvSrch')
+ vlvSrchEntry.setValues('vlvBase', DEFAULT_SUFFIX)
+ vlvSrchEntry.setValues('vlvFilter', '(|(objectclass=*)(objectclass=ldapsubentry))')
+ vlvSrchEntry.setValues('vlvScope', '2')
+ M2.add_s(vlvSrchEntry)
+
+ # generate vlvIndex entry
+ vlvIndexDn = "cn=vlvIdx,%s" % vlvSrchDn
+ log.info('0-2. vlvIndex dn: %s' % vlvIndexDn)
+ vlvIndexEntry = Entry(vlvIndexDn)
+ vlvIndexEntry.setValues('objectclass', 'top', 'vlvIndex')
+ vlvIndexEntry.setValues('cn', 'vlvIdx')
+ vlvIndexEntry.setValues('vlvSort', 'cn ou sn')
+ M2.add_s(vlvIndexEntry)
+
+ log.info('1. Initialize Master 2 from Master 1.')
+ M1.agreement.init(DEFAULT_SUFFIX, HOST_MASTER_2, PORT_MASTER_2)
+ M1.waitForReplInit(m1_m2_agmt)
+
+ # Check replication is working...
+ if M1.testReplication(DEFAULT_SUFFIX, M2):
+ log.info('1-1. Replication is working.')
+ else:
+ log.fatal('1-1. Replication is not working.')
+ assert False
+
+ log.info('2. Delete the backend instance on Master 2.')
+ M2.delete_s(vlvIndexDn)
+ M2.delete_s(vlvSrchDn)
+ # delete the agreement, replica, and mapping tree, too.
+ M2.replica.disableReplication(DEFAULT_SUFFIX)
+ mappingTree = 'cn="%s",cn=mapping tree,cn=config' % DEFAULT_SUFFIX
+ M2.mappingtree.delete(DEFAULT_SUFFIX, beName, mappingTree)
+ M2.backend.delete(DEFAULT_SUFFIX, beDn, beName)
+
+ log.info('3. Recreate the backend and the VLV index on Master 2.')
+ M2.mappingtree.create(DEFAULT_SUFFIX, beName)
+ M2.backend.create(DEFAULT_SUFFIX, {BACKEND_NAME: beName})
+ log.info('3-1. Recreating %s and %s on Master 2.' % (vlvSrchDn, vlvIndexDn))
+ M2.add_s(vlvSrchEntry)
+ M2.add_s(vlvIndexEntry)
+ M2.replica.enableReplication(suffix=DEFAULT_SUFFIX, role=REPLICAROLE_MASTER, replicaId=REPLICAID_MASTER_2)
+ # agreement m2_m1_agmt is not needed... :p
+
+ log.info('4. Initialize Master 2 from Master 1 again.')
+ M1.agreement.init(DEFAULT_SUFFIX, HOST_MASTER_2, PORT_MASTER_2)
+ M1.waitForReplInit(m1_m2_agmt)
+
+ # Check replication is working...
+ if M1.testReplication(DEFAULT_SUFFIX, M2):
+ log.info('4-1. Replication is working.')
+ else:
+ log.fatal('4-1. Replication is not working.')
+ assert False
+
+ log.info('5. Check Master 2 is up.')
+ entries = M2.search_s(DEFAULT_SUFFIX, ldap.SCOPE_SUBTREE, '(cn=*)')
+ assert len(entries) > 0
+ log.info('5-1. %s entries are returned from M2.' % len(entries))
+
+ log.info('Test complete')
+
+
+def test_ticket47966_final(topology):
+ topology.master1.delete()
+ topology.master2.delete()
+ log.info('Testcase PASSED')
+
+
+def run_isolated():
+ global installation1_prefix
+ installation1_prefix = None
+
+ topo = topology(True)
+ test_ticket47966(topo)
+ test_ticket47966_final(topo)
+
+
+if __name__ == '__main__':
+ run_isolated()
+
7 years, 4 months
Branch '389-ds-base-1.3.5' - dirsrvtests/tickets
by Mark Reynolds
dirsrvtests/tickets/ticket47966_test.py | 219 ++++++++++++++++++++++++++++++++
1 file changed, 219 insertions(+)
New commits:
commit a4a34531c8a80efeebabcc408fca13ced13730df
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Apr 10 14:10:40 2015 -0700
Ticket 47966 - CI test: added test cases for ticket 47966
Summary: slapd crashes during Dogtag clone reinstallation
Testing bulk import when the backend with VLV was recreated.
(cherry picked from commit 8309fd046c0e3ca9385fdb93f54515eb6004e69f)
diff --git a/dirsrvtests/tickets/ticket47966_test.py b/dirsrvtests/tickets/ticket47966_test.py
new file mode 100644
index 0000000..0e784af
--- /dev/null
+++ b/dirsrvtests/tickets/ticket47966_test.py
@@ -0,0 +1,219 @@
+import os
+import sys
+import time
+import ldap
+import logging
+import pytest
+from lib389 import DirSrv, Entry, tools, tasks
+from lib389.tools import DirSrvTools
+from lib389._constants import *
+from lib389.properties import *
+from lib389.tasks import *
+from lib389.utils import *
+
+logging.getLogger(__name__).setLevel(logging.DEBUG)
+log = logging.getLogger(__name__)
+
+installation1_prefix = None
+
+m1_m2_agmt = ""
+
+class TopologyReplication(object):
+ def __init__(self, master1, master2):
+ master1.open()
+ self.master1 = master1
+ master2.open()
+ self.master2 = master2
+
+
+(a)pytest.fixture(scope="module")
+def topology(request):
+ global installation1_prefix
+ if installation1_prefix:
+ args_instance[SER_DEPLOYED_DIR] = installation1_prefix
+
+ # Creating master 1...
+ master1 = DirSrv(verbose=False)
+ args_instance[SER_HOST] = HOST_MASTER_1
+ args_instance[SER_PORT] = PORT_MASTER_1
+ args_instance[SER_SERVERID_PROP] = SERVERID_MASTER_1
+ args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
+ args_master = args_instance.copy()
+ master1.allocate(args_master)
+ instance_master1 = master1.exists()
+ if instance_master1:
+ master1.delete()
+ master1.create()
+ master1.open()
+ master1.replica.enableReplication(suffix=DEFAULT_SUFFIX, role=REPLICAROLE_MASTER, replicaId=REPLICAID_MASTER_1)
+
+ # Creating master 2...
+ master2 = DirSrv(verbose=False)
+ args_instance[SER_HOST] = HOST_MASTER_2
+ args_instance[SER_PORT] = PORT_MASTER_2
+ args_instance[SER_SERVERID_PROP] = SERVERID_MASTER_2
+ args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
+ args_master = args_instance.copy()
+ master2.allocate(args_master)
+ instance_master2 = master2.exists()
+ if instance_master2:
+ master2.delete()
+ master2.create()
+ master2.open()
+ master2.replica.enableReplication(suffix=DEFAULT_SUFFIX, role=REPLICAROLE_MASTER, replicaId=REPLICAID_MASTER_2)
+
+ #
+ # Create all the agreements
+ #
+ # Creating agreement from master 1 to master 2
+ properties = {RA_NAME: r'meTo_$host:$port',
+ RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
+ RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
+ RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
+ RA_TRANSPORT_PROT: defaultProperties[REPLICATION_TRANSPORT]}
+ global m1_m2_agmt
+ m1_m2_agmt = master1.agreement.create(suffix=DEFAULT_SUFFIX, host=master2.host, port=master2.port, properties=properties)
+ if not m1_m2_agmt:
+ log.fatal("Fail to create a master -> master replica agreement")
+ sys.exit(1)
+ log.debug("%s created" % m1_m2_agmt)
+
+ # Creating agreement from master 2 to master 1
+ properties = {RA_NAME: r'meTo_$host:$port',
+ RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
+ RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
+ RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
+ RA_TRANSPORT_PROT: defaultProperties[REPLICATION_TRANSPORT]}
+ m2_m1_agmt = master2.agreement.create(suffix=DEFAULT_SUFFIX, host=master1.host, port=master1.port, properties=properties)
+ if not m2_m1_agmt:
+ log.fatal("Fail to create a master -> master replica agreement")
+ sys.exit(1)
+ log.debug("%s created" % m2_m1_agmt)
+
+ # Allow the replicas to get situated with the new agreements...
+ time.sleep(5)
+
+ #
+ # Initialize all the agreements
+ #
+ master1.agreement.init(DEFAULT_SUFFIX, HOST_MASTER_2, PORT_MASTER_2)
+ master1.waitForReplInit(m1_m2_agmt)
+
+ # Check replication is working...
+ if master1.testReplication(DEFAULT_SUFFIX, master2):
+ log.info('Replication is working.')
+ else:
+ log.fatal('Replication is not working.')
+ assert False
+
+ # Clear out the tmp dir
+ master1.clearTmpDir(__file__)
+
+ return TopologyReplication(master1, master2)
+
+
+def test_ticket47966(topology):
+ '''
+ Testing bulk import when the backend with VLV was recreated.
+ If the test passes without the server crash, 47966 is verified.
+ '''
+ log.info('Testing Ticket 47966 - [VLV] slapd crashes during Dogtag clone reinstallation')
+ M1 = topology.master1
+ M2 = topology.master2
+
+ log.info('0. Create a VLV index on Master 2.')
+ # get the backend entry
+ be = M2.replica.conn.backend.list(suffix=DEFAULT_SUFFIX)
+ if not be:
+ log.fatal("ticket47966: enable to retrieve the backend for %s" % DEFAULT_SUFFIX)
+ raise ValueError("no backend for suffix %s" % DEFAULT_SUFFIX)
+ bent = be[0]
+ beName = bent.getValue('cn')
+ beDn = "cn=%s,cn=ldbm database,cn=plugins,cn=config" % beName
+
+ # generate vlvSearch entry
+ vlvSrchDn = "cn=vlvSrch,%s" % beDn
+ log.info('0-1. vlvSearch dn: %s' % vlvSrchDn)
+ vlvSrchEntry = Entry(vlvSrchDn)
+ vlvSrchEntry.setValues('objectclass', 'top', 'vlvSearch')
+ vlvSrchEntry.setValues('cn', 'vlvSrch')
+ vlvSrchEntry.setValues('vlvBase', DEFAULT_SUFFIX)
+ vlvSrchEntry.setValues('vlvFilter', '(|(objectclass=*)(objectclass=ldapsubentry))')
+ vlvSrchEntry.setValues('vlvScope', '2')
+ M2.add_s(vlvSrchEntry)
+
+ # generate vlvIndex entry
+ vlvIndexDn = "cn=vlvIdx,%s" % vlvSrchDn
+ log.info('0-2. vlvIndex dn: %s' % vlvIndexDn)
+ vlvIndexEntry = Entry(vlvIndexDn)
+ vlvIndexEntry.setValues('objectclass', 'top', 'vlvIndex')
+ vlvIndexEntry.setValues('cn', 'vlvIdx')
+ vlvIndexEntry.setValues('vlvSort', 'cn ou sn')
+ M2.add_s(vlvIndexEntry)
+
+ log.info('1. Initialize Master 2 from Master 1.')
+ M1.agreement.init(DEFAULT_SUFFIX, HOST_MASTER_2, PORT_MASTER_2)
+ M1.waitForReplInit(m1_m2_agmt)
+
+ # Check replication is working...
+ if M1.testReplication(DEFAULT_SUFFIX, M2):
+ log.info('1-1. Replication is working.')
+ else:
+ log.fatal('1-1. Replication is not working.')
+ assert False
+
+ log.info('2. Delete the backend instance on Master 2.')
+ M2.delete_s(vlvIndexDn)
+ M2.delete_s(vlvSrchDn)
+ # delete the agreement, replica, and mapping tree, too.
+ M2.replica.disableReplication(DEFAULT_SUFFIX)
+ mappingTree = 'cn="%s",cn=mapping tree,cn=config' % DEFAULT_SUFFIX
+ M2.mappingtree.delete(DEFAULT_SUFFIX, beName, mappingTree)
+ M2.backend.delete(DEFAULT_SUFFIX, beDn, beName)
+
+ log.info('3. Recreate the backend and the VLV index on Master 2.')
+ M2.mappingtree.create(DEFAULT_SUFFIX, beName)
+ M2.backend.create(DEFAULT_SUFFIX, {BACKEND_NAME: beName})
+ log.info('3-1. Recreating %s and %s on Master 2.' % (vlvSrchDn, vlvIndexDn))
+ M2.add_s(vlvSrchEntry)
+ M2.add_s(vlvIndexEntry)
+ M2.replica.enableReplication(suffix=DEFAULT_SUFFIX, role=REPLICAROLE_MASTER, replicaId=REPLICAID_MASTER_2)
+ # agreement m2_m1_agmt is not needed... :p
+
+ log.info('4. Initialize Master 2 from Master 1 again.')
+ M1.agreement.init(DEFAULT_SUFFIX, HOST_MASTER_2, PORT_MASTER_2)
+ M1.waitForReplInit(m1_m2_agmt)
+
+ # Check replication is working...
+ if M1.testReplication(DEFAULT_SUFFIX, M2):
+ log.info('4-1. Replication is working.')
+ else:
+ log.fatal('4-1. Replication is not working.')
+ assert False
+
+ log.info('5. Check Master 2 is up.')
+ entries = M2.search_s(DEFAULT_SUFFIX, ldap.SCOPE_SUBTREE, '(cn=*)')
+ assert len(entries) > 0
+ log.info('5-1. %s entries are returned from M2.' % len(entries))
+
+ log.info('Test complete')
+
+
+def test_ticket47966_final(topology):
+ topology.master1.delete()
+ topology.master2.delete()
+ log.info('Testcase PASSED')
+
+
+def run_isolated():
+ global installation1_prefix
+ installation1_prefix = None
+
+ topo = topology(True)
+ test_ticket47966(topo)
+ test_ticket47966_final(topo)
+
+
+if __name__ == '__main__':
+ run_isolated()
+
7 years, 4 months
Branch '389-ds-base-1.3.5' - ldap/servers
by Mark Reynolds
ldap/servers/slapd/back-ldbm/dblayer.c | 8 +++++++-
ldap/servers/slapd/back-ldbm/ldbm_attr.c | 4 ++++
2 files changed, 11 insertions(+), 1 deletion(-)
New commits:
commit 6c39c9564b9ea78a4bc2db145e7b26667137496d
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Sep 28 15:28:28 2016 -0700
Ticket #48987 - Heap use after free in dblayer_close_indexes
Description: Once an attribute info is deleted, its backpointer
dblayer_handle_ai_backpointer in the dblayer handle needs to be
set to NULL not to access the address again. We also need to set
this to null from within the dblayer_close_indexes because there
is no guarantee on the order that we free the handle or the
attrinfo.
https://fedorahosted.org/389/ticket/48987
Author: nhosoi, wibrown
Review: nhosoi (Thanks!)
(cherry picked from commit 99176404bfe76ee9fcf48b8b28750ec3979ec020)
diff --git a/ldap/servers/slapd/back-ldbm/dblayer.c b/ldap/servers/slapd/back-ldbm/dblayer.c
index c84196a..be8091e 100644
--- a/ldap/servers/slapd/back-ldbm/dblayer.c
+++ b/ldap/servers/slapd/back-ldbm/dblayer.c
@@ -2514,7 +2514,13 @@ int dblayer_close_indexes(backend *be)
pDB = handle->dblayer_dbp;
return_value |= pDB->close(pDB,0);
next = handle->dblayer_handle_next;
- *((dblayer_handle **)handle->dblayer_handle_ai_backpointer) = NULL;
+ /* If the backpointer is still valid, NULL the attrinfos ref to us
+ * This is important as there is no ordering guarantee between if the
+ * handle or the attrinfo is freed first!
+ */
+ if (handle->dblayer_handle_ai_backpointer) {
+ *((dblayer_handle **)handle->dblayer_handle_ai_backpointer) = NULL;
+ }
slapi_ch_free((void**)&handle);
}
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_attr.c b/ldap/servers/slapd/back-ldbm/ldbm_attr.c
index 7e44cfe..0cc6747 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_attr.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_attr.c
@@ -59,6 +59,10 @@ attrinfo_delete(struct attrinfo **pp)
slapi_ch_free((void**)&((*pp)->ai_attrcrypt));
attr_done(&((*pp)->ai_sattr));
attrinfo_delete_idlistinfo(&(*pp)->ai_idlistinfo);
+ if ((*pp)->ai_dblayer) {
+ /* attriinfo is deleted. Cleaning up the backpointer at the same time. */
+ ((dblayer_handle *)((*pp)->ai_dblayer))->dblayer_handle_ai_backpointer = NULL;
+ }
slapi_ch_free((void**)pp);
*pp= NULL;
}
7 years, 4 months
Branch '389-ds-base-1.3.4' - ldap/servers
by Mark Reynolds
ldap/servers/slapd/back-ldbm/dblayer.c | 8 +++++++-
ldap/servers/slapd/back-ldbm/ldbm_attr.c | 4 ++++
2 files changed, 11 insertions(+), 1 deletion(-)
New commits:
commit 85f4cd60974d43ab4c7145b8e9b925a1e387ba6d
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Sep 28 15:28:28 2016 -0700
Ticket #48987 - Heap use after free in dblayer_close_indexes
Description: Once an attribute info is deleted, its backpointer
dblayer_handle_ai_backpointer in the dblayer handle needs to be
set to NULL not to access the address again. We also need to set
this to null from within the dblayer_close_indexes because there
is no guarantee on the order that we free the handle or the
attrinfo.
https://fedorahosted.org/389/ticket/48987
Author: nhosoi, wibrown
Review: nhosoi (Thanks!)
(cherry picked from commit 99176404bfe76ee9fcf48b8b28750ec3979ec020)
diff --git a/ldap/servers/slapd/back-ldbm/dblayer.c b/ldap/servers/slapd/back-ldbm/dblayer.c
index 9e74d9b..d1d8972 100644
--- a/ldap/servers/slapd/back-ldbm/dblayer.c
+++ b/ldap/servers/slapd/back-ldbm/dblayer.c
@@ -2679,7 +2679,13 @@ int dblayer_close_indexes(backend *be)
pDB = handle->dblayer_dbp;
return_value |= pDB->close(pDB,0);
next = handle->dblayer_handle_next;
- *((dblayer_handle **)handle->dblayer_handle_ai_backpointer) = NULL;
+ /* If the backpointer is still valid, NULL the attrinfos ref to us
+ * This is important as there is no ordering guarantee between if the
+ * handle or the attrinfo is freed first!
+ */
+ if (handle->dblayer_handle_ai_backpointer) {
+ *((dblayer_handle **)handle->dblayer_handle_ai_backpointer) = NULL;
+ }
slapi_ch_free((void**)&handle);
}
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_attr.c b/ldap/servers/slapd/back-ldbm/ldbm_attr.c
index 7e44cfe..0cc6747 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_attr.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_attr.c
@@ -59,6 +59,10 @@ attrinfo_delete(struct attrinfo **pp)
slapi_ch_free((void**)&((*pp)->ai_attrcrypt));
attr_done(&((*pp)->ai_sattr));
attrinfo_delete_idlistinfo(&(*pp)->ai_idlistinfo);
+ if ((*pp)->ai_dblayer) {
+ /* attriinfo is deleted. Cleaning up the backpointer at the same time. */
+ ((dblayer_handle *)((*pp)->ai_dblayer))->dblayer_handle_ai_backpointer = NULL;
+ }
slapi_ch_free((void**)pp);
*pp= NULL;
}
7 years, 4 months
Branch '389-ds-base-1.2.11' - ldap/servers
by Mark Reynolds
ldap/servers/slapd/back-ldbm/dblayer.c | 8 +++++++-
ldap/servers/slapd/back-ldbm/ldbm_attr.c | 4 ++++
2 files changed, 11 insertions(+), 1 deletion(-)
New commits:
commit f4b2a54d45606d61828d37b2a901f799a2de5f7b
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Sep 28 15:28:28 2016 -0700
Ticket #48987 - Heap use after free in dblayer_close_indexes
Description: Once an attribute info is deleted, its backpointer
dblayer_handle_ai_backpointer in the dblayer handle needs to be
set to NULL not to access the address again. We also need to set
this to null from within the dblayer_close_indexes because there
is no guarantee on the order that we free the handle or the
attrinfo.
https://fedorahosted.org/389/ticket/48987
Author: nhosoi, wibrown
Review: nhosoi (Thanks!)
(cherry picked from commit 99176404bfe76ee9fcf48b8b28750ec3979ec020)
diff --git a/ldap/servers/slapd/back-ldbm/dblayer.c b/ldap/servers/slapd/back-ldbm/dblayer.c
index b4a0589..126c426 100644
--- a/ldap/servers/slapd/back-ldbm/dblayer.c
+++ b/ldap/servers/slapd/back-ldbm/dblayer.c
@@ -2635,7 +2635,13 @@ int dblayer_close_indexes(backend *be)
pDB = handle->dblayer_dbp;
return_value |= pDB->close(pDB,0);
next = handle->dblayer_handle_next;
- *((dblayer_handle **)handle->dblayer_handle_ai_backpointer) = NULL;
+ /* If the backpointer is still valid, NULL the attrinfos ref to us
+ * This is important as there is no ordering guarantee between if the
+ * handle or the attrinfo is freed first!
+ */
+ if (handle->dblayer_handle_ai_backpointer) {
+ *((dblayer_handle **)handle->dblayer_handle_ai_backpointer) = NULL;
+ }
slapi_ch_free((void**)&handle);
}
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_attr.c b/ldap/servers/slapd/back-ldbm/ldbm_attr.c
index db087fe..862dcd1 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_attr.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_attr.c
@@ -88,6 +88,10 @@ attrinfo_delete(struct attrinfo **pp)
slapi_ch_free((void**)&((*pp)->ai_attrcrypt));
attr_done(&((*pp)->ai_sattr));
attrinfo_delete_idlistinfo(&(*pp)->ai_idlistinfo);
+ if ((*pp)->ai_dblayer) {
+ /* attriinfo is deleted. Cleaning up the backpointer at the same time. */
+ ((dblayer_handle *)((*pp)->ai_dblayer))->dblayer_handle_ai_backpointer = NULL;
+ }
slapi_ch_free((void**)pp);
*pp= NULL;
}
7 years, 4 months
Branch '389-ds-base-1.3.4' - dirsrvtests/tests ldap/servers
by Mark Reynolds
dirsrvtests/tests/tickets/ticket48665_test.py | 101 ++++++++++++++++++++
ldap/servers/slapd/back-ldbm/ldbm_instance_config.c | 16 ++-
2 files changed, 114 insertions(+), 3 deletions(-)
New commits:
commit 2dd62a722a045190d18128e35539ed93878368f0
Author: William Brown <firstyear(a)redhat.com>
Date: Wed Mar 9 14:00:42 2016 +1000
Ticket 48665 - Prevent sefault in ldbm_instance_modify_config_entry
Bug Description: python ldap sends a mod_delete then a mod_add to the server.
This causes a segfault in ldbm_instance_modify_config_entry which expects the
value of the delete operation to exist.
Fix Description: If there is no attribute in the delete operation, this now
passes a NULL to ldbm_config_set, which then rejects the op as NO_SUCH_ATTRIBUTE
There is an attached test case, which also checks that mod_replace is still
functional.
https://fedorahosted.org/389/ticket/48665
Author: wibrown
Review by: nhosoi (Thanks!)
(cherry picked from commit 9134b006948d7d8eeb926655640b7f068fc6724d)
diff --git a/dirsrvtests/tests/tickets/ticket48665_test.py b/dirsrvtests/tests/tickets/ticket48665_test.py
new file mode 100644
index 0000000..702319c
--- /dev/null
+++ b/dirsrvtests/tests/tickets/ticket48665_test.py
@@ -0,0 +1,101 @@
+import os
+import sys
+import time
+import ldap
+import logging
+import pytest
+from lib389 import DirSrv, Entry, tools, tasks
+from lib389.tools import DirSrvTools
+from lib389._constants import *
+from lib389.properties import *
+from lib389.tasks import *
+from lib389.utils import *
+
+logging.getLogger(__name__).setLevel(logging.DEBUG)
+log = logging.getLogger(__name__)
+
+class TopologyStandalone(object):
+ def __init__(self, standalone):
+ standalone.open()
+ self.standalone = standalone
+
+
+(a)pytest.fixture(scope="module")
+def topology(request):
+ # Creating standalone instance ...
+ standalone = DirSrv(verbose=False)
+ args_instance[SER_HOST] = HOST_STANDALONE
+ args_instance[SER_PORT] = PORT_STANDALONE
+ args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
+ args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
+ args_standalone = args_instance.copy()
+ standalone.allocate(args_standalone)
+ instance_standalone = standalone.exists()
+ if instance_standalone:
+ standalone.delete()
+ standalone.create()
+ standalone.open()
+
+ # Delete each instance in the end
+ def fin():
+ # This is useful for analysing the test env.
+ #standalone.db2ldif(bename=DEFAULT_BENAME, suffixes=[DEFAULT_SUFFIX], excludeSuffixes=[], encrypt=False, \
+ # repl_data=True, outputfile='%s/ldif/%s.ldif' % (standalone.dbdir,SERVERID_STANDALONE ))
+ #standalone.clearBackupFS()
+ #standalone.backupFS()
+ standalone.delete()
+ request.addfinalizer(fin)
+
+ # Clear out the tmp dir
+ standalone.clearTmpDir(__file__)
+
+ return TopologyStandalone(standalone)
+
+
+def test_ticket48665(topology):
+ """
+ This tests deletion of certain cn=config values.
+
+ First, it should be able to delete, and not crash the server.
+
+ Second, we might be able to delete then add to replace values.
+
+ We should also still be able to mod replace the values and keep the server alive.
+ """
+ #topology.standalone.config.enable_log('audit')
+ #topology.standalone.config.enable_log('auditfail')
+ # This will trigger a mod delete then add.
+ try:
+ modlist = [(ldap.MOD_DELETE, 'nsslapd-cachememsize', None), (ldap.MOD_ADD, 'nsslapd-cachememsize', '1')]
+ topology.standalone.modify_s("cn=%s,cn=ldbm database,cn=plugins,cn=config" % DEFAULT_BENAME,
+ modlist)
+ except:
+ pass
+ # Check the server has not commited seppuku.
+ result = topology.standalone.whoami_s()
+ assert(DN_DM.lower() in result.lower())
+
+ # This has a magic hack to determine if we are in cn=config.
+ topology.standalone.backend.setProperties(bename=DEFAULT_BENAME,
+ prop='nsslapd-cachememsize', values='1')
+ # Check the server has not commited seppuku.
+ result = topology.standalone.whoami_s()
+ assert(DN_DM.lower() in result.lower())
+
+ # Now try with mod_replace. This should be okay.
+
+ modlist = [(ldap.MOD_REPLACE, 'nsslapd-cachememsize', '1')]
+ topology.standalone.modify_s("cn=%s,cn=ldbm database,cn=plugins,cn=config" % DEFAULT_BENAME,
+ modlist)
+ # Check the server has not commited seppuku.
+ result = topology.standalone.whoami_s()
+ assert(DN_DM.lower() in result.lower())
+
+ log.info('Test complete')
+
+
+if __name__ == '__main__':
+ # Run isolated
+ # -s for DEBUG mode
+ CURRENT_FILE = os.path.realpath(__file__)
+ pytest.main("-s %s" % CURRENT_FILE)
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c b/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
index e9db22b..9b66148 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
@@ -776,9 +776,19 @@ ldbm_instance_modify_config_entry_callback(Slapi_PBlock *pb, Slapi_Entry* entryB
}
/* This assumes there is only one bval for this mod. */
- rc = ldbm_config_set((void *) inst, attr_name,
- ldbm_instance_config, mods[i]->mod_bvalues[0], returntext,
- CONFIG_PHASE_RUNNING, apply_mod, mods[i]->mod_op);
+ if (mods[i]->mod_bvalues == NULL) {
+ /* This avoids the null pointer deref.
+ * In ldbm_config.c ldbm_config_set, it checks for the NULL.
+ * If it's a NULL, we get NO_SUCH_ATTRIBUTE error.
+ */
+ rc = ldbm_config_set((void *) inst, attr_name,
+ ldbm_instance_config, NULL, returntext,
+ CONFIG_PHASE_RUNNING, apply_mod, mods[i]->mod_op);
+ } else {
+ rc = ldbm_config_set((void *) inst, attr_name,
+ ldbm_instance_config, mods[i]->mod_bvalues[0], returntext,
+ CONFIG_PHASE_RUNNING, apply_mod, mods[i]->mod_op);
+ }
}
}
7 years, 4 months
Branch '389-ds-base-1.2.11' - dirsrvtests/tests ldap/servers
by Mark Reynolds
dirsrvtests/tests/tickets/ticket48665_test.py | 101 ++++++++++++++++++++
ldap/servers/slapd/back-ldbm/ldbm_instance_config.c | 16 ++-
2 files changed, 114 insertions(+), 3 deletions(-)
New commits:
commit fa54d0ce631d29343d04b8dcea8ef8d9c235feb3
Author: William Brown <firstyear(a)redhat.com>
Date: Wed Mar 9 14:00:42 2016 +1000
Ticket 48665 - Prevent sefault in ldbm_instance_modify_config_entry
Bug Description: python ldap sends a mod_delete then a mod_add to the server.
This causes a segfault in ldbm_instance_modify_config_entry which expects the
value of the delete operation to exist.
Fix Description: If there is no attribute in the delete operation, this now
passes a NULL to ldbm_config_set, which then rejects the op as NO_SUCH_ATTRIBUTE
There is an attached test case, which also checks that mod_replace is still
functional.
https://fedorahosted.org/389/ticket/48665
Author: wibrown
Review by: nhosoi (Thanks!)
(cherry picked from commit 9134b006948d7d8eeb926655640b7f068fc6724d)
diff --git a/dirsrvtests/tests/tickets/ticket48665_test.py b/dirsrvtests/tests/tickets/ticket48665_test.py
new file mode 100644
index 0000000..702319c
--- /dev/null
+++ b/dirsrvtests/tests/tickets/ticket48665_test.py
@@ -0,0 +1,101 @@
+import os
+import sys
+import time
+import ldap
+import logging
+import pytest
+from lib389 import DirSrv, Entry, tools, tasks
+from lib389.tools import DirSrvTools
+from lib389._constants import *
+from lib389.properties import *
+from lib389.tasks import *
+from lib389.utils import *
+
+logging.getLogger(__name__).setLevel(logging.DEBUG)
+log = logging.getLogger(__name__)
+
+class TopologyStandalone(object):
+ def __init__(self, standalone):
+ standalone.open()
+ self.standalone = standalone
+
+
+(a)pytest.fixture(scope="module")
+def topology(request):
+ # Creating standalone instance ...
+ standalone = DirSrv(verbose=False)
+ args_instance[SER_HOST] = HOST_STANDALONE
+ args_instance[SER_PORT] = PORT_STANDALONE
+ args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
+ args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
+ args_standalone = args_instance.copy()
+ standalone.allocate(args_standalone)
+ instance_standalone = standalone.exists()
+ if instance_standalone:
+ standalone.delete()
+ standalone.create()
+ standalone.open()
+
+ # Delete each instance in the end
+ def fin():
+ # This is useful for analysing the test env.
+ #standalone.db2ldif(bename=DEFAULT_BENAME, suffixes=[DEFAULT_SUFFIX], excludeSuffixes=[], encrypt=False, \
+ # repl_data=True, outputfile='%s/ldif/%s.ldif' % (standalone.dbdir,SERVERID_STANDALONE ))
+ #standalone.clearBackupFS()
+ #standalone.backupFS()
+ standalone.delete()
+ request.addfinalizer(fin)
+
+ # Clear out the tmp dir
+ standalone.clearTmpDir(__file__)
+
+ return TopologyStandalone(standalone)
+
+
+def test_ticket48665(topology):
+ """
+ This tests deletion of certain cn=config values.
+
+ First, it should be able to delete, and not crash the server.
+
+ Second, we might be able to delete then add to replace values.
+
+ We should also still be able to mod replace the values and keep the server alive.
+ """
+ #topology.standalone.config.enable_log('audit')
+ #topology.standalone.config.enable_log('auditfail')
+ # This will trigger a mod delete then add.
+ try:
+ modlist = [(ldap.MOD_DELETE, 'nsslapd-cachememsize', None), (ldap.MOD_ADD, 'nsslapd-cachememsize', '1')]
+ topology.standalone.modify_s("cn=%s,cn=ldbm database,cn=plugins,cn=config" % DEFAULT_BENAME,
+ modlist)
+ except:
+ pass
+ # Check the server has not commited seppuku.
+ result = topology.standalone.whoami_s()
+ assert(DN_DM.lower() in result.lower())
+
+ # This has a magic hack to determine if we are in cn=config.
+ topology.standalone.backend.setProperties(bename=DEFAULT_BENAME,
+ prop='nsslapd-cachememsize', values='1')
+ # Check the server has not commited seppuku.
+ result = topology.standalone.whoami_s()
+ assert(DN_DM.lower() in result.lower())
+
+ # Now try with mod_replace. This should be okay.
+
+ modlist = [(ldap.MOD_REPLACE, 'nsslapd-cachememsize', '1')]
+ topology.standalone.modify_s("cn=%s,cn=ldbm database,cn=plugins,cn=config" % DEFAULT_BENAME,
+ modlist)
+ # Check the server has not commited seppuku.
+ result = topology.standalone.whoami_s()
+ assert(DN_DM.lower() in result.lower())
+
+ log.info('Test complete')
+
+
+if __name__ == '__main__':
+ # Run isolated
+ # -s for DEBUG mode
+ CURRENT_FILE = os.path.realpath(__file__)
+ pytest.main("-s %s" % CURRENT_FILE)
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c b/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
index 2037618..c269ab3 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
@@ -789,9 +789,19 @@ ldbm_instance_modify_config_entry_callback(Slapi_PBlock *pb, Slapi_Entry* entryB
}
/* This assumes there is only one bval for this mod. */
- rc = ldbm_config_set((void *) inst, attr_name,
- ldbm_instance_config, mods[i]->mod_bvalues[0], returntext,
- CONFIG_PHASE_RUNNING, apply_mod, mods[i]->mod_op);
+ if (mods[i]->mod_bvalues == NULL) {
+ /* This avoids the null pointer deref.
+ * In ldbm_config.c ldbm_config_set, it checks for the NULL.
+ * If it's a NULL, we get NO_SUCH_ATTRIBUTE error.
+ */
+ rc = ldbm_config_set((void *) inst, attr_name,
+ ldbm_instance_config, NULL, returntext,
+ CONFIG_PHASE_RUNNING, apply_mod, mods[i]->mod_op);
+ } else {
+ rc = ldbm_config_set((void *) inst, attr_name,
+ ldbm_instance_config, mods[i]->mod_bvalues[0], returntext,
+ CONFIG_PHASE_RUNNING, apply_mod, mods[i]->mod_op);
+ }
}
}
7 years, 4 months