The branch, master has been updated
       via  0b23345 s3:smbd: skip empty records in smbXsrv_open_cleanup()
       via  6b2d67a smbd:smb2: fix durable reconnect: set fsp->fnum from the 
smbXsrv_open->local_id
       via  e93f052 docs: remove extra spaces in synopsis of dbwrap_tool
       via  1e3b352 docs: document new --non-persistent option to dbwrap_tool
       via  c3f9327 dbwrap_tool: add option "--non-persistent" and force 
excatly one of "--[non-]persistent"
       via  6f748fe docs: remove short form "-p" of --persistent from 
dbwrap_tool manpage
       via  6dd1008 dbwrap_tool: remove the short form "-p" of "--persistent"
      from  f42d380 s3:brlock: fix a comment typo

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


- Log -----------------------------------------------------------------
commit 0b23345676c6f02d5bb1a327174d8456705ec0c7
Author: Stefan Metzmacher <[email protected]>
Date:   Tue Dec 24 09:00:01 2013 +0100

    s3:smbd: skip empty records in smbXsrv_open_cleanup()
    
    This should avoid scary ndr_pull errors, if there's
    a cleanup race.
    
    Signed-off-by: Stefan Metzmacher <[email protected]>
    Reviewed-by: Michael Adam <[email protected]>
    
    Autobuild-User(master): Stefan Metzmacher <[email protected]>
    Autobuild-Date(master): Thu Jan 30 18:49:37 CET 2014 on sn-devel-104

commit 6b2d67a345e90306f0d35402d0f4e3067a014057
Author: Michael Adam <[email protected]>
Date:   Fri Jan 24 00:09:50 2014 +0100

    smbd:smb2: fix durable reconnect: set fsp->fnum from the 
smbXsrv_open->local_id
    
    Originally, fsp->fnum was left at the INVALID fnum value.
    
    Signed-off-by: Michael Adam <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit e93f052e37e736e5776fe7f7c7d246f9ecc4b4c8
Author: Michael Adam <[email protected]>
Date:   Thu Jan 30 10:47:15 2014 +0100

    docs: remove extra spaces in synopsis of dbwrap_tool
    
    Signed-off-by: Michael Adam <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 1e3b352f799038ec25437db53e051dadb9d97c95
Author: Michael Adam <[email protected]>
Date:   Thu Jan 30 10:36:46 2014 +0100

    docs: document new --non-persistent option to dbwrap_tool
    
    Signed-off-by: Michael Adam <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit c3f93271ef447f9f16cd3002307c630c5f149f5a
Author: Michael Adam <[email protected]>
Date:   Thu Jan 30 10:29:49 2014 +0100

    dbwrap_tool: add option "--non-persistent" and force excatly one of 
"--[non-]persistent"
    
    We want to force users of dbwrap_tool to explicitly specify
    persistent or non-persistent. Otherwise, one could easily
    by accident wipe a whole database that is actually persistent
    but not currently opened by a samba process, just by openeing
    the DB with the default non-persistent mode...
    
    Signed-off-by: Michael Adam <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 6f748fef652bbea3c8dbbbfb96b95270e6f1dcfc
Author: Michael Adam <[email protected]>
Date:   Thu Jan 30 10:33:00 2014 +0100

    docs: remove short form "-p" of --persistent from dbwrap_tool manpage
    
    Signed-off-by: Michael Adam <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 6dd1008c4e8b0b798d589959021c9b578db74ff4
Author: Michael Adam <[email protected]>
Date:   Wed Jan 29 16:58:37 2014 +0100

    dbwrap_tool: remove the short form "-p" of "--persistent"
    
    Signed-off-by: Michael Adam <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

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

Summary of changes:
 docs-xml/manpages/dbwrap_tool.1.xml |   28 +++++++++++++++++++++-------
 source3/smbd/durable.c              |    1 +
 source3/smbd/smbXsrv_open.c         |    9 +++++++++
 source3/utils/dbwrap_tool.c         |   23 ++++++++++++++++++-----
 4 files changed, 49 insertions(+), 12 deletions(-)


Changeset truncated at 500 lines:

diff --git a/docs-xml/manpages/dbwrap_tool.1.xml 
b/docs-xml/manpages/dbwrap_tool.1.xml
index 8e979f6..0c27fad 100644
--- a/docs-xml/manpages/dbwrap_tool.1.xml
+++ b/docs-xml/manpages/dbwrap_tool.1.xml
@@ -19,7 +19,8 @@
 <refsynopsisdiv>
        <cmdsynopsis>
                <command>dbwrap_tool</command>
-               <arg choice="opt">-p|--persistent</arg>
+               <arg choice="opt">--persistent</arg>
+               <arg choice="opt">--non-persistent</arg>
                <arg choice="opt">-d &lt;debug level&gt;</arg>
                <arg choice="opt">-s &lt;config file&gt;</arg>
                <arg choice="opt">-l &lt;log file base&gt;</arg>
@@ -29,9 +30,7 @@
                <arg choice="req">&lt;operation&gt;</arg>
                <arg choice="opt">&lt;key&gt;
                        <arg choice="opt">&lt;type&gt;
-                               <arg choice="opt">&lt;value&gt;</arg>
-                       </arg>
-               </arg>
+                               <arg 
choice="opt">&lt;value&gt;</arg></arg></arg>
        </cmdsynopsis>
 </refsynopsisdiv>
 
@@ -70,10 +69,25 @@
 
        <variablelist>
                <varlistentry>
-                       <term>-p|--persistent</term>
+                       <term>--persistent</term>
                        <listitem><para>Open the database as a persistent 
database.
-                       If this option is not specified, the database is opened 
as
-                       non-persistent.
+                       </para>
+                       <para>
+                       Exactly one of --persistent and --non-persistent must be
+                       specified.
+                       </para></listitem>
+               </varlistentry>
+               <varlistentry>
+                       <term>--non-persistent</term>
+                       <listitem><para>Open the database as a non-persistent 
database.
+                       </para>
+                       <para>
+                       Caveat: opening a database as non-persistent when there
+                       is currently no other opener will wipe the database.
+                       </para>
+                       <para>
+                       Exactly one of --persistent and --non-persistent must be
+                       specified.
                        </para></listitem>
                </varlistentry>
                &popt.common.samba.client;
diff --git a/source3/smbd/durable.c b/source3/smbd/durable.c
index c5281a8..0da734e 100644
--- a/source3/smbd/durable.c
+++ b/source3/smbd/durable.c
@@ -717,6 +717,7 @@ NTSTATUS vfs_default_durable_reconnect(struct 
connection_struct *conn,
        fsp->share_access = e->share_access;
        fsp->can_read = ((fsp->access_mask & (FILE_READ_DATA)) != 0);
        fsp->can_write = ((fsp->access_mask & 
(FILE_WRITE_DATA|FILE_APPEND_DATA)) != 0);
+       fsp->fnum = op->local_id;
 
        /*
         * TODO:
diff --git a/source3/smbd/smbXsrv_open.c b/source3/smbd/smbXsrv_open.c
index 3566dc2..3e2fed3 100644
--- a/source3/smbd/smbXsrv_open.c
+++ b/source3/smbd/smbXsrv_open.c
@@ -1388,6 +1388,7 @@ NTSTATUS smbXsrv_open_cleanup(uint64_t persistent_id)
        struct smbXsrv_open_global0 *op = NULL;
        uint8_t key_buf[SMBXSRV_OPEN_GLOBAL_TDB_KEY_SIZE];
        TDB_DATA key;
+       TDB_DATA val;
        struct db_record *rec;
        bool delete_open = false;
        uint32_t global_id = persistent_id & UINT32_MAX;
@@ -1403,6 +1404,14 @@ NTSTATUS smbXsrv_open_cleanup(uint64_t persistent_id)
                goto done;
        }
 
+       val = dbwrap_record_get_value(rec);
+       if (val.dsize == 0) {
+               DEBUG(10, ("smbXsrv_open_cleanup[global: 0x%08x] "
+                         "empty record in %s, skipping...\n",
+                          global_id, dbwrap_name(smbXsrv_open_global_db_ctx)));
+               goto done;
+       }
+
        status = smbXsrv_open_global_parse_record(talloc_tos(), rec, &op);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(1, ("smbXsrv_open_cleanup[global: 0x%08x] "
diff --git a/source3/utils/dbwrap_tool.c b/source3/utils/dbwrap_tool.c
index 79b40d2..ffca6b6 100644
--- a/source3/utils/dbwrap_tool.c
+++ b/source3/utils/dbwrap_tool.c
@@ -411,6 +411,7 @@ int main(int argc, const char **argv)
        enum dbwrap_type type;
        const char *valuestr = "0";
        int persistent = 0;
+       int non_persistent = 0;
        int tdb_flags = TDB_DEFAULT;
 
        TALLOC_CTX *mem_ctx = talloc_stackframe();
@@ -420,7 +421,13 @@ int main(int argc, const char **argv)
        struct poptOption popt_options[] = {
                POPT_AUTOHELP
                POPT_COMMON_SAMBA
-               { "persistent", 'p', POPT_ARG_NONE, &persistent, 0, "treat the 
database as persistent", NULL },
+               { "non-persistent", 0, POPT_ARG_NONE, &non_persistent, 0,
+                 "treat the database as non-persistent "
+                 "(CAVEAT: This mode might wipe your database!)",
+                 NULL },
+               { "persistent", 0, POPT_ARG_NONE, &persistent, 0,
+                 "treat the database as persistent",
+                 NULL },
                POPT_TABLEEND
        };
        int opt;
@@ -463,6 +470,16 @@ int main(int argc, const char **argv)
                goto done;
        }
 
+       if ((persistent == 0 && non_persistent == 0) ||
+           (persistent == 1 && non_persistent == 1))
+       {
+               d_fprintf(stderr, "ERROR: you must specify exactly one "
+                         "of --persistent and --non-persistent\n");
+               goto done;
+       } else if (non_persistent == 1) {
+               tdb_flags |= TDB_CLEAR_IF_FIRST;
+       }
+
        dbname = extra_argv[0];
        opname = extra_argv[1];
 
@@ -563,10 +580,6 @@ int main(int argc, const char **argv)
                goto done;
        }
 
-       if (persistent == 0) {
-               tdb_flags |= TDB_CLEAR_IF_FIRST;
-       }
-
        switch (op) {
        case OP_FETCH:
        case OP_STORE:


-- 
Samba Shared Repository

Reply via email to