The branch, master has been updated
       via  35f92b8 ldb: add LDB_FLG_DONT_CREATE_DB
      from  825180b auth3: Simplify auth_check_ntlm_password logic with a "goto 
fail"

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 35f92b82b5e919a2736aec8560ea9c4c7dc4bb7a
Author: Stefan Metzmacher <[email protected]>
Date:   Fri Feb 24 15:34:33 2017 +0100

    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 <[email protected]>
    Reviewed-by: Andrew Bartlett <[email protected]>
    
    Autobuild-User(master): Stefan Metzmacher <[email protected]>
    Autobuild-Date(master): Thu Mar  9 16:02:21 CET 2017 on sn-devel-144

-----------------------------------------------------------------------

Summary of changes:
 lib/ldb/include/ldb.h     | 9 +++++++++
 lib/ldb/ldb_tdb/ldb_tdb.c | 2 ++
 lib/ldb/tools/cmdline.c   | 5 +----
 3 files changed, 12 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/ldb/include/ldb.h b/lib/ldb/include/ldb.h
index 397f994..afcf9eb 100644
--- a/lib/ldb/include/ldb.h
+++ b/lib/ldb/include/ldb.h
@@ -271,6 +271,15 @@ struct ldb_utf8_fns {
 */
 #define LDB_FLG_ENABLE_TRACING 32
 
+/**
+   Flags to tell LDB not to create a new database file:
+
+   Without this flag ldb_tdb (for example) will create a blank file
+   during an invocation of ldb_connect(), even when the caller only
+   wanted read operations, for example in ldbsearch.
+*/
+#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;


-- 
Samba Shared Repository

Reply via email to