Package init
This commit is contained in:
commit
508280e0f4
60
0002-ldb-Run-at-least-some-tests-on-32-bit-machines.patch
Normal file
60
0002-ldb-Run-at-least-some-tests-on-32-bit-machines.patch
Normal file
@ -0,0 +1,60 @@
|
||||
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
|
||||
|
||||
89
0003-ldb-Out-ouf-bound-read-in-ldb_wildcard_compare.patch
Normal file
89
0003-ldb-Out-ouf-bound-read-in-ldb_wildcard_compare.patch
Normal file
@ -0,0 +1,89 @@
|
||||
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
|
||||
|
||||
BIN
ldb-1.4.2.tar.gz
Normal file
BIN
ldb-1.4.2.tar.gz
Normal file
Binary file not shown.
165
libldb.spec
Normal file
165
libldb.spec
Normal file
@ -0,0 +1,165 @@
|
||||
Name: libldb
|
||||
Version: 1.4.2
|
||||
Release: 2
|
||||
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
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
Provides: bundled(libreplace) ldb-tools
|
||||
Obsoletes: 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.
|
||||
|
||||
%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
|
||||
|
||||
%description devel
|
||||
Develop files for use LDB library.
|
||||
|
||||
%package -n python2-ldb
|
||||
Summary: Python2 bindings for ldb
|
||||
Requires: libldb%{?_isa} = %{version}-%{release} python2-tdb%{?_isa} >= 1.3.14
|
||||
|
||||
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}
|
||||
%{?python_provide:%python_provide python2-ldb-devel}
|
||||
|
||||
%description -n python-ldb-devel-common
|
||||
This packages provides develop files for python bindings for ldb.
|
||||
|
||||
%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.
|
||||
|
||||
%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.
|
||||
|
||||
%package help
|
||||
Summary: Document files for libldb
|
||||
|
||||
%description help
|
||||
Document files for libldb.
|
||||
|
||||
%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
|
||||
doxygen Doxyfile
|
||||
|
||||
%install
|
||||
%make_install
|
||||
find $RPM_BUILD_ROOT -name "*.so*" -exec chmod -c +x {} \;
|
||||
cp -a apidocs/man/* $RPM_BUILD_ROOT/%{_mandir}
|
||||
|
||||
%check
|
||||
%if %{?_with_check:1}%{!?_with_check:0}
|
||||
%make_build check
|
||||
%endif
|
||||
|
||||
%post
|
||||
ldconfig
|
||||
%post -n python2-ldb
|
||||
ldconfig
|
||||
%post -n python3-ldb
|
||||
ldconfig
|
||||
%postun
|
||||
ldconfig
|
||||
%postun -n python2-ldb
|
||||
ldconfig
|
||||
%postun -n python3-ldb
|
||||
ldconfig
|
||||
|
||||
%files
|
||||
%{_libdir}/libldb.so.*
|
||||
%{_libdir}/ldb/lib*.so
|
||||
%{_libdir}/ldb/modules/ldb/*.so
|
||||
%{_bindir}/ldb*
|
||||
%exclude %{_libdir}/libldb.a
|
||||
|
||||
%files devel
|
||||
%{_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*
|
||||
%{python3_sitearch}/_ldb_text.py
|
||||
%{python3_sitearch}/__pycache__/_ldb_text.cpython-*.py*
|
||||
|
||||
%files -n python3-ldb-devel
|
||||
%{_libdir}/libpyldb-util.cpython-*.so
|
||||
%{_libdir}/pkgconfig/pyldb-util.cpython-*.pc
|
||||
|
||||
%files help
|
||||
%{_mandir}/man1/ldb*.1.*
|
||||
%{_mandir}/man3/ldb*.gz
|
||||
%{_mandir}/man3/ldif*.gz
|
||||
%{_mandir}/man*/Py*.gz
|
||||
%exclude /%{_mandir}/man3/_*
|
||||
|
||||
%changelog
|
||||
* Wed Sep 11 2019 liyongqiang<liyongqiang10@huawei.com> - 1.4.2-2
|
||||
- Package init
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user