Branch '389-ds-base-1.3.4' - 2 commits - dirsrvtests/tickets ldap/servers
by Noriko Hosoi
dirsrvtests/tickets/ticket48226_test.py | 239 ++++++++++++++++++++++++++++++++
ldap/servers/slapd/valueset.c | 5
2 files changed, 242 insertions(+), 2 deletions(-)
New commits:
commit 8600a5eabc78848ad1bf0a9c2014823d0cd6cedc
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Thu Jul 16 10:41:53 2015 -0700
Ticket #48226 - CI test: added test cases for ticket 48226
Description: In MMR, double free coould occur under some special condition
This test script was written by thierry bordaz <tbordaz(a)redhat.com>.
A small modification to check the memory leak was added.
(cherry picked from commit f5d24450477f8341261c3e5cb5c54ec1ab83328f)
diff --git a/dirsrvtests/tickets/ticket48226_test.py b/dirsrvtests/tickets/ticket48226_test.py
new file mode 100644
index 0000000..87814e7
--- /dev/null
+++ b/dirsrvtests/tickets/ticket48226_test.py
@@ -0,0 +1,239 @@
+# --- BEGIN COPYRIGHT BLOCK ---
+# Copyright (C) 2015 Red Hat, Inc.
+# All rights reserved.
+#
+# License: GPL (version 3 or any later version).
+# See LICENSE for details.
+# --- END COPYRIGHT BLOCK ---
+#
+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
+
+
+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
+ os.environ['USE_VALGRIND'] = '1'
+ if installation1_prefix:
+ args_instance[SER_DEPLOYED_DIR] = installation1_prefix
+
+ # Creating master 1...
+ master1 = DirSrv(verbose=False)
+ if installation1_prefix:
+ args_instance[SER_DEPLOYED_DIR] = installation1_prefix
+ 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=SUFFIX, role=REPLICAROLE_MASTER, replicaId=REPLICAID_MASTER_1)
+
+ # Creating master 2...
+ master2 = DirSrv(verbose=False)
+ if installation1_prefix:
+ args_instance[SER_DEPLOYED_DIR] = installation1_prefix
+ 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=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]}
+ m1_m2_agmt = master1.agreement.create(suffix=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=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(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_ticket11111_set_purgedelay(topology):
+ args = {REPLICA_PURGE_DELAY: '5',
+ REPLICA_PURGE_INTERVAL: '5'}
+ try:
+ topology.master1.replica.setProperties(DEFAULT_SUFFIX, None, None, args)
+ except:
+ log.fatal('Failed to configure replica')
+ assert False
+ try:
+ topology.master2.replica.setProperties(DEFAULT_SUFFIX, None, None, args)
+ except:
+ log.fatal('Failed to configure replica')
+ assert False
+ topology.master1.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE, 'nsslapd-auditlog-logging-enabled', 'on')])
+ topology.master2.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE, 'nsslapd-auditlog-logging-enabled', 'on')])
+ topology.master1.restart(10)
+ topology.master2.restart(10)
+
+
+def test_ticket11111_1(topology):
+ name = 'test_entry'
+ dn = "cn=%s,%s" % (name, SUFFIX)
+
+ topology.master1.add_s(Entry((dn , {
+ 'objectclass': "top person".split(),
+ 'sn': name,
+ 'cn': name})))
+
+ # First do an update that is replicated
+ mods = [(ldap.MOD_ADD, 'description', '5')]
+ topology.master1.modify_s(dn, mods)
+
+ nbtry = 0
+ while (nbtry <= 10):
+ try:
+ ent = topology.master2.getEntry(dn, ldap.SCOPE_BASE, "(objectclass=*)", ['description'])
+ if ent.hasAttr('description') and ent.getValue('description') == '5':
+ break
+ except ldap.NO_SUCH_OBJECT:
+ pass
+ nbtry = nbtry + 1
+ time.sleep(1)
+ assert nbtry <= 10
+
+ # Stop M2 so that it will not receive the next update
+ topology.master2.stop(10)
+
+ # ADD a new value that is not replicated
+ mods = [(ldap.MOD_DELETE, 'description', '5')]
+ topology.master1.modify_s(dn, mods)
+
+ # Stop M1 so that it will keep del '5' that is unknown from master2
+ topology.master1.stop(10)
+
+ # Get the sbin directory so we know where to replace 'ns-slapd'
+ sbin_dir = get_sbin_dir(prefix=topology.master2.prefix)
+
+ # Enable valgrind
+ valgrind_enable(sbin_dir)
+
+ # start M2 to do the next updates
+ topology.master2.start(10)
+
+ # ADD 'description' by '5'
+ mods = [(ldap.MOD_DELETE, 'description', '5')]
+ topology.master2.modify_s(dn, mods)
+
+ # DEL 'description' by '5'
+ mods = [(ldap.MOD_ADD, 'description', '5')]
+ topology.master2.modify_s(dn, mods)
+
+ # sleep of purgedelay so that the next update will purge the CSN_7
+ time.sleep(6)
+
+ # ADD 'description' by '8' that purge the state info
+ mods = [(ldap.MOD_ADD, 'description', '6')]
+ topology.master2.modify_s(dn, mods)
+
+ if valgrind_check_leak(topology.master2, 'csnset_dup'):
+ log.error('test_csnset_dup: Memory leak is present!')
+ else:
+ log.info('test_csnset_dup: No leak is present!')
+
+ if valgrind_check_leak(topology.master2, 'Invalid'):
+ log.info('Valgrind reported invalid!')
+ else:
+ log.info('Valgrind is happy!')
+
+ #log.info("You can attach yourself")
+ #time.sleep(60)
+
+ # Enable valgrind
+ valgrind_disable(sbin_dir)
+
+ topology.master1.start(10)
+
+
+def test_ticket11111_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_ticket11111_set_purgedelay(topo)
+ test_ticket11111_1(topo)
+
+
+if __name__ == '__main__':
+ run_isolated()
+
commit bdbc81e62eb8d7b8dfb298c7ba983cf86353fe66
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Thu Jul 16 10:34:47 2015 -0700
Ticket #48226 - In MMR, double free coould occur under some special condition
Bug description:
In a replicated topology, a authenticated user that have write access
on an entry can send a series of operations that crash the server.
The crash is due to an access to a already freed buffer.
Fix description:
To avoid the double free, duplicate a CSNSet and assign it to the
Slapi_Value.
https://fedorahosted.org/389/ticket/48226
Reviewed by rmeggins(a)redhat.com (Thank you, Rich!!)
(cherry picked from commit a0f8e0f981a046882db299a7a6d6d1c01bc19571)
diff --git a/ldap/servers/slapd/valueset.c b/ldap/servers/slapd/valueset.c
index 0cf3ded..7eabb82 100644
--- a/ldap/servers/slapd/valueset.c
+++ b/ldap/servers/slapd/valueset.c
@@ -1415,8 +1415,9 @@ valueset_update_csn_for_valuearray_ext(Slapi_ValueSet *vs, const Slapi_Attr *a,
if(v)
{
value_update_csn(v,t,csn);
- if (csnref_updated)
- valuestoupdate[i]->v_csnset = (CSNSet *)value_get_csnset(v);
+ if (csnref_updated) {
+ valuestoupdate[i]->v_csnset = csnset_dup(value_get_csnset(v));
+ }
valuearrayfast_add_value_passin(&vaf_valuesupdated,valuestoupdate[i]);
valuestoupdate[i]= NULL;
del_count++;
8 years, 9 months
2 commits - dirsrvtests/tickets ldap/servers
by Noriko Hosoi
dirsrvtests/tickets/ticket48226_test.py | 239 ++++++++++++++++++++++++++++++++
ldap/servers/slapd/valueset.c | 5
2 files changed, 242 insertions(+), 2 deletions(-)
New commits:
commit f5d24450477f8341261c3e5cb5c54ec1ab83328f
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Thu Jul 16 10:41:53 2015 -0700
Ticket #48226 - CI test: added test cases for ticket 48226
Description: In MMR, double free coould occur under some special condition
This test script was written by thierry bordaz <tbordaz(a)redhat.com>.
A small modification to check the memory leak was added.
diff --git a/dirsrvtests/tickets/ticket48226_test.py b/dirsrvtests/tickets/ticket48226_test.py
new file mode 100644
index 0000000..87814e7
--- /dev/null
+++ b/dirsrvtests/tickets/ticket48226_test.py
@@ -0,0 +1,239 @@
+# --- BEGIN COPYRIGHT BLOCK ---
+# Copyright (C) 2015 Red Hat, Inc.
+# All rights reserved.
+#
+# License: GPL (version 3 or any later version).
+# See LICENSE for details.
+# --- END COPYRIGHT BLOCK ---
+#
+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
+
+
+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
+ os.environ['USE_VALGRIND'] = '1'
+ if installation1_prefix:
+ args_instance[SER_DEPLOYED_DIR] = installation1_prefix
+
+ # Creating master 1...
+ master1 = DirSrv(verbose=False)
+ if installation1_prefix:
+ args_instance[SER_DEPLOYED_DIR] = installation1_prefix
+ 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=SUFFIX, role=REPLICAROLE_MASTER, replicaId=REPLICAID_MASTER_1)
+
+ # Creating master 2...
+ master2 = DirSrv(verbose=False)
+ if installation1_prefix:
+ args_instance[SER_DEPLOYED_DIR] = installation1_prefix
+ 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=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]}
+ m1_m2_agmt = master1.agreement.create(suffix=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=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(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_ticket11111_set_purgedelay(topology):
+ args = {REPLICA_PURGE_DELAY: '5',
+ REPLICA_PURGE_INTERVAL: '5'}
+ try:
+ topology.master1.replica.setProperties(DEFAULT_SUFFIX, None, None, args)
+ except:
+ log.fatal('Failed to configure replica')
+ assert False
+ try:
+ topology.master2.replica.setProperties(DEFAULT_SUFFIX, None, None, args)
+ except:
+ log.fatal('Failed to configure replica')
+ assert False
+ topology.master1.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE, 'nsslapd-auditlog-logging-enabled', 'on')])
+ topology.master2.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE, 'nsslapd-auditlog-logging-enabled', 'on')])
+ topology.master1.restart(10)
+ topology.master2.restart(10)
+
+
+def test_ticket11111_1(topology):
+ name = 'test_entry'
+ dn = "cn=%s,%s" % (name, SUFFIX)
+
+ topology.master1.add_s(Entry((dn , {
+ 'objectclass': "top person".split(),
+ 'sn': name,
+ 'cn': name})))
+
+ # First do an update that is replicated
+ mods = [(ldap.MOD_ADD, 'description', '5')]
+ topology.master1.modify_s(dn, mods)
+
+ nbtry = 0
+ while (nbtry <= 10):
+ try:
+ ent = topology.master2.getEntry(dn, ldap.SCOPE_BASE, "(objectclass=*)", ['description'])
+ if ent.hasAttr('description') and ent.getValue('description') == '5':
+ break
+ except ldap.NO_SUCH_OBJECT:
+ pass
+ nbtry = nbtry + 1
+ time.sleep(1)
+ assert nbtry <= 10
+
+ # Stop M2 so that it will not receive the next update
+ topology.master2.stop(10)
+
+ # ADD a new value that is not replicated
+ mods = [(ldap.MOD_DELETE, 'description', '5')]
+ topology.master1.modify_s(dn, mods)
+
+ # Stop M1 so that it will keep del '5' that is unknown from master2
+ topology.master1.stop(10)
+
+ # Get the sbin directory so we know where to replace 'ns-slapd'
+ sbin_dir = get_sbin_dir(prefix=topology.master2.prefix)
+
+ # Enable valgrind
+ valgrind_enable(sbin_dir)
+
+ # start M2 to do the next updates
+ topology.master2.start(10)
+
+ # ADD 'description' by '5'
+ mods = [(ldap.MOD_DELETE, 'description', '5')]
+ topology.master2.modify_s(dn, mods)
+
+ # DEL 'description' by '5'
+ mods = [(ldap.MOD_ADD, 'description', '5')]
+ topology.master2.modify_s(dn, mods)
+
+ # sleep of purgedelay so that the next update will purge the CSN_7
+ time.sleep(6)
+
+ # ADD 'description' by '8' that purge the state info
+ mods = [(ldap.MOD_ADD, 'description', '6')]
+ topology.master2.modify_s(dn, mods)
+
+ if valgrind_check_leak(topology.master2, 'csnset_dup'):
+ log.error('test_csnset_dup: Memory leak is present!')
+ else:
+ log.info('test_csnset_dup: No leak is present!')
+
+ if valgrind_check_leak(topology.master2, 'Invalid'):
+ log.info('Valgrind reported invalid!')
+ else:
+ log.info('Valgrind is happy!')
+
+ #log.info("You can attach yourself")
+ #time.sleep(60)
+
+ # Enable valgrind
+ valgrind_disable(sbin_dir)
+
+ topology.master1.start(10)
+
+
+def test_ticket11111_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_ticket11111_set_purgedelay(topo)
+ test_ticket11111_1(topo)
+
+
+if __name__ == '__main__':
+ run_isolated()
+
commit a0f8e0f981a046882db299a7a6d6d1c01bc19571
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Thu Jul 16 10:34:47 2015 -0700
Ticket #48226 - In MMR, double free coould occur under some special condition
Bug description:
In a replicated topology, a authenticated user that have write access
on an entry can send a series of operations that crash the server.
The crash is due to an access to a already freed buffer.
Fix description:
To avoid the double free, duplicate a CSNSet and assign it to the
Slapi_Value.
https://fedorahosted.org/389/ticket/48226
Reviewed by rmeggins(a)redhat.com (Thank you, Rich!!)
diff --git a/ldap/servers/slapd/valueset.c b/ldap/servers/slapd/valueset.c
index 0cf3ded..7eabb82 100644
--- a/ldap/servers/slapd/valueset.c
+++ b/ldap/servers/slapd/valueset.c
@@ -1415,8 +1415,9 @@ valueset_update_csn_for_valuearray_ext(Slapi_ValueSet *vs, const Slapi_Attr *a,
if(v)
{
value_update_csn(v,t,csn);
- if (csnref_updated)
- valuestoupdate[i]->v_csnset = (CSNSet *)value_get_csnset(v);
+ if (csnref_updated) {
+ valuestoupdate[i]->v_csnset = csnset_dup(value_get_csnset(v));
+ }
valuearrayfast_add_value_passin(&vaf_valuesupdated,valuestoupdate[i]);
valuestoupdate[i]= NULL;
del_count++;
8 years, 9 months
Branch '389-ds-base-1.3.3' - rpm/389-ds-base.spec.in
by Richard Allen Megginson
rpm/389-ds-base.spec.in | 3 ---
1 file changed, 3 deletions(-)
New commits:
commit 07043862bfbd7b202d9f90c6df24b1a9bb0615f3
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Thu Jul 16 09:06:45 2015 -0600
Ticket #48224 - redux - logconv.pl should handle *.tar.xz, *.txz, *.xz log files
https://fedorahosted.org/389/ticket/48224
Reviewed by:
Branch: master
Fix Description: Fix Requires: in spec file
Platforms tested: Fedora 21, RHEL 7.2 candidate
Flag Day: no
Doc impact: no
(cherry picked from commit 193d79d4a459b709c5a55cea88794105fa60c453)
(cherry picked from commit 9109a570edd3ddb58434b19a9fca2f7c021b18ca)
diff --git a/rpm/389-ds-base.spec.in b/rpm/389-ds-base.spec.in
index 3b7c072..17a1f86 100644
--- a/rpm/389-ds-base.spec.in
+++ b/rpm/389-ds-base.spec.in
@@ -110,9 +110,6 @@ Requires: perl-Socket6
Requires: perl-Socket
%endif
Requires: perl-NetAddr-IP
-# for logconv compressed file support
-Requires: perl-IO-Compress
-Requires: perl-IO-Compress-Lzma
Source0: http://port389.org/sources/%{name}-%{version}%{?prerel}.tar.bz2
# 389-ds-git.sh should be used to generate the source tarball from git
8 years, 9 months
Branch '389-ds-base-1.3.4' - rpm/389-ds-base.spec.in
by Richard Allen Megginson
rpm/389-ds-base.spec.in | 3 ---
1 file changed, 3 deletions(-)
New commits:
commit 9109a570edd3ddb58434b19a9fca2f7c021b18ca
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Thu Jul 16 09:06:45 2015 -0600
Ticket #48224 - redux - logconv.pl should handle *.tar.xz, *.txz, *.xz log files
https://fedorahosted.org/389/ticket/48224
Reviewed by:
Branch: master
Fix Description: Fix Requires: in spec file
Platforms tested: Fedora 21, RHEL 7.2 candidate
Flag Day: no
Doc impact: no
(cherry picked from commit 193d79d4a459b709c5a55cea88794105fa60c453)
diff --git a/rpm/389-ds-base.spec.in b/rpm/389-ds-base.spec.in
index 5c64bd7..64541f1 100644
--- a/rpm/389-ds-base.spec.in
+++ b/rpm/389-ds-base.spec.in
@@ -121,9 +121,6 @@ Requires: perl-Socket6
Requires: perl-Socket
%endif
Requires: perl-NetAddr-IP
-# for logconv compressed file support
-Requires: perl-IO-Compress
-Requires: perl-IO-Compress-Lzma
Source0: http://port389.org/sources/%{name}-%{version}%{?prerel}.tar.bz2
# 389-ds-git.sh should be used to generate the source tarball from git
8 years, 9 months
rpm/389-ds-base.spec.in
by Richard Allen Megginson
rpm/389-ds-base.spec.in | 3 ---
1 file changed, 3 deletions(-)
New commits:
commit 193d79d4a459b709c5a55cea88794105fa60c453
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Thu Jul 16 09:06:45 2015 -0600
Ticket #48224 - redux - logconv.pl should handle *.tar.xz, *.txz, *.xz log files
https://fedorahosted.org/389/ticket/48224
Reviewed by:
Branch: master
Fix Description: Fix Requires: in spec file
Platforms tested: Fedora 21, RHEL 7.2 candidate
Flag Day: no
Doc impact: no
diff --git a/rpm/389-ds-base.spec.in b/rpm/389-ds-base.spec.in
index 5c64bd7..64541f1 100644
--- a/rpm/389-ds-base.spec.in
+++ b/rpm/389-ds-base.spec.in
@@ -121,9 +121,6 @@ Requires: perl-Socket6
Requires: perl-Socket
%endif
Requires: perl-NetAddr-IP
-# for logconv compressed file support
-Requires: perl-IO-Compress
-Requires: perl-IO-Compress-Lzma
Source0: http://port389.org/sources/%{name}-%{version}%{?prerel}.tar.bz2
# 389-ds-git.sh should be used to generate the source tarball from git
8 years, 9 months
ldap/admin
by Richard Allen Megginson
ldap/admin/src/logconv.pl | 73 +++++++++++++++++++++++++++++++++++-----------
1 file changed, 57 insertions(+), 16 deletions(-)
New commits:
commit ae5b62f53557c8ce2d174999c4b561ebc4ccde55
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Wed Jul 15 14:09:24 2015 -0600
Ticket #48224 - redux - logconv.pl should handle *.tar.xz, *.txz, *.xz log files
https://fedorahosted.org/389/ticket/48224
Reviewed by: nhosoi, mreynolds (Thanks!)
Branch: master
Fix Description: Some platforms have no IO::Uncompress::UnXz, so have
to pipe out to the 'xz' command for uncompression.
Doing the 'xz' pipe will not work with compressed xz files in tar
archives, so issue an appropriate error.
The tar archive file handling was wrong - have to wrap the data in a
filehandle before passing to uncompress.
Added a lot of error checking - trying to uncompress plain text files,
trying to untar non-tar archives, trying to untar and uncompress a
tar file that is not compressed, other weird stuff like specifying a
.bz2 extension on a file compressed with .xz.
This will also need a spec file change:
Requires: perl-IO-Compress
Requires: perl-DB_File
Requires: perl-Archive-Tar
Requires: xz
Platforms tested: Fedora 21, RHEL 7.2 candidate
Flag Day: no
Doc impact: no
diff --git a/ldap/admin/src/logconv.pl b/ldap/admin/src/logconv.pl
index a6bd6c2..d26e91e 100755
--- a/ldap/admin/src/logconv.pl
+++ b/ldap/admin/src/logconv.pl
@@ -398,17 +398,11 @@ my $totalLineCount = 0;
sub isTarArchive {
local $_ = shift;
- if (/\.txz$/ || /\.tar.xz$/) {
- use IO::Uncompress::UnXz;
- }
return /\.tar$/ || /\.tar\.bz2$/ || /\.tar.gz$/ || /\.tar.xz$/ || /\.tgz$/ || /\.tbz$/ || /\.txz$/;
}
sub isCompressed {
local $_ = shift;
- if (/\.xz$/) {
- use IO::Uncompress::UnXz;
- }
return /\.gz$/ || /\.bz2$/ || /\.xz$/;
}
@@ -418,6 +412,43 @@ sub tarNeedsUncompress {
return /\.tar.xz$/ || /\.txz$/;
}
+# rhel7 can't grok xz
+sub doUncompress {
+ local $_ = shift;
+ my $data = shift;
+ my $TARFH;
+ # some platforms don't have xz support in IO::Uncompress::AnyUncompress
+ if (/\.tar.xz$/ || /\.txz$/ || /\.xz$/) {
+ if ($data) {
+ openFailed("Cannot read from compressed xz file in tar archive.\nPlease un-tar the tar file first, then pass individual .xz files to this program.\n", $_);
+ }
+ # so use the xz command directly
+ # NOTE: This doesn't work if the argument is a file handle e.g. from
+ # Archive::Tar
+ $! = 0; # clear
+ if (!open($TARFH, "xz -dc $_ |") or $!) {
+ openFailed($!, $_);
+ return;
+ }
+ } else {
+ my $uncompressthing;
+ if ($data) {
+ # make a filehandle object from data
+ open($uncompressthing, "<", \$data) or openFailed($!, $_);
+ } else {
+ # just read from the file
+ $uncompressthing = $_;
+ }
+ $TARFH = new IO::Uncompress::AnyUncompress $uncompressthing or
+ do { openFailed($AnyUncompressError, $_); return; };
+ if (*$TARFH->{Plain}) {
+ openFailed("Unknown compression", $_);
+ return;
+ }
+ }
+ return $TARFH;
+}
+
sub convertTimeToSeconds {
my $log_line = shift;
@@ -497,6 +528,10 @@ for (my $count=0; $count < $file_count; $count++){
if($logCount > 1 && $count == 0 && $skipFirstFile == 1){
next;
}
+ if (! -r $logname) {
+ print "File not found: $logname\n";
+ next;
+ }
$linesProcessed = 0; $lineBlockCount = 0;
my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$atime,$mtime,$ctime,$blksize,$blocks);
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$cursize,
@@ -513,11 +548,12 @@ for (my $count=0; $count < $file_count; $count++){
my $tariter = 0;
my $tarfile = 0;
my $comp = 0;
+ $LOGFH = undef;
if (isTarArchive($logname)) {
$tar = Archive::Tar->new();
if (tarNeedsUncompress($logname)) {
- my $TARFH = new IO::Uncompress::AnyUncompress $logname or
- do { openFailed($AnyUncompressError, $logname); next };
+ my $TARFH = doUncompress($logname);
+ next if (!$TARFH);
$tariter = Archive::Tar->iter($TARFH);
} else {
$tariter = Archive::Tar->iter($logname);
@@ -540,24 +576,21 @@ for (my $count=0; $count < $file_count; $count++){
next;
}
if (isCompressed($tarfile->name)) {
- $LOGFH = new IO::Uncompress::AnyUncompress \$tarfile->name or
- do { openFailed($AnyUncompressError, $logname); next };
+ $LOGFH = doUncompress($tarfile->name, $tarfile->get_content);
+ next if (!$LOGFH);
# no way in general to know how big the uncompressed file is - so
# assume a factor of 10 inflation - only used for progress reporting
$cursize *= 10;
} else {
- open(LOG,"<",\$tarfile->data) or do { openFailed($!, $tarfile->name) ; next };
- $LOGFH = \*LOG;
+ open($LOGFH,"<",\$tarfile->data) or do { openFailed($!, $tarfile->name) ; next };
}
} elsif ($comp) {
- $LOGFH = new IO::Uncompress::AnyUncompress $logname or
- do { openFailed($AnyUncompressError, $logname); next };
+ $LOGFH = doUncompress($logname);
# no way in general to know how big the uncompressed file is - so
# assume a factor of 10 inflation - only used for progress reporting
$cursize *= 10;
} else {
- open(LOG,$logname) or do { openFailed($!, $logname); next };
- $LOGFH = \*LOG;
+ open($LOGFH,$logname) or do { openFailed($!, $logname); next };
}
my $firstline = "yes";
while(<$LOGFH>){
@@ -588,6 +621,14 @@ for (my $count=0; $count < $file_count; $count++){
}
last if (!$tariter);
}
+ if ($tar) {
+ if ($tar->error()) {
+ openFailed($tar->error(), $logname);
+ }
+ if ($Archive::Tar::error) {
+ openFailed($Archive::Tar::error, $logname);
+ }
+ }
}
if ($totalLineCount eq "0"){
8 years, 9 months
Branch '389-ds-base-1.3.4' - ldap/admin
by Richard Allen Megginson
ldap/admin/src/logconv.pl | 73 +++++++++++++++++++++++++++++++++++-----------
1 file changed, 57 insertions(+), 16 deletions(-)
New commits:
commit 8473ae0c49492dd7931dbdd3a8377119f53ce49b
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Wed Jul 15 14:09:24 2015 -0600
Ticket #48224 - redux - logconv.pl should handle *.tar.xz, *.txz, *.xz log files
https://fedorahosted.org/389/ticket/48224
Reviewed by: nhosoi, mreynolds (Thanks!)
Branch: 389-ds-base-1.3.4
Fix Description: Some platforms have no IO::Uncompress::UnXz, so have
to pipe out to the 'xz' command for uncompression.
Doing the 'xz' pipe will not work with compressed xz files in tar
archives, so issue an appropriate error.
The tar archive file handling was wrong - have to wrap the data in a
filehandle before passing to uncompress.
Added a lot of error checking - trying to uncompress plain text files,
trying to untar non-tar archives, trying to untar and uncompress a
tar file that is not compressed, other weird stuff like specifying a
.bz2 extension on a file compressed with .xz.
This will also need a spec file change:
Requires: perl-IO-Compress
Requires: perl-DB_File
Requires: perl-Archive-Tar
Requires: xz
Platforms tested: Fedora 21, RHEL 7.2 candidate
Flag Day: no
Doc impact: no
(cherry picked from commit ae5b62f53557c8ce2d174999c4b561ebc4ccde55)
diff --git a/ldap/admin/src/logconv.pl b/ldap/admin/src/logconv.pl
index a6bd6c2..d26e91e 100755
--- a/ldap/admin/src/logconv.pl
+++ b/ldap/admin/src/logconv.pl
@@ -398,17 +398,11 @@ my $totalLineCount = 0;
sub isTarArchive {
local $_ = shift;
- if (/\.txz$/ || /\.tar.xz$/) {
- use IO::Uncompress::UnXz;
- }
return /\.tar$/ || /\.tar\.bz2$/ || /\.tar.gz$/ || /\.tar.xz$/ || /\.tgz$/ || /\.tbz$/ || /\.txz$/;
}
sub isCompressed {
local $_ = shift;
- if (/\.xz$/) {
- use IO::Uncompress::UnXz;
- }
return /\.gz$/ || /\.bz2$/ || /\.xz$/;
}
@@ -418,6 +412,43 @@ sub tarNeedsUncompress {
return /\.tar.xz$/ || /\.txz$/;
}
+# rhel7 can't grok xz
+sub doUncompress {
+ local $_ = shift;
+ my $data = shift;
+ my $TARFH;
+ # some platforms don't have xz support in IO::Uncompress::AnyUncompress
+ if (/\.tar.xz$/ || /\.txz$/ || /\.xz$/) {
+ if ($data) {
+ openFailed("Cannot read from compressed xz file in tar archive.\nPlease un-tar the tar file first, then pass individual .xz files to this program.\n", $_);
+ }
+ # so use the xz command directly
+ # NOTE: This doesn't work if the argument is a file handle e.g. from
+ # Archive::Tar
+ $! = 0; # clear
+ if (!open($TARFH, "xz -dc $_ |") or $!) {
+ openFailed($!, $_);
+ return;
+ }
+ } else {
+ my $uncompressthing;
+ if ($data) {
+ # make a filehandle object from data
+ open($uncompressthing, "<", \$data) or openFailed($!, $_);
+ } else {
+ # just read from the file
+ $uncompressthing = $_;
+ }
+ $TARFH = new IO::Uncompress::AnyUncompress $uncompressthing or
+ do { openFailed($AnyUncompressError, $_); return; };
+ if (*$TARFH->{Plain}) {
+ openFailed("Unknown compression", $_);
+ return;
+ }
+ }
+ return $TARFH;
+}
+
sub convertTimeToSeconds {
my $log_line = shift;
@@ -497,6 +528,10 @@ for (my $count=0; $count < $file_count; $count++){
if($logCount > 1 && $count == 0 && $skipFirstFile == 1){
next;
}
+ if (! -r $logname) {
+ print "File not found: $logname\n";
+ next;
+ }
$linesProcessed = 0; $lineBlockCount = 0;
my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$atime,$mtime,$ctime,$blksize,$blocks);
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$cursize,
@@ -513,11 +548,12 @@ for (my $count=0; $count < $file_count; $count++){
my $tariter = 0;
my $tarfile = 0;
my $comp = 0;
+ $LOGFH = undef;
if (isTarArchive($logname)) {
$tar = Archive::Tar->new();
if (tarNeedsUncompress($logname)) {
- my $TARFH = new IO::Uncompress::AnyUncompress $logname or
- do { openFailed($AnyUncompressError, $logname); next };
+ my $TARFH = doUncompress($logname);
+ next if (!$TARFH);
$tariter = Archive::Tar->iter($TARFH);
} else {
$tariter = Archive::Tar->iter($logname);
@@ -540,24 +576,21 @@ for (my $count=0; $count < $file_count; $count++){
next;
}
if (isCompressed($tarfile->name)) {
- $LOGFH = new IO::Uncompress::AnyUncompress \$tarfile->name or
- do { openFailed($AnyUncompressError, $logname); next };
+ $LOGFH = doUncompress($tarfile->name, $tarfile->get_content);
+ next if (!$LOGFH);
# no way in general to know how big the uncompressed file is - so
# assume a factor of 10 inflation - only used for progress reporting
$cursize *= 10;
} else {
- open(LOG,"<",\$tarfile->data) or do { openFailed($!, $tarfile->name) ; next };
- $LOGFH = \*LOG;
+ open($LOGFH,"<",\$tarfile->data) or do { openFailed($!, $tarfile->name) ; next };
}
} elsif ($comp) {
- $LOGFH = new IO::Uncompress::AnyUncompress $logname or
- do { openFailed($AnyUncompressError, $logname); next };
+ $LOGFH = doUncompress($logname);
# no way in general to know how big the uncompressed file is - so
# assume a factor of 10 inflation - only used for progress reporting
$cursize *= 10;
} else {
- open(LOG,$logname) or do { openFailed($!, $logname); next };
- $LOGFH = \*LOG;
+ open($LOGFH,$logname) or do { openFailed($!, $logname); next };
}
my $firstline = "yes";
while(<$LOGFH>){
@@ -588,6 +621,14 @@ for (my $count=0; $count < $file_count; $count++){
}
last if (!$tariter);
}
+ if ($tar) {
+ if ($tar->error()) {
+ openFailed($tar->error(), $logname);
+ }
+ if ($Archive::Tar::error) {
+ openFailed($Archive::Tar::error, $logname);
+ }
+ }
}
if ($totalLineCount eq "0"){
8 years, 9 months
Branch '389-ds-base-1.3.3' - ldap/admin
by Richard Allen Megginson
ldap/admin/src/logconv.pl | 73 +++++++++++++++++++++++++++++++++++-----------
1 file changed, 57 insertions(+), 16 deletions(-)
New commits:
commit 971dc4808dceee80f601b216291a50260581b12f
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Wed Jul 15 14:09:24 2015 -0600
Ticket #48224 - redux - logconv.pl should handle *.tar.xz, *.txz, *.xz log files
https://fedorahosted.org/389/ticket/48224
Reviewed by: nhosoi, mreynolds (Thanks!)
Branch: 389-ds-base-1.3.3
Fix Description: Some platforms have no IO::Uncompress::UnXz, so have
to pipe out to the 'xz' command for uncompression.
Doing the 'xz' pipe will not work with compressed xz files in tar
archives, so issue an appropriate error.
The tar archive file handling was wrong - have to wrap the data in a
filehandle before passing to uncompress.
Added a lot of error checking - trying to uncompress plain text files,
trying to untar non-tar archives, trying to untar and uncompress a
tar file that is not compressed, other weird stuff like specifying a
.bz2 extension on a file compressed with .xz.
This will also need a spec file change:
Requires: perl-IO-Compress
Requires: perl-DB_File
Requires: perl-Archive-Tar
Requires: xz
Platforms tested: Fedora 21, RHEL 7.2 candidate
Flag Day: no
Doc impact: no
(cherry picked from commit ae5b62f53557c8ce2d174999c4b561ebc4ccde55)
(cherry picked from commit 8473ae0c49492dd7931dbdd3a8377119f53ce49b)
Conflicts:
ldap/admin/src/logconv.pl
diff --git a/ldap/admin/src/logconv.pl b/ldap/admin/src/logconv.pl
index daff276..4842ec7 100755
--- a/ldap/admin/src/logconv.pl
+++ b/ldap/admin/src/logconv.pl
@@ -424,17 +424,11 @@ my $totalLineCount = 0;
sub isTarArchive {
local $_ = shift;
- if (/\.txz$/ || /\.tar.xz$/) {
- use IO::Uncompress::UnXz;
- }
return /\.tar$/ || /\.tar\.bz2$/ || /\.tar.gz$/ || /\.tar.xz$/ || /\.tgz$/ || /\.tbz$/ || /\.txz$/;
}
sub isCompressed {
local $_ = shift;
- if (/\.xz$/) {
- use IO::Uncompress::UnXz;
- }
return /\.gz$/ || /\.bz2$/ || /\.xz$/;
}
@@ -444,6 +438,43 @@ sub tarNeedsUncompress {
return /\.tar.xz$/ || /\.txz$/;
}
+# rhel7 can't grok xz
+sub doUncompress {
+ local $_ = shift;
+ my $data = shift;
+ my $TARFH;
+ # some platforms don't have xz support in IO::Uncompress::AnyUncompress
+ if (/\.tar.xz$/ || /\.txz$/ || /\.xz$/) {
+ if ($data) {
+ openFailed("Cannot read from compressed xz file in tar archive.\nPlease un-tar the tar file first, then pass individual .xz files to this program.\n", $_);
+ }
+ # so use the xz command directly
+ # NOTE: This doesn't work if the argument is a file handle e.g. from
+ # Archive::Tar
+ $! = 0; # clear
+ if (!open($TARFH, "xz -dc $_ |") or $!) {
+ openFailed($!, $_);
+ return;
+ }
+ } else {
+ my $uncompressthing;
+ if ($data) {
+ # make a filehandle object from data
+ open($uncompressthing, "<", \$data) or openFailed($!, $_);
+ } else {
+ # just read from the file
+ $uncompressthing = $_;
+ }
+ $TARFH = new IO::Uncompress::AnyUncompress $uncompressthing or
+ do { openFailed($AnyUncompressError, $_); return; };
+ if (*$TARFH->{Plain}) {
+ openFailed("Unknown compression", $_);
+ return;
+ }
+ }
+ return $TARFH;
+}
+
$Archive::Tar::WARN = 0; # so new will shut up when reading a regular file
for (my $count=0; $count < $file_count; $count++){
my $logname = $files[$count];
@@ -451,6 +482,10 @@ for (my $count=0; $count < $file_count; $count++){
if($logCount > 1 && $count == 0 && $skipFirstFile == 1){
next;
}
+ if (! -r $logname) {
+ print "File not found: $logname\n";
+ next;
+ }
$linesProcessed = 0; $lineBlockCount = 0;
my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$atime,$mtime,$ctime,$blksize,$blocks);
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$cursize,
@@ -467,11 +502,12 @@ for (my $count=0; $count < $file_count; $count++){
my $tariter = 0;
my $tarfile = 0;
my $comp = 0;
+ $LOGFH = undef;
if (isTarArchive($logname)) {
$tar = Archive::Tar->new();
if (tarNeedsUncompress($logname)) {
- my $TARFH = new IO::Uncompress::AnyUncompress $logname or
- do { openFailed($AnyUncompressError, $logname); next };
+ my $TARFH = doUncompress($logname);
+ next if (!$TARFH);
$tariter = Archive::Tar->iter($TARFH);
} else {
$tariter = Archive::Tar->iter($logname);
@@ -494,24 +530,21 @@ for (my $count=0; $count < $file_count; $count++){
next;
}
if (isCompressed($tarfile->name)) {
- $LOGFH = new IO::Uncompress::AnyUncompress \$tarfile->name or
- do { openFailed($AnyUncompressError, $logname); next };
+ $LOGFH = doUncompress($tarfile->name, $tarfile->get_content);
+ next if (!$LOGFH);
# no way in general to know how big the uncompressed file is - so
# assume a factor of 10 inflation - only used for progress reporting
$cursize *= 10;
} else {
- open(LOG,"<",\$tarfile->data) or do { openFailed($!, $tarfile->name) ; next };
- $LOGFH = \*LOG;
+ open($LOGFH,"<",\$tarfile->data) or do { openFailed($!, $tarfile->name) ; next };
}
} elsif ($comp) {
- $LOGFH = new IO::Uncompress::AnyUncompress $logname or
- do { openFailed($AnyUncompressError, $logname); next };
+ $LOGFH = doUncompress($logname);
# no way in general to know how big the uncompressed file is - so
# assume a factor of 10 inflation - only used for progress reporting
$cursize *= 10;
} else {
- open(LOG,$logname) or do { openFailed($!, $logname); next };
- $LOGFH = \*LOG;
+ open($LOGFH,$logname) or do { openFailed($!, $logname); next };
}
my $firstline = "yes";
while(<$LOGFH>){
@@ -542,6 +575,14 @@ for (my $count=0; $count < $file_count; $count++){
}
last if (!$tariter);
}
+ if ($tar) {
+ if ($tar->error()) {
+ openFailed($tar->error(), $logname);
+ }
+ if ($Archive::Tar::error) {
+ openFailed($Archive::Tar::error, $logname);
+ }
+ }
}
if ($totalLineCount eq "0"){
8 years, 9 months
Branch '389-ds-base-1.3.4' - ldap/servers
by Noriko Hosoi
ldap/servers/slapd/tools/ldclt/threadMain.c | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
New commits:
commit 6ec1001e507908ba60f8c52568d24b5c7c727855
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Jul 14 16:00:03 2015 -0700
Ticket #48203 - Fix coverity issues - 07/14/2015
Description: Overrunning array "mctx.negativeErrors" of 19 4-byte
elements at element index 122 (byte offset 488) using index "abs(err)"
(which evaluates to 122).
Commit 71be5faaa478593bb056887410ca8e48e05b2fe4 to fix Ticket #47799
introduced this problem. The error count checking has to be done per
error.
https://fedorahosted.org/389/ticket/48203
Reviewed by rmeggins(a)redhat.com (Thank you, Rich!)
(cherry picked from commit cc435b8c382f7da662b5c27339d23fd33a8f4117)
diff --git a/ldap/servers/slapd/tools/ldclt/threadMain.c b/ldap/servers/slapd/tools/ldclt/threadMain.c
index 5d915fd..88353c6 100644
--- a/ldap/servers/slapd/tools/ldclt/threadMain.c
+++ b/ldap/servers/slapd/tools/ldclt/threadMain.c
@@ -477,7 +477,7 @@ addErrorStat (
#else
if ((err <= 0) || (err >= MAX_ERROR_NB))
#endif
- {
+ {
if (mctx.errorsBad > mctx.maxErrors) {
printf ("ldclt[%d]: Max error limit reached - exiting.\n", mctx.pid);
(void) printGlobalStatistics(); /*JLS 25-08-00*/
@@ -485,8 +485,22 @@ addErrorStat (
ldclt_sleep (5);
ldcltExit (EXIT_MAX_ERRORS); /*JLS 25-08-00*/
}
- } else {
- if (mctx.errors[err] + mctx.negativeErrors[abs(err)] > mctx.maxErrors) {
+ }
+#if defined(USE_OPENLDAP)
+ else if (err < 0)
+ {
+ if (mctx.negativeErrors[abs(err)] > mctx.maxErrors) {
+ printf ("ldclt[%d]: Max error limit reached - exiting.\n", mctx.pid);
+ (void) printGlobalStatistics(); /*JLS 25-08-00*/
+ fflush (stdout);
+ ldclt_sleep (5);
+ ldcltExit (EXIT_MAX_ERRORS); /*JLS 25-08-00*/
+ }
+ }
+#endif
+ else
+ {
+ if (mctx.errors[err] > mctx.maxErrors) {
printf ("ldclt[%d]: Max error limit reached - exiting.\n", mctx.pid);
(void) printGlobalStatistics(); /*JLS 25-08-00*/
fflush (stdout);
8 years, 9 months
ldap/servers
by Noriko Hosoi
ldap/servers/slapd/tools/ldclt/threadMain.c | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
New commits:
commit cc435b8c382f7da662b5c27339d23fd33a8f4117
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Jul 14 16:00:03 2015 -0700
Ticket #48203 - Fix coverity issues - 07/14/2015
Description: Overrunning array "mctx.negativeErrors" of 19 4-byte
elements at element index 122 (byte offset 488) using index "abs(err)"
(which evaluates to 122).
Commit 71be5faaa478593bb056887410ca8e48e05b2fe4 to fix Ticket #47799
introduced this problem. The error count checking has to be done per
error.
https://fedorahosted.org/389/ticket/48203
Reviewed by rmeggins(a)redhat.com (Thank you, Rich!)
diff --git a/ldap/servers/slapd/tools/ldclt/threadMain.c b/ldap/servers/slapd/tools/ldclt/threadMain.c
index 5d915fd..88353c6 100644
--- a/ldap/servers/slapd/tools/ldclt/threadMain.c
+++ b/ldap/servers/slapd/tools/ldclt/threadMain.c
@@ -477,7 +477,7 @@ addErrorStat (
#else
if ((err <= 0) || (err >= MAX_ERROR_NB))
#endif
- {
+ {
if (mctx.errorsBad > mctx.maxErrors) {
printf ("ldclt[%d]: Max error limit reached - exiting.\n", mctx.pid);
(void) printGlobalStatistics(); /*JLS 25-08-00*/
@@ -485,8 +485,22 @@ addErrorStat (
ldclt_sleep (5);
ldcltExit (EXIT_MAX_ERRORS); /*JLS 25-08-00*/
}
- } else {
- if (mctx.errors[err] + mctx.negativeErrors[abs(err)] > mctx.maxErrors) {
+ }
+#if defined(USE_OPENLDAP)
+ else if (err < 0)
+ {
+ if (mctx.negativeErrors[abs(err)] > mctx.maxErrors) {
+ printf ("ldclt[%d]: Max error limit reached - exiting.\n", mctx.pid);
+ (void) printGlobalStatistics(); /*JLS 25-08-00*/
+ fflush (stdout);
+ ldclt_sleep (5);
+ ldcltExit (EXIT_MAX_ERRORS); /*JLS 25-08-00*/
+ }
+ }
+#endif
+ else
+ {
+ if (mctx.errors[err] > mctx.maxErrors) {
printf ("ldclt[%d]: Max error limit reached - exiting.\n", mctx.pid);
(void) printGlobalStatistics(); /*JLS 25-08-00*/
fflush (stdout);
8 years, 9 months