!2 update to 2.0.8

Merge pull request !2 from Anonymous_Z/anonymous_z
This commit is contained in:
openeuler-ci-bot 2020-02-18 15:50:48 +08:00 committed by Gitee
commit d6e49f936d
5 changed files with 102 additions and 263 deletions

View File

@ -1,60 +0,0 @@
From 04e74153057d34b5dbdbc03f47d7684b4d4c1093 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn@fedoraproject.org>
Date: Wed, 30 May 2018 23:22:40 +0200
Subject: [PATCH] ldb: Run at least some tests on 32 bit machines
lmdb is supported only on 64 bit machines. But there also
unit tests which pass just with tdb on 32 bit architectures.
Signed-off-by: Lukas Slebodnik <lslebodn@fedoraproject.org>
---
lib/ldb/wscript | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/lib/ldb/wscript b/lib/ldb/wscript
index f5cb1e0ab28dc01e5b031c7c290bed26c7007676..03279772557284d96f5b8c81ed4a8513e5c65f17 100644
--- a/wscript
+++ b/wscript
@@ -518,10 +518,6 @@ def test(ctx):
env = samba_utils.LOAD_ENVIRONMENT()
ctx.env = env
- if not env.HAVE_LMDB:
- raise Utils.WafError('make test called, but ldb was built '
- '--without-ldb-lmdb')
-
test_prefix = "%s/st" % (Utils.g_module.blddir)
shutil.rmtree(test_prefix, ignore_errors=True)
os.makedirs(test_prefix)
@@ -537,9 +533,13 @@ def test(ctx):
tmp_dir = os.path.join(test_prefix, 'tmp')
if not os.path.exists(tmp_dir):
os.mkdir(tmp_dir)
- pyret = samba_utils.RUN_PYTHON_TESTS(
- ['tests/python/api.py', 'tests/python/index.py'],
- extra_env={'SELFTEST_PREFIX': test_prefix})
+
+ if env.HAVE_LMDB:
+ pyret = samba_utils.RUN_PYTHON_TESTS(
+ ['tests/python/api.py', 'tests/python/index.py'],
+ extra_env={'SELFTEST_PREFIX': test_prefix})
+ else:
+ pyret = 0
print("Python testsuite returned %d" % pyret)
cmocka_ret = 0
@@ -549,7 +549,10 @@ def test(ctx):
'ldb_tdb_guid_mod_op_test',
'ldb_msg_test',
'ldb_tdb_kv_ops_test',
- 'ldb_tdb_test',
+ 'ldb_tdb_test']
+
+ if env.HAVE_LMDB:
+ test_exes += [
'ldb_mdb_mod_op_test',
'ldb_lmdb_test',
# we don't want to run ldb_lmdb_size_test (which proves we can
--
2.17.0

View File

@ -1,89 +0,0 @@
From f8dbb92b4ea46f86ff2fc448eb8dd989cc1efa51 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn@redhat.com>
Date: Fri, 18 Jan 2019 01:15:18 +0100
Subject: [PATCH] ldb: Out ouf bound read in ldb_wildcard_compare
There is valgrind error in few tests tests/test-generic.sh
91 echo "Test wildcard match"
92 $VALGRIND ldbadd $LDBDIR/tests/test-wildcard.ldif || exit 1
93 $VALGRIND ldbsearch '(cn=test*multi)' || exit 1
95 $VALGRIND ldbsearch '(cn=*test_multi)' || exit 1
97 $VALGRIND ldbsearch '(cn=test*multi*test*multi)' || exit 1
e.g.
==3098== Memcheck, a memory error detector
==3098== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==3098== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright info
==3098== Command: ./bin/ldbsearch (cn=test*multi)
==3098==
==3098== Invalid read of size 1
==3098== at 0x483CEE7: memchr (vg_replace_strmem.c:890)
==3098== by 0x49A9073: memmem (in /usr/lib64/libc-2.28.9000.so)
==3098== by 0x485DFE9: ldb_wildcard_compare (ldb_match.c:313)
==3098== by 0x485DFE9: ldb_match_substring (ldb_match.c:360)
==3098== by 0x485DFE9: ldb_match_message (ldb_match.c:572)
==3098== by 0x558F8FA: search_func (ldb_kv_search.c:549)
==3098== by 0x48C78CA: ??? (in /usr/lib64/libtdb.so.1.3.17)
==3098== by 0x48C7A60: tdb_traverse_read (in /usr/lib64/libtdb.so.1.3.17)
==3098== by 0x557B7C4: ltdb_traverse_fn (ldb_tdb.c:274)
==3098== by 0x558FBFA: ldb_kv_search_full (ldb_kv_search.c:594)
==3098== by 0x558FBFA: ldb_kv_search (ldb_kv_search.c:854)
==3098== by 0x558E497: ldb_kv_callback (ldb_kv.c:1713)
==3098== by 0x48FCD58: tevent_common_invoke_timer_handler (in /usr/lib64/libtevent.so.0.9.38)
==3098== by 0x48FCEFD: tevent_common_loop_timer_delay (in /usr/lib64/libtevent.so.0.9.38)
==3098== by 0x48FE14A: ??? (in /usr/lib64/libtevent.so.0.9.38)
==3098== Address 0x4b4ab81 is 0 bytes after a block of size 129 alloc'd
==3098== at 0x483880B: malloc (vg_replace_malloc.c:309)
==3098== by 0x491048B: talloc_strndup (in /usr/lib64/libtalloc.so.2.1.15)
==3098== by 0x48593CA: ldb_casefold_default (ldb_utf8.c:59)
==3098== by 0x485F68D: ldb_handler_fold (attrib_handlers.c:64)
==3098== by 0x485DB88: ldb_wildcard_compare (ldb_match.c:257)
==3098== by 0x485DB88: ldb_match_substring (ldb_match.c:360)
==3098== by 0x485DB88: ldb_match_message (ldb_match.c:572)
==3098== by 0x558F8FA: search_func (ldb_kv_search.c:549)
==3098== by 0x48C78CA: ??? (in /usr/lib64/libtdb.so.1.3.17)
==3098== by 0x48C7A60: tdb_traverse_read (in /usr/lib64/libtdb.so.1.3.17)
==3098== by 0x557B7C4: ltdb_traverse_fn (ldb_tdb.c:274)
==3098== by 0x558FBFA: ldb_kv_search_full (ldb_kv_search.c:594)
==3098== by 0x558FBFA: ldb_kv_search (ldb_kv_search.c:854)
==3098== by 0x558E497: ldb_kv_callback (ldb_kv.c:1713)
==3098== by 0x48FCD58: tevent_common_invoke_timer_handler (in /usr/lib64/libtevent.so.0.9.38)
==3098==
# record 1
dn: cn=test_multi_test_multi_test_multi,o=University of Michigan,c=TEST
cn: test_multi_test_multi_test_multi
description: test multi wildcards matching
objectclass: person
sn: multi_test
name: test_multi_test_multi_test_multi
distinguishedName: cn=test_multi_test_multi_test_multi,o=University of Michiga
n,c=TEST
# returned 1 records
# 1 entries
# 0 referrals
Signed-off-by: Lukas Slebodnik <lslebodn@fedoraproject.org>
---
common/ldb_match.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/common/ldb_match.c b/common/ldb_match.c
index 25fe3f9c21b14c23696eecd700b2170b0c3b1981..8eeedfb12e0600cdec7431a10fde8bdf9dcb2bd8 100644
--- a/common/ldb_match.c
+++ b/common/ldb_match.c
@@ -308,9 +308,10 @@ static int ldb_wildcard_compare(struct ldb_context *ldb,
if (p == NULL) goto mismatch;
if ( (! tree->u.substring.chunks[c + 1]) && (! tree->u.substring.end_with_wildcard) ) {
uint8_t *g;
+ uint8_t *end = val.data + val.length;
do { /* greedy */
g = memmem(p + cnk.length,
- val.length - (p - val.data),
+ end - (p + cnk.length),
(const uint8_t *)cnk.data,
cnk.length);
if (g) p = g;
--
2.20.1

Binary file not shown.

BIN
ldb-2.0.8.tar.gz Normal file

Binary file not shown.

View File

@ -1,158 +1,134 @@
Name: libldb
Version: 1.4.2
Release: 3
Summary: A LDAP-like embedded database
License: LGPLv3+
URL: http://ldb.samba.org/
Source: http://samba.org/ftp/ldb/ldb-%{version}.tar.gz
#Patch0001 and patch6000 are come from upstream community
Patch0001: 0002-ldb-Run-at-least-some-tests-on-32-bit-machines.patch
Patch6000: 0003-ldb-Out-ouf-bound-read-in-ldb_wildcard_compare.patch
%global with_lmdb 1
%global with_python3 1
%global talloc_version 2.2.0
%global tdb_version 1.4.1
%global tevent_version 0.10.0
BuildRequires: gcc popt-devel libxslt docbook-style-xsl python2-devel python2-tdb python2-talloc-devel python2-tevent
BuildRequires: libtalloc-devel >= 2.1.11 doxygen openldap-devel libcmocka-devel
BuildRequires: libtdb-devel >= 1.3.14 libtevent-devel >= 0.9.36 chrpath
BuildRequires: lmdb-devel >= 0.9.16 python3-devel python3-tdb python3-talloc-devel python3-tevent
Requires: libtalloc%{?_isa} >= 2.1.11 libtdb%{?_isa} >= 1.3.14 libtevent%{?_isa} >= 0.9.36
Name: libldb
Version: 2.0.8
Release: 1
Summary: A schema-less, ldap like, API and database
Requires: libtalloc%{?_isa} >= %{talloc_version}
Requires: libtdb%{?_isa} >= %{tdb_version}
Requires: libtevent%{?_isa} >= %{tevent_version}
License: LGPLv3+
URL: http://ldb.samba.org/
Source: http://samba.org/ftp/ldb/ldb-%{version}.tar.gz
Provides: bundled(libreplace) ldb-tools
Obsoletes: ldb-tools
BuildRequires: gcc libtalloc-devel >= %{talloc_version} libtdb-devel >= %{tdb_version}
BuildRequires: libtevent-devel >= %{tevent_version} lmdb-devel >= 0.9.16 popt-devel
BuildRequires: libxslt docbook-style-xsl python3-devel python3-tdb python3-talloc-devel
BuildRequires: python3-tevent doxygen openldap-devel libcmocka-devel
Provides: bundled(libreplace) ldb-tools
Obsoletes: python2-ldb < 2.0.5-1 python2-ldb-devel < 2.0.5-1 pyldb < 1.1.26-2 ldb-tools
%description
ldb is a LDAP-like embedded database and is not at all LDAP standards compliant.It provide a
fast database with an LDAP-like API designed to be used within an application.
An extensible library that implements an LDAP like API to access remote LDAP
servers, or use local tdb databases.
%package devel
Summary: Developer files for ldb
Requires: libldb%{?_isa} = %{version}-%{release} pkgconfig libtevent-devel%{?_isa} >= 0.9.36
Requires: libtdb-devel%{?_isa} >= 1.3.14 libtalloc-devel%{?_isa} >= 2.1.11
%package devel
Summary: Developer tools for the LDB library
Requires: libldb%{?_isa} = %{version}-%{release} libtdb-devel%{?_isa} >= %{tdb_version}
Requires: libtalloc-devel%{?_isa} >= %{talloc_version} libtevent-devel%{?_isa} >= %{tevent_version}
%description devel
Develop files for use LDB library.
%description devel
Header files needed to develop programs that link against the LDB library.
%package -n python2-ldb
Summary: Python2 bindings for ldb
Requires: libldb%{?_isa} = %{version}-%{release} python2-tdb%{?_isa} >= 1.3.14
%package -n python-ldb-devel-common
Summary: Common development files for the Python bindings for the LDB library
Provides: pyldb = %{version}-%{release} pyldb%{?_isa} = %{version}-%{release}
Obsoletes: pyldb < 1.1.26-2
%{?python_provide:%python_provide python2-ldb}
%description -n python2-ldb
Python2 bindings for ldb.
%package -n python2-ldb-devel
Summary: Develop files for python2 bindings for ldb
Requires: python2-ldb%{?_isa} = %{version}-%{release} python-ldb-devel-common%{?_isa} = %{version}-%{release}
Provides: pyldb-devel = %{version}-%{release} pyldb-devel%{?_isa} = %{version}-%{release}
Obsoletes: pyldb-devel < 1.1.26-2
%{?python_provide:%python_provide python2-ldb-devel}
%description -n python2-ldb-devel
Develop files for python2 bindings for ldb.
%package -n python-ldb-devel-common
Summary: Common develop files for python bindings for ldb
Provides: pyldb-devel%{?_isa} = %{version}-%{release}
Provides: pyldb-devel%{?_isa} = %{version}-%{release}
%{?python_provide:%python_provide python2-ldb-devel}
%description -n python-ldb-devel-common
This packages provides develop files for python bindings for ldb.
Development files for the Python bindings for the LDB library.
This package includes files that aren't specific to a Python version.
%package -n python3-ldb
Summary: Python bindings for the LDB library
Requires: libldb%{?_isa} = %{version}-%{release} python3-tdb%{?_isa} >= %{tdb_version}
%package -n python3-ldb
Summary: Python3 bindings for ldb
Requires: libldb%{?_isa} = %{version}-%{release} python3-tdb%{?_isa} >= %{tdb_version}
%{?python_provide:%python_provide python3-ldb}
%description -n python3-ldb
Python3 bindings for ldb.
Python bindings for the LDB library
%package -n python3-ldb-devel
Summary: Development files for the Python bindings for the LDB library
Requires: python3-ldb%{?_isa} = %{version}-%{release}
Requires: python-ldb-devel-common%{?_isa} = %{version}-%{release}
%package -n python3-ldb-devel
Summary: Develop files for python3 bindings for ldb
Requires: python3-ldb%{?_isa} = %{version}-%{release} python-ldb-devel-common%{?_isa} = %{version}-%{release}
%{?python_provide:%python_provide python3-ldb-devel}
%description -n python3-ldb-devel
Develop files for the python3 bindings for ldb.
Development files for the Python bindings for the LDB library
%package help
Summary: Document files for libldb
%description help
Document files for libldb.
%package_help
%prep
%autosetup -n ldb-%{version} -p1
%build
pathfix.py -n -p -i %{__python2} buildtools/bin/waf
%configure --disable-rpath --disable-rpath-install --bundled-libraries=NONE \
--builtin-libraries=replace --with-modulesdir=%{_libdir}/ldb/modules \
--extra-python=%{__python3} --with-privatelibdir=%{_libdir}/ldb
%make_build V=1
export python_LDFLAGS=""
%configure --disable-rpath \
--disable-rpath-install \
--bundled-libraries=NONE \
--builtin-libraries=replace \
--with-modulesdir=%{_libdir}/ldb/modules \
%{?without_lmdb_flags} \
--with-privatelibdir=%{_libdir}/ldb
make %{?_smp_mflags} V=1
doxygen Doxyfile
%install
%make_install
find $RPM_BUILD_ROOT -name "*.so*" -exec chmod -c +x {} \;
cp -a apidocs/man/* $RPM_BUILD_ROOT/%{_mandir}
chrpath -d $RPM_BUILD_ROOT%{_libdir}/ldb/modules/ldb/*.so*
chrpath -d $RPM_BUILD_ROOT%{_libdir}/ldb/*.so*
mkdir -p $RPM_BUILD_ROOT/etc/ld.so.conf.d
echo "%{_libdir}/ldb" > $RPM_BUILD_ROOT/etc/ld.so.conf.d/%{name}-%{_arch}.conf
rm -f $RPM_BUILD_ROOT%{_libdir}/libldb.a
%check
%if %{?_with_check:1}%{!?_with_check:0}
%make_build check
%endif
echo disabling one assertion in tests/python/repack.py
sed -e '/test_guid_indexed_v1_db/,+18{/toggle_guidindex_check_pack/d}' -i tests/python/repack.py
make %{?_smp_mflags} check
%post
ldconfig
%post -n python2-ldb
ldconfig
%post -n python3-ldb
ldconfig
%postun
ldconfig
%postun -n python2-ldb
ldconfig
%postun -n python3-ldb
ldconfig
%install
make install DESTDIR=$RPM_BUILD_ROOT
cp -a apidocs/man/* $RPM_BUILD_ROOT/%{_mandir}
rm -f $RPM_BUILD_ROOT/%{_mandir}/man3/_*
%ldconfig_scriptlets
%files
%{_bindir}/ldbadd
%{_bindir}/ldbdel
%{_bindir}/ldbedit
%{_bindir}/ldbmodify
%{_bindir}/ldbrename
%{_bindir}/ldbsearch
%dir %{_libdir}/ldb
%{_libdir}/libldb.so.*
%{_libdir}/ldb/lib*.so
%{_libdir}/ldb/libldb-key-value.so
%{_libdir}/ldb/libldb-tdb-err-map.so
%{_libdir}/ldb/libldb-tdb-int.so
%{_libdir}/ldb/libldb-mdb-int.so
%dir %{_libdir}/ldb/modules
%dir %{_libdir}/ldb/modules/ldb
%{_libdir}/ldb/modules/ldb/*.so
%{_bindir}/ldb*
%config(noreplace) /etc/ld.so.conf.d/*
%exclude %{_libdir}/libldb.a
%{_libdir}/ldb/libldb-cmdline.so
%files devel
%{_includedir}/ldb*.h
%{_includedir}/ldb_module.h
%{_includedir}/ldb_handlers.h
%{_includedir}/ldb_errors.h
%{_includedir}/ldb_version.h
%{_includedir}/ldb.h
%{_libdir}/libldb.so
%{_libdir}/pkgconfig/ldb.pc
%files -n python2-ldb
%{python2_sitearch}/ldb.so
%{_libdir}/libpyldb-util.so.1*
%{python2_sitearch}/_ldb_text.py*
%files -n python2-ldb-devel
%{_libdir}/libpyldb-util.so
%{_libdir}/pkgconfig/pyldb-util.pc
%files -n python-ldb-devel-common
%{_includedir}/pyldb.h
%files -n python3-ldb
%{python3_sitearch}/ldb.cpython-*.so
%{_libdir}/libpyldb-util.cpython-*.so.1*
%{_libdir}/libpyldb-util.cpython-*.so.2*
%{python3_sitearch}/_ldb_text.py
%{python3_sitearch}/__pycache__/_ldb_text.cpython-*.py*
@ -160,14 +136,26 @@ ldconfig
%{_libdir}/libpyldb-util.cpython-*.so
%{_libdir}/pkgconfig/pyldb-util.cpython-*.pc
%ldconfig_scriptlets -n python3-ldb
%files help
%{_mandir}/man1/ldb*.1.*
%{_mandir}/man*/Py*.gz
%{_mandir}/man3/ldb*.gz
%{_mandir}/man3/ldif*.gz
%{_mandir}/man*/Py*.gz
%exclude /%{_mandir}/man3/_*
%{_mandir}/man1/ldbadd.1.*
%{_mandir}/man1/ldbdel.1.*
%{_mandir}/man1/ldbedit.1.*
%{_mandir}/man1/ldbmodify.1.*
%{_mandir}/man1/ldbrename.1.*
%{_mandir}/man1/ldbsearch.1.*
%changelog
* Wed Feb 12 2020 openEuler Buildteam <buildteam@openeuler.org> - 2.0.8-1
- Type:update
- ID:NA
- SUG:NA
- DESC:update to 2.0.8
* Thu Dec 26 2019 openEuler Buildteam <buildteam@openeuler.org> - 1.4.2-3
- Type:enhancement
- ID:NA