This is an automated email from the git hooks/post-receive script.
tbordaz pushed a commit to branch master
in repository 389-ds-base.
commit c0a7be7cedb901f4c2a493d962297521f21794a1
Author: Thierry Bordaz <tbordaz(a)redhat.com>
Date: Wed Oct 25 17:33:18 2017 +0200
Ticket 49412 - SIGSEV when setting invalid changelog config value
Bug Description:
If admin configures attribute of "cn=changelog5,cn=config" with
empty value, it can trigger a sigsev
Fix Description:
Testing empty value
https://pagure.io/389-ds-base/issue/49412
Reviewed by: Ludwig Krispenz, Mark Reynolds (thanks to you)
Platforms tested: F23
Flag Day: no
Doc impact: no
---
dirsrvtests/tests/tickets/ticket49412_tests.py | 65 ++++++++++++++++++++++++++
ldap/servers/plugins/replication/cl5_config.c | 8 ++++
2 files changed, 73 insertions(+)
diff --git a/dirsrvtests/tests/tickets/ticket49412_tests.py
b/dirsrvtests/tests/tickets/ticket49412_tests.py
new file mode 100644
index 0000000..da15a28
--- /dev/null
+++ b/dirsrvtests/tests/tickets/ticket49412_tests.py
@@ -0,0 +1,65 @@
+import logging
+import pytest
+import os
+import ldap
+import time
+from lib389._constants import *
+from lib389.topologies import topology_m1c1 as topo
+from lib389._constants import *
+from lib389 import Entry
+
+DEBUGGING = os.getenv("DEBUGGING", default=False)
+if DEBUGGING:
+ logging.getLogger(__name__).setLevel(logging.DEBUG)
+else:
+ logging.getLogger(__name__).setLevel(logging.INFO)
+log = logging.getLogger(__name__)
+CHANGELOG = 'cn=changelog5,cn=config'
+MAXAGE_ATTR = 'nsslapd-changelogmaxage'
+TRIMINTERVAL = 'nsslapd-changelogtrim-interval'
+
+
+
+def test_ticket49412(topo):
+ """Specify a test case purpose or name here
+
+ :id: 4c7681ff-0511-4256-9589-bdcad84c13e6
+ :setup: Fill in set up configuration here
+ :steps:
+ 1. Fill in test case steps here
+ 2. And indent them like this (RST format requirement)
+ :expectedresults:
+ 1. Fill in the result that is expected
+ 2. For each test step
+ """
+
+ M1 = topo.ms["master1"]
+
+ # wrong call with invalid value (should be str(60)
+ # that create replace with NULL value
+ # it should fail with UNWILLING_TO_PERFORM
+ try:
+ M1.modify_s(CHANGELOG, [(ldap.MOD_REPLACE, MAXAGE_ATTR, 60),
+ (ldap.MOD_REPLACE, TRIMINTERVAL, 10)])
+ assert(False)
+ except ldap.UNWILLING_TO_PERFORM:
+ pass
+
+ # If you need any test suite initialization,
+ # please, write additional fixture for that (including finalizer).
+ # Topology for suites are predefined in lib389/topologies.py.
+
+ # If you need host, port or any other data about instance,
+ # Please, use the instance object attributes for that (for example,
topo.ms["master1"].serverid)
+
+ if DEBUGGING:
+ # Add debugging steps(if any)...
+ pass
+
+
+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/plugins/replication/cl5_config.c
b/ldap/servers/plugins/replication/cl5_config.c
index ab2c53d..12a58c6 100644
--- a/ldap/servers/plugins/replication/cl5_config.c
+++ b/ldap/servers/plugins/replication/cl5_config.c
@@ -305,6 +305,14 @@ changelog5_config_modify(Slapi_PBlock *pb,
for (i = 0; mods && mods[i] != NULL; i++) {
if (mods[i]->mod_op & LDAP_MOD_DELETE) {
/* We don't support deleting changelog attributes */
+ } else if (mods[i]->mod_values == NULL) {
+ *returncode = LDAP_UNWILLING_TO_PERFORM;
+ if (returntext) {
+ PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE,
+ "%s: no value provided",
+ mods[i]->mod_type ? mods[i]->mod_type :
"<unknown attribute>");
+ }
+ goto done;
} else {
int j;
for (j = 0; ((mods[i]->mod_values[j]) && (LDAP_SUCCESS == rc));
j++) {
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.