[Patches] Some misc ones... (ldbsearch and wscript cleanup)

Stefan Metzmacher metze at samba.org
Fri Feb 24 16:18:44 UTC 2017


Hi Andrew,

one more...

We need to do a new ldb release before we can use that outside of ldb,
do you have any pending ldb changes?

Please review and push:-)

metze
Am 22.02.2017 um 23:34 schrieb Andrew Bartlett:
> On Wed, 2017-02-22 at 23:20 +0100, Stefan Metzmacher wrote:
>> Hi,
>>
>> here're two little patches for master.
>>
>> Similar to
>> bed19f3 Garming Sam Mon Jan 30 11:08:07 2017 +1300 ldbedit: Prevent
>> the
>> use of the reveal internals control
>> we should not use the --show-binary option for ldb tools except
>> ldbsearch,
>> as it's dangerous when using it in ldbedit.
>>
>> The other one is trivial...
>>
>> Please review and push:-)
> 
> Reviewed-by: Andrew Bartlett <abartlet at samba.org>
> 
> I'll push later today when I collect up some other changes.
> 
> Andrew Bartlett
> 
-------------- next part --------------
From 5bad50190f8a81426d4ca94c0295da37ee47936d Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Fri, 24 Feb 2017 15:34:33 +0100
Subject: [PATCH] ldb: add LDB_FLG_DONT_CREATE_DB

This avoids creating an new tdb files on ldbsearch
or other callers which use LDB_FLG_DONT_CREATE_DB.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
---
 lib/ldb/include/ldb.h     | 5 +++++
 lib/ldb/ldb_tdb/ldb_tdb.c | 2 ++
 lib/ldb/tools/cmdline.c   | 5 +----
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/lib/ldb/include/ldb.h b/lib/ldb/include/ldb.h
index 397f994..be13e64 100644
--- a/lib/ldb/include/ldb.h
+++ b/lib/ldb/include/ldb.h
@@ -271,6 +271,11 @@ struct ldb_utf8_fns {
 */
 #define LDB_FLG_ENABLE_TRACING 32
 
+/**
+   Flags to enable ldb tracing
+*/
+#define LDB_FLG_DONT_CREATE_DB 64
+
 /*
    structures for ldb_parse_tree handling code
 */
diff --git a/lib/ldb/ldb_tdb/ldb_tdb.c b/lib/ldb/ldb_tdb/ldb_tdb.c
index 707d227..8c4989f 100644
--- a/lib/ldb/ldb_tdb/ldb_tdb.c
+++ b/lib/ldb/ldb_tdb/ldb_tdb.c
@@ -1565,6 +1565,8 @@ static int ltdb_connect(struct ldb_context *ldb, const char *url,
 
 	if (flags & LDB_FLG_RDONLY) {
 		open_flags = O_RDONLY;
+	} else if (flags & LDB_FLG_DONT_CREATE_DB) {
+		open_flags = O_RDWR;
 	} else {
 		open_flags = O_CREAT | O_RDWR;
 	}
diff --git a/lib/ldb/tools/cmdline.c b/lib/ldb/tools/cmdline.c
index 8baa120..a2fe97e 100644
--- a/lib/ldb/tools/cmdline.c
+++ b/lib/ldb/tools/cmdline.c
@@ -280,10 +280,7 @@ static struct ldb_cmdline *ldb_cmdline_process_internal(struct ldb_context *ldb,
 	}
 
 	if (search) {
-		/*
-		 * For now we're not adding LDB_FLG_RDONLY,
-		 * as that would result in no tdb locking.
-		 */
+		flags |= LDB_FLG_DONT_CREATE_DB;
 
 		if (options.show_binary) {
 			flags |= LDB_FLG_SHOW_BINARY;
-- 
1.9.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170224/1c8064ab/signature.sig>


More information about the samba-technical mailing list