The branch, master has been updated
       via  da5224a s3:dbwrap_ctdb: skip the internal __db_sequence_number__ 
key from (persistent) traverse and traverse_read
       via  4d30fd8 s3:dbwrap_tool: add popt support and standard samba options
       via  aa0f102 s3:g_lock: add a missing 
 to a debug message in g_lock_init
      from  f9acf77 lib/util/charset: remove charset module loading

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


- Log -----------------------------------------------------------------
commit da5224a9d2684c0a95f056700af4c4f7be2f93f9
Author: Michael Adam <ob...@samba.org>
Date:   Tue Sep 20 04:33:31 2011 +0200

    s3:dbwrap_ctdb: skip the internal __db_sequence_number__ key from 
(persistent) traverse and traverse_read
    
    This is is used internally in the persistent transactions and should not 
surface.
    
    Autobuild-User: Michael Adam <ob...@samba.org>
    Autobuild-Date: Tue Sep 20 07:59:20 CEST 2011 on sn-devel-104

commit 4d30fd8c5163c92e8fdbfd1cae7088e9e010b8cd
Author: Michael Adam <ob...@samba.org>
Date:   Tue Sep 20 04:32:25 2011 +0200

    s3:dbwrap_tool: add popt support and standard samba options

commit aa0f102fd7defb5ff442ac4bfc782721fbbff434
Author: Michael Adam <ob...@samba.org>
Date:   Mon Sep 19 22:30:57 2011 +0200

    s3:g_lock: add a missing \n to a debug message in g_lock_init

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

Summary of changes:
 source3/Makefile.in              |    4 ++-
 source3/lib/dbwrap/dbwrap_ctdb.c |   26 +++++++++++++++++
 source3/lib/g_lock.c             |    2 +-
 source3/utils/dbwrap_tool.c      |   58 ++++++++++++++++++++++++++++---------
 source3/wscript_build            |    3 +-
 5 files changed, 76 insertions(+), 17 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/Makefile.in b/source3/Makefile.in
index d64adb8..0796bc6 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -1549,7 +1549,8 @@ RPC_OPEN_TCP_OBJ = torture/rpc_open_tcp.o \
 DBWRAP_TOOL_OBJ = utils/dbwrap_tool.o \
                  $(PARAM_OBJ) \
                  $(LIB_NONSMBD_OBJ) \
-                 $(LIBSMB_ERR_OBJ)
+                 $(LIBSMB_ERR_OBJ) \
+                 $(POPT_LIB_OBJ)
 
 DBWRAP_TORTURE_OBJ = utils/dbwrap_torture.o \
                     $(PARAM_OBJ) \
@@ -3204,6 +3205,7 @@ bin/dbwrap_tool@EXEEXT@: $(DBWRAP_TOOL_OBJ) $(LIBTALLOC) 
$(LIBTDB)
        @$(CC) -o $@ $(DBWRAP_TOOL_OBJ)\
                $(LDFLAGS) $(DYNEXP) $(LIBS) \
                $(LDAP_LIBS) \
+               $(POPT_LIBS) \
                $(LIBTALLOC_LIBS) $(LIBTDB_LIBS)
 
 install-dbwrap_tool:: bin/dbwrap_tool@EXEEXT@
diff --git a/source3/lib/dbwrap/dbwrap_ctdb.c b/source3/lib/dbwrap/dbwrap_ctdb.c
index 429f542..d9fb489 100644
--- a/source3/lib/dbwrap/dbwrap_ctdb.c
+++ b/source3/lib/dbwrap/dbwrap_ctdb.c
@@ -1261,11 +1261,25 @@ static int traverse_persistent_callback(TDB_CONTEXT 
*tdb, TDB_DATA kbuf, TDB_DAT
        struct db_record *rec;
        TALLOC_CTX *tmp_ctx = talloc_new(state->db);
        int ret = 0;
+
+       /*
+        * Skip the __db_sequence_number__ key:
+        * This is used for persistent transactions internally.
+        */
+       if (kbuf.dsize == strlen(CTDB_DB_SEQNUM_KEY) + 1 &&
+           strncmp((const char*)kbuf.dptr, CTDB_DB_SEQNUM_KEY,
+                   strlen(CTDB_DB_SEQNUM_KEY)) == 0)
+       {
+               goto done;
+       }
+
        /* we have to give them a locked record to prevent races */
        rec = db_ctdb_fetch_locked(state->db, tmp_ctx, kbuf);
        if (rec && rec->value.dsize > 0) {
                ret = state->fn(rec, state->private_data);
        }
+
+done:
        talloc_free(tmp_ctx);
        return ret;
 }
@@ -1321,6 +1335,18 @@ static int traverse_persistent_callback_read(TDB_CONTEXT 
*tdb, TDB_DATA kbuf, TD
 {
        struct traverse_state *state = (struct traverse_state *)private_data;
        struct db_record rec;
+
+       /*
+        * Skip the __db_sequence_number__ key:
+        * This is used for persistent transactions internally.
+        */
+       if (kbuf.dsize == strlen(CTDB_DB_SEQNUM_KEY) + 1 &&
+           strncmp((const char*)kbuf.dptr, CTDB_DB_SEQNUM_KEY,
+                   strlen(CTDB_DB_SEQNUM_KEY)) == 0)
+       {
+               return 0;
+       }
+
        rec.key = kbuf;
        rec.value = dbuf;
        rec.store = db_ctdb_store_deny;
diff --git a/source3/lib/g_lock.c b/source3/lib/g_lock.c
index 308e5cf..38dec40 100644
--- a/source3/lib/g_lock.c
+++ b/source3/lib/g_lock.c
@@ -62,7 +62,7 @@ struct g_lock_ctx *g_lock_ctx_init(TALLOC_CTX *mem_ctx,
                             TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH,
                             O_RDWR|O_CREAT, 0600);
        if (result->db == NULL) {
-               DEBUG(1, ("g_lock_init: Could not open g_lock.tdb"));
+               DEBUG(1, ("g_lock_init: Could not open g_lock.tdb\n"));
                TALLOC_FREE(result);
                return NULL;
        }
diff --git a/source3/utils/dbwrap_tool.c b/source3/utils/dbwrap_tool.c
index 7902b08..7aeaa39 100644
--- a/source3/utils/dbwrap_tool.c
+++ b/source3/utils/dbwrap_tool.c
@@ -21,6 +21,7 @@
 
 #include "includes.h"
 #include "system/filesys.h"
+#include "popt_common.h"
 #include "dbwrap/dbwrap.h"
 #include "dbwrap/dbwrap_open.h"
 #include "messages.h"
@@ -214,12 +215,41 @@ int main(int argc, const char **argv)
 
        int ret = 1;
 
+       struct poptOption popt_options[] = {
+               POPT_AUTOHELP
+               POPT_COMMON_SAMBA
+               POPT_TABLEEND
+       };
+       int opt;
+       const char **extra_argv;
+       int extra_argc = 0;
+       poptContext pc;
+
        load_case_tables();
        lp_set_cmdline("log level", "0");
        setup_logging(argv[0], DEBUG_STDERR);
+
+       pc = poptGetContext(argv[0], argc, argv, popt_options, 
POPT_CONTEXT_KEEP_FIRST);
+
+       while ((opt = poptGetNextOpt(pc)) != -1) {
+               switch (opt) {
+               default:
+                       fprintf(stderr, "Invalid option %s: %s\n",
+                               poptBadOption(pc, 0), poptStrerror(opt));
+                       goto done;
+               }
+       }
+
+       /* setup the remaining options for the main program to use */
+       extra_argv = poptGetArgs(pc);
+       if (extra_argv) {
+               extra_argv++;
+               while (extra_argv[extra_argc]) extra_argc++;
+       }
+
        lp_load_global(get_dyn_CONFIGFILE());
 
-       if ((argc < 3) || (argc > 6)) {
+       if ((extra_argc < 2) || (extra_argc > 5)) {
                d_fprintf(stderr,
                          "USAGE: %s <database> <op> [<key> [<type> 
[<value>]]]\n"
                          "       ops: fetch, store, delete, erase, listkeys\n"
@@ -228,45 +258,45 @@ int main(int argc, const char **argv)
                goto done;
        }
 
-       dbname = argv[1];
-       opname = argv[2];
+       dbname = extra_argv[0];
+       opname = extra_argv[1];
 
        if (strcmp(opname, "store") == 0) {
-               if (argc != 6) {
+               if (extra_argc != 5) {
                        d_fprintf(stderr, "ERROR: operation 'store' requires "
                                  "value argument\n");
                        goto done;
                }
-               valuestr = argv[5];
-               keytype = argv[4];
-               keyname = argv[3];
+               valuestr = extra_argv[4];
+               keytype = extra_argv[3];
+               keyname = extra_argv[2];
                op = OP_STORE;
        } else if (strcmp(opname, "fetch") == 0) {
-               if (argc != 5) {
+               if (extra_argc != 4) {
                        d_fprintf(stderr, "ERROR: operation 'fetch' requires "
                                  "type but not value argument\n");
                        goto done;
                }
                op = OP_FETCH;
-               keytype = argv[4];
-               keyname = argv[3];
+               keytype = extra_argv[3];
+               keyname = extra_argv[2];
        } else if (strcmp(opname, "delete") == 0) {
-               if (argc != 4) {
+               if (extra_argc != 3) {
                        d_fprintf(stderr, "ERROR: operation 'delete' does "
                                  "not allow type nor value argument\n");
                        goto done;
                }
-               keyname = argv[3];
+               keyname = extra_argv[2];
                op = OP_DELETE;
        } else if (strcmp(opname, "erase") == 0) {
-               if (argc != 3) {
+               if (extra_argc != 2) {
                        d_fprintf(stderr, "ERROR: operation 'erase' does "
                                  "not take a key argument\n");
                        goto done;
                }
                op = OP_ERASE;
        } else if (strcmp(opname, "listkeys") == 0) {
-               if (argc != 3) {
+               if (extra_argc != 2) {
                        d_fprintf(stderr, "ERROR: operation 'listkeys' does "
                                  "not take a key argument\n");
                        goto done;
diff --git a/source3/wscript_build b/source3/wscript_build
index 4bedbfe..ff33c99 100755
--- a/source3/wscript_build
+++ b/source3/wscript_build
@@ -1393,7 +1393,8 @@ bld.SAMBA3_BINARY('test_lp_load',
 
 bld.SAMBA3_BINARY('dbwrap_tool',
                  source=DBWRAP_TOOL_SRC,
-                 deps='''talloc tdb_compat tevent cap param smbd_shim 
LIBSMB_ERR''',
+                 deps='''talloc tdb_compat tevent cap param smbd_shim 
LIBSMB_ERR
+                popt_samba3''',
                  vars=locals())
 
 bld.SAMBA3_BINARY('dbwrap_torture',


-- 
Samba Shared Repository

Reply via email to