1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-20 04:02:27 +00:00

Add new ldb 1.4 port, required by Samba 4.9

This commit is contained in:
Timur I. Bakeyev 2018-12-11 00:45:34 +00:00
parent 97645f1cc5
commit 20192f10e2
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=487215
12 changed files with 60 additions and 268 deletions

View File

@ -1,12 +1,12 @@
# $FreeBSD$
PORTNAME= ldb
PORTVERSION= 1.3.6
PORTVERSION= 1.4.3
PORTREVISION= 0
PORTEPOCH= 0
CATEGORIES= databases
MASTER_SITES= SAMBA
PKGNAMESUFFIX= 13
PKGNAMESUFFIX= 14
MAINTAINER= timur@FreeBSD.org
COMMENT= LDAP-like embedded database
@ -21,12 +21,11 @@ RUN_DEPENDS= ${LDB_DEPENDS}
LDB_DEPENDS= talloc>=2.1.14:devel/talloc \
tevent>=0.9.37:devel/tevent \
tdb>=1.3.16:databases/tdb \
lmdb>=0.9.16:databases/lmdb \
cmocka>=1.1.1:sysutils/cmocka \
popt>=0:devel/popt
CONFLICTS_INSTALL= ldb-1.1.* ldb12-1.2.*
EXTRA_PATCHES+= ${PATCHDIR}/0001-bug-13362.patch:-p3
CONFLICTS_INSTALL= ldb-1.1.* ldb1[23]-1.*
#FLAVORS= default nopython
#nopython_PKGNAMESUFFIX= -nopython
@ -68,15 +67,19 @@ LDB_BINS= bin/ldbedit \
LDB_LIBS= lib/libldb.so \
lib/libldb.so.1 \
lib/ldb/libldb-mdb-int.so \
lib/ldb/libldb-key-value.so \
lib/ldb/libldb-cmdline.so \
lib/shared-modules/ldb/asq.so \
lib/shared-modules/ldb/ldap.so \
lib/shared-modules/ldb/paged_results.so \
lib/shared-modules/ldb/paged_searches.so \
lib/shared-modules/ldb/rdn_name.so \
lib/shared-modules/ldb/sample.so \
lib/shared-modules/ldb/server_sort.so \
lib/shared-modules/ldb/skel.so \
lib/shared-modules/ldb/server_sort.so \
lib/shared-modules/ldb/sample.so \
lib/shared-modules/ldb/rdn_name.so \
lib/shared-modules/ldb/paged_searches.so \
lib/shared-modules/ldb/paged_results.so \
lib/shared-modules/ldb/mdb.so \
lib/shared-modules/ldb/ldb.so \
lib/shared-modules/ldb/ldap.so \
lib/shared-modules/ldb/asq.so \
lib/shared-modules/ldb/tdb.so
PLIST_FILES= include/ldb_version.h \

View File

@ -1,3 +1,3 @@
TIMESTAMP = 1535926436
SHA256 (ldb-1.3.6.tar.gz) = 51d23134b356490e75258518dfc5c994c1710ad5357a1e3455a9eaeddff8939a
SIZE (ldb-1.3.6.tar.gz) = 1374574
TIMESTAMP = 1544404358
SHA256 (ldb-1.4.3.tar.gz) = aca09389eff859bfb4d10defa5f02ddfb99b45d67626eac3e8c2079232676a1f
SIZE (ldb-1.4.3.tar.gz) = 1428730

View File

@ -1,170 +0,0 @@
From 75e572c6ac2e537839da341e76236d1c4003cae7 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl@samba.org>
Date: Mon, 7 May 2018 16:41:55 +0200
Subject: [PATCH 1/2] lib: Put "results_store" into a doubly linked list
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13362
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 8063995a92fffc93aa9d6d1d92a75bf3f3c9592b)
---
lib/ldb/modules/paged_results.c | 25 +++++--------------------
1 file changed, 5 insertions(+), 20 deletions(-)
diff --git a/lib/ldb/modules/paged_results.c b/lib/ldb/modules/paged_results.c
index de014a39699..aafbcbf4483 100644
--- a/lib/ldb/modules/paged_results.c
+++ b/lib/ldb/modules/paged_results.c
@@ -35,6 +35,7 @@
#include "replace.h"
#include "system/filesys.h"
#include "system/time.h"
+#include "dlinklist.h"
#include "ldb_module.h"
struct message_store {
@@ -48,14 +49,13 @@ struct message_store {
struct private_data;
struct results_store {
+ struct results_store *prev, *next;
struct private_data *priv;
char *cookie;
time_t timestamp;
- struct results_store *next;
-
struct message_store *first;
struct message_store *last;
int num_entries;
@@ -75,22 +75,8 @@ struct private_data {
static int store_destructor(struct results_store *del)
{
struct private_data *priv = del->priv;
- struct results_store *loop;
-
- if (priv->store == del) {
- priv->store = del->next;
- return 0;
- }
-
- for (loop = priv->store; loop; loop = loop->next) {
- if (loop->next == del) {
- loop->next = del->next;
- return 0;
- }
- }
-
- /* is not in list ? */
- return -1;
+ DLIST_REMOVE(priv->store, del);
+ return 0;
}
static struct results_store *new_store(struct private_data *priv)
@@ -120,8 +106,7 @@ static struct results_store *new_store(struct private_data *priv)
newr->first_ref = NULL;
newr->controls = NULL;
- newr->next = priv->store;
- priv->store = newr;
+ DLIST_ADD(priv->store, newr);
talloc_set_destructor(newr, store_destructor);
--
2.11.0
From fd3d38f5d3de45e6d5e47ed6bd42ef86abae8836 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl@samba.org>
Date: Mon, 7 May 2018 16:53:00 +0200
Subject: [PATCH 2/2] lib: Hold at most 10 outstanding paged result cookies
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13362
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue May 15 09:37:21 CEST 2018 on sn-devel-144
(cherry picked from commit 9fbd4672b06de5333a9c44fc126b8edac0b9d31a)
---
lib/ldb/modules/paged_results.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/lib/ldb/modules/paged_results.c b/lib/ldb/modules/paged_results.c
index aafbcbf4483..ecb22271d28 100644
--- a/lib/ldb/modules/paged_results.c
+++ b/lib/ldb/modules/paged_results.c
@@ -36,6 +36,7 @@
#include "system/filesys.h"
#include "system/time.h"
#include "dlinklist.h"
+#include <assert.h>
#include "ldb_module.h"
struct message_store {
@@ -68,6 +69,7 @@ struct results_store {
struct private_data {
uint32_t next_free_id;
+ size_t num_stores;
struct results_store *store;
};
@@ -76,6 +78,10 @@ static int store_destructor(struct results_store *del)
{
struct private_data *priv = del->priv;
DLIST_REMOVE(priv->store, del);
+
+ assert(priv->num_stores > 0);
+ priv->num_stores -= 1;
+
return 0;
}
@@ -108,8 +114,21 @@ static struct results_store *new_store(struct private_data *priv)
DLIST_ADD(priv->store, newr);
+ assert(priv->num_stores < SIZE_MAX);
+ priv->num_stores += 1;
+
talloc_set_destructor(newr, store_destructor);
+ if (priv->num_stores > 10) {
+ struct results_store *last;
+ /*
+ * 10 is the default for MaxResultSetsPerConn --
+ * possibly need to parameterize it.
+ */
+ last = DLIST_TAIL(priv->store);
+ TALLOC_FREE(last);
+ }
+
return newr;
}
@@ -366,6 +385,8 @@ static int paged_search(struct ldb_module *module, struct ldb_request *req)
return LDB_ERR_UNWILLING_TO_PERFORM;
}
+ DLIST_PROMOTE(private_data->store, current);
+
ac->store = current;
/* check if it is an abandon */
@@ -397,6 +418,7 @@ static int paged_request_init(struct ldb_module *module)
}
data->next_free_id = 1;
+ data->num_stores = 0;
data->store = NULL;
ldb_module_set_private(module, data);
--
2.11.0

View File

@ -1,13 +1,13 @@
'\" t
.\" Title: ldb
.\" Author: [see the "Author" section]
.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
.\" Date: 11/05/2017
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 12/11/2018
.\" Manual: System Administration tools
.\" Source: LDB 1.1
.\" Language: English
.\"
.TH "LDB" "3" "11/05/2017" "LDB 1\&.1" "System Administration tools"
.TH "LDB" "3" "12/11/2018" "LDB 1\&.1" "System Administration tools"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
@ -57,7 +57,6 @@ If you are new to ldb, then I suggest starting with the manual pages for ldbsear
.sp -1
.IP \(bu 2.3
.\}
ldbsearch(1)
\- command line ldb search utility
.RE
@ -70,7 +69,6 @@ ldbsearch(1)
.sp -1
.IP \(bu 2.3
.\}
ldbedit(1)
\- edit all or part of a ldb database using your favourite editor
.RE
@ -83,7 +81,6 @@ ldbedit(1)
.sp -1
.IP \(bu 2.3
.\}
ldbadd(1)
\- add records to a ldb database using LDIF formatted input
.RE
@ -96,7 +93,6 @@ ldbadd(1)
.sp -1
.IP \(bu 2.3
.\}
ldbdel(1)
\- delete records from a ldb database
.RE
@ -109,7 +105,6 @@ ldbdel(1)
.sp -1
.IP \(bu 2.3
.\}
ldbmodify(1)
\- modify records in a ldb database using LDIF formatted input
.RE
@ -123,7 +118,6 @@ ldbmodify(1)
.sp -1
.IP \(bu 2.3
.\}
\fBldb_connect(3)\fR
\- connect to a ldb backend
.RE
@ -136,7 +130,6 @@ ldbmodify(1)
.sp -1
.IP \(bu 2.3
.\}
\fBldb_search(3)\fR
\- perform a database search
.RE
@ -149,7 +142,6 @@ ldbmodify(1)
.sp -1
.IP \(bu 2.3
.\}
\fBldb_add(3)\fR
\- add a record to the database
.RE
@ -162,7 +154,6 @@ ldbmodify(1)
.sp -1
.IP \(bu 2.3
.\}
\fBldb_delete(3)\fR
\- delete a record from the database
.RE
@ -175,7 +166,6 @@ ldbmodify(1)
.sp -1
.IP \(bu 2.3
.\}
\fBldb_modify(3)\fR
\- modify a record in the database
.RE
@ -188,7 +178,6 @@ ldbmodify(1)
.sp -1
.IP \(bu 2.3
.\}
\fBldb_errstring(3)\fR
\- retrieve extended error information from the last operation
.RE
@ -201,7 +190,6 @@ ldbmodify(1)
.sp -1
.IP \(bu 2.3
.\}
\fBldb_ldif_write(3)\fR
\- write a LDIF formatted message
.RE
@ -214,7 +202,6 @@ ldbmodify(1)
.sp -1
.IP \(bu 2.3
.\}
\fBldb_ldif_write_file(3)\fR
\- write a LDIF formatted message to a file
.RE
@ -227,7 +214,6 @@ ldbmodify(1)
.sp -1
.IP \(bu 2.3
.\}
\fBldb_ldif_read(3)\fR
\- read a LDIF formatted message
.RE
@ -240,7 +226,6 @@ ldbmodify(1)
.sp -1
.IP \(bu 2.3
.\}
\fBldb_ldif_read_free(3)\fR
\- free the result of a ldb_ldif_read()
.RE
@ -253,7 +238,6 @@ ldbmodify(1)
.sp -1
.IP \(bu 2.3
.\}
\fBldb_ldif_read_file(3)\fR
\- read a LDIF message from a file
.RE
@ -266,7 +250,6 @@ ldbmodify(1)
.sp -1
.IP \(bu 2.3
.\}
\fBldb_ldif_read_string(3)\fR
\- read a LDIF message from a string
.RE
@ -279,7 +262,6 @@ ldbmodify(1)
.sp -1
.IP \(bu 2.3
.\}
\fBldb_msg_find_element(3)\fR
\- find an element in a ldb_message
.RE
@ -292,7 +274,6 @@ ldbmodify(1)
.sp -1
.IP \(bu 2.3
.\}
\fBldb_val_equal_exact(3)\fR
\- compare two ldb_val structures
.RE
@ -305,7 +286,6 @@ ldbmodify(1)
.sp -1
.IP \(bu 2.3
.\}
\fBldb_msg_find_val(3)\fR
\- find an element by value
.RE
@ -318,7 +298,6 @@ ldbmodify(1)
.sp -1
.IP \(bu 2.3
.\}
\fBldb_msg_add_empty(3)\fR
\- add an empty message element to a ldb_message
.RE
@ -331,7 +310,6 @@ ldbmodify(1)
.sp -1
.IP \(bu 2.3
.\}
\fBldb_msg_add(3)\fR
\- add a non\-empty message element to a ldb_message
.RE
@ -344,7 +322,6 @@ ldbmodify(1)
.sp -1
.IP \(bu 2.3
.\}
\fBldb_msg_element_compare(3)\fR
\- compare two ldb_message_element structures
.RE
@ -357,7 +334,6 @@ ldbmodify(1)
.sp -1
.IP \(bu 2.3
.\}
\fBldb_msg_find_int(3)\fR
\- return an integer value from a ldb_message
.RE
@ -370,7 +346,6 @@ ldbmodify(1)
.sp -1
.IP \(bu 2.3
.\}
\fBldb_msg_find_uint(3)\fR
\- return an unsigned integer value from a ldb_message
.RE
@ -383,7 +358,6 @@ ldbmodify(1)
.sp -1
.IP \(bu 2.3
.\}
\fBldb_msg_find_double(3)\fR
\- return a double value from a ldb_message
.RE
@ -396,7 +370,6 @@ ldbmodify(1)
.sp -1
.IP \(bu 2.3
.\}
\fBldb_msg_find_string(3)\fR
\- return a string value from a ldb_message
.RE
@ -409,7 +382,6 @@ ldbmodify(1)
.sp -1
.IP \(bu 2.3
.\}
\fBldb_set_alloc(3)\fR
\- set the memory allocation function to be used by ldb
.RE
@ -422,7 +394,6 @@ ldbmodify(1)
.sp -1
.IP \(bu 2.3
.\}
\fBldb_set_debug(3)\fR
\- set a debug handler to be used by ldb
.RE
@ -435,7 +406,6 @@ ldbmodify(1)
.sp -1
.IP \(bu 2.3
.\}
\fBldb_set_debug_stderr(3)\fR
\- set a debug handler for stderr output
.RE

View File

@ -1,13 +1,13 @@
'\" t
.\" Title: ldbadd
.\" Author: [see the "AUTHOR" section]
.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
.\" Date: 11/05/2017
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 12/11/2018
.\" Manual: System Administration tools
.\" Source: LDB 1.1
.\" Language: English
.\"
.TH "LDBADD" "1" "11/05/2017" "LDB 1\&.1" "System Administration tools"
.TH "LDBADD" "1" "12/11/2018" "LDB 1\&.1" "System Administration tools"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------

View File

@ -1,13 +1,13 @@
'\" t
.\" Title: ldbdel
.\" Author: [see the "AUTHOR" section]
.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
.\" Date: 11/05/2017
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 12/11/2018
.\" Manual: System Administration tools
.\" Source: LDB 1.1
.\" Language: English
.\"
.TH "LDBDEL" "1" "11/05/2017" "LDB 1\&.1" "System Administration tools"
.TH "LDBDEL" "1" "12/11/2018" "LDB 1\&.1" "System Administration tools"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------

View File

@ -1,13 +1,13 @@
'\" t
.\" Title: ldbedit
.\" Author: [see the "AUTHOR" section]
.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
.\" Date: 11/05/2017
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 12/11/2018
.\" Manual: System Administration tools
.\" Source: LDB 1.1
.\" Language: English
.\"
.TH "LDBEDIT" "1" "11/05/2017" "LDB 1\&.1" "System Administration tools"
.TH "LDBEDIT" "1" "12/11/2018" "LDB 1\&.1" "System Administration tools"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------

View File

@ -1,13 +1,13 @@
'\" t
.\" Title: ldbmodify
.\" Author: [see the "AUTHOR" section]
.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
.\" Date: 11/05/2017
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 12/11/2018
.\" Manual: System Administration tools
.\" Source: LDB 1.1
.\" Language: English
.\"
.TH "LDBMODIFY" "1" "11/05/2017" "LDB 1\&.1" "System Administration tools"
.TH "LDBMODIFY" "1" "12/11/2018" "LDB 1\&.1" "System Administration tools"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------

View File

@ -1,13 +1,13 @@
'\" t
.\" Title: ldbrename
.\" Author: [see the "AUTHOR" section]
.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
.\" Date: 11/05/2017
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 12/11/2018
.\" Manual: System Administration tools
.\" Source: LDB 1.1
.\" Language: English
.\"
.TH "LDBRENAME" "1" "11/05/2017" "LDB 1\&.1" "System Administration tools"
.TH "LDBRENAME" "1" "12/11/2018" "LDB 1\&.1" "System Administration tools"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------

View File

@ -1,13 +1,13 @@
'\" t
.\" Title: ldbsearch
.\" Author: [see the "AUTHOR" section]
.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
.\" Date: 11/05/2017
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 12/11/2018
.\" Manual: System Administration tools
.\" Source: LDB 1.1
.\" Language: English
.\"
.TH "LDBSEARCH" "1" "11/05/2017" "LDB 1\&.1" "System Administration tools"
.TH "LDBSEARCH" "1" "12/11/2018" "LDB 1\&.1" "System Administration tools"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------

View File

@ -0,0 +1,21 @@
--- ldb_mdb/ldb_mdb.c.orig 2018-07-12 08:23:36 UTC
+++ ldb_mdb/ldb_mdb.c
@@ -40,7 +40,9 @@ int ldb_mdb_err_map(int lmdb_err)
return LDB_SUCCESS;
case EIO:
return LDB_ERR_OPERATIONS_ERROR;
+#ifdef EBADE
case EBADE:
+#endif
case MDB_INCOMPATIBLE:
case MDB_CORRUPTED:
case MDB_INVALID:
@@ -181,7 +183,7 @@ static int lmdb_store(struct ltdb_privat
if (flags == TDB_INSERT) {
mdb_flags = MDB_NOOVERWRITE;
- } else if ((flags == TDB_MODIFY)) {
+ } else if (flags == TDB_MODIFY) {
/*
* Modifying a record, ensure that it exists.
* This mimics the TDB semantics

View File

@ -1,32 +0,0 @@
--- wscript.orig 2017-09-07 10:04:11 UTC
+++ wscript
@@ -126,9 +126,15 @@ def build(bld):
bld.RECURSE('lib/tdb')
if bld.env.standalone_ldb:
+ if not 'PACKAGE_VERSION' in bld.env:
+ bld.env.PACKAGE_VERSION = VERSION
+ bld.env.PKGCONFIGDIR = '%%PKGCONFIGDIR%%'
private_library = False
else:
private_library = True
+ # we're not currently linking against the ldap libs, but ldb.pc.in
+ # has @LDAP_LIBS@
+ bld.env.LDAP_LIBS = ''
LDB_MAP_SRC = bld.SUBDIR('ldb_map',
'ldb_map.c ldb_map_inbound.c ldb_map_outbound.c')
@@ -149,13 +155,6 @@ def build(bld):
if bld.PYTHON_BUILD_IS_ENABLED():
if not bld.CONFIG_SET('USING_SYSTEM_PYLDB_UTIL'):
for env in bld.gen_python_environments(['PKGCONFIGDIR']):
- # we're not currently linking against the ldap libs, but ldb.pc.in
- # has @LDAP_LIBS@
- bld.env.LDAP_LIBS = ''
-
- if not 'PACKAGE_VERSION' in bld.env:
- bld.env.PACKAGE_VERSION = VERSION
- bld.env.PKGCONFIGDIR = '${LIBDIR}/pkgconfig'
name = bld.pyembed_libname('pyldb-util')
bld.SAMBA_LIBRARY(name,