[SCM] Samba Shared Repository - branch v4-7-stable updated

Karolin Seeger kseeger at samba.org
Tue Jul 25 09:14:30 UTC 2017


The branch, v4-7-stable has been updated
       via  ce4fa8f VERSION: Disable GIT_SNAPSHOTS for the 4.7.0rc3 release.
       via  fabbc51 WHATSNEW: Add release notes for Samba 4.7.0rc3.
       via  54088c0 s3: drop build_env
       via  1335e7a s3: smbd: Fix a read after free if a chained SMB1 call goes async.
       via  8d7bf8c s3: libsmb: Fix use-after-free when accessing pointer *p.
       via  60949fc smbd: Fix a connection run-down race condition
       via  0b24182 s3/notifyd: ensure notifyd doesn't return from smbd_notifyd_init
       via  7933732 Build py3 versions of other rpc modules
       via  18d0708 py3: Make sure to specify METH_VARARGS together with METH_KEYWORDS
       via  2a16228 s3: smbclient: Add a test for the setmode command.
       via  d426120 s3: libsmb: Reverse sense of 'clear all attributes', ignore attribute change in SMB2 to match SMB1.
       via  b51aa15 ctdb-common: Set close-on-exec when creating PID file
       via  0f40c21 vfs_fruit: don't use MS NFS ACEs with Windows clients
       via  961266e dbwrap_ctdb: Fix calculation of persistent flag
       via  7439394 dbwrap: Ask CTDB for local tdb open flags
       via  a577510 ctdbd_conn: pass persistent bool instead of tdb_flags
       via  d12832f ctdbd_conn: move CTDB_CONTROL_ENABLE_SEQNUM control to db_open_ctdb
       via  fcb08f7 dbwrap: CTDB ignores tdb_flags passed to db attach controls
       via  5afede8 dbwrap: enable mutexes by default for volatile TDBs
       via  28f8439 ctdb: enable mutexes for volatile TDBs by default
       via  683b107 s3/vfs: rename SMB_VFS_STRICT_LOCK to SMB_VFS_STRICT_LOCK_CHECK
       via  e44257a s3/vfs: remove SMB_VFS_STRICT_UNLOCK
       via  8559b2e s3:client: The smbspool krb5 wrapper needs negotiate for authentication
       via  f6b1a53 vfs_fruit: add fruit:model = <modelname> parametric option
       via  3cb73b1 idmap_ad: Retry query_user exactly once if we get TLDAP_SERVER_DOWN
       via  892c3aa tevent: version 0.9.33
       via  ce417f5 tevent: handle passing req = NULL to tevent_req_print()
       via  3d87c06 tevent: avoid calling talloc_get_name(NULL) in tevent_req_default_print()
       via  50845aa ldb: version 1.2.1
       via  bed75c1 ldb/tests: more thoroughly test empty ldb_msg elements
       via  7eda7c5 ldb: avoid searching empty lists in ldb_msg_find_common_values
       via  1f9e8f5 ldb: Fix index out of bound in ldb_msg_find_common_values
       via  9998480 ldb: Use libraries from build dir for testsuite
       via  895bd0d WHATSNEW: add a note about the new 'smbclient deltree' command.
       via  9940042 s3:tests: Fix directory creation and deletion of test_nosymlinks()
       via  293fa76 s3:tests: Fix directory creation and deletion of test_local_symlinks()
       via  3b2d806 s3: tests: Add test for new smbclient "deltree" command.
       via  265070f docs: Document new smbclient deltree command.
       via  d5471ab s3: smbclient: Add new command deltree.
       via  413436b s3: client: Move struct file_list code to using talloc from malloc.
       via  28396c1 WHATSNEW: move the CTDB changes section before the Parameter changes
       via  7cf9a52 unittests: Add missing stdint.h include
       via  a235bb4 WHATSNEW: CTDB changes for 4.7
       via  dc35068 Add code to run the tests for 'samba-tool user edit'
       via  a1874cd Add test for 'samba-tool user edit'
       via  ec0545f Easily edit a users object in AD, as if using ldbedit.
       via  21f9477 waf: Only build unit tests with selftest enabled
       via  fdd1dc7 s3:smbd: consistently use talloc_tos() memory for rpc_pipe_open_interface()
       via  c6d2d56 selftest: add a test for accessing previous version of directories with snapdirseverywhere
       via  b1916bf s3/smbd: let non_widelink_open() chdir() to directories directly
       via  08f8402 unittests: Do not install the test_dummy rpc module
       via  e1b217c waf: Do not install _ldb_text.py if we have system libldb
       via  3d9dddb VERSION: Bump version up to 4.6.0rc3...
      from  27d4dfb VERSION: Disable GIT_SNAPSHOTS for the 4.7.0rc2 release

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-7-stable


- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 VERSION                                            |   2 +-
 WHATSNEW.txt                                       | 110 ++++++++-
 buildtools/wafsamba/samba_patterns.py              |  14 --
 ctdb/common/pidfile.c                              |   8 +
 ctdb/common/tunable.c                              |   2 +-
 ctdb/config/ctdbd.conf                             |   2 +-
 ctdb/doc/ctdb-tunables.7.xml                       |   2 +-
 ctdb/doc/ctdb.1.xml                                |   2 +-
 ctdb/tests/tool/ctdb.listvars.001.sh               |   2 +-
 docs-xml/manpages/smbclient.1.xml                  |  10 +
 docs-xml/manpages/vfs_fruit.8.xml                  |   9 +
 examples/VFS/skel_opaque.c                         |  16 +-
 examples/VFS/skel_transparent.c                    |  18 +-
 lib/ldb/ABI/{ldb-1.2.0.sigs => ldb-1.2.1.sigs}     |   0
 ...yldb-util-1.1.10.sigs => pyldb-util-1.2.1.sigs} |   0
 ...-util-1.1.10.sigs => pyldb-util.py3-1.2.1.sigs} |   0
 lib/ldb/common/ldb_msg.c                           |  13 +-
 lib/ldb/tests/ldb_msg.c                            |  32 ++-
 lib/ldb/wscript                                    |  22 +-
 .../ABI/{tevent-0.9.31.sigs => tevent-0.9.33.sigs} |   0
 lib/tevent/tevent_req.c                            |   6 +-
 lib/tevent/wscript                                 |   2 +-
 python/samba/netcmd/user.py                        | 139 ++++++++++-
 python/samba/tests/samba_tool/edit.sh              |  72 ++++++
 source3/client/client.c                            | 207 +++++++++++++++-
 source3/client/smbspool_krb5_wrapper.c             |  29 ++-
 source3/include/ctdbd_conn.h                       |   2 +-
 source3/include/vfs.h                              |  22 +-
 source3/include/vfs_macros.h                       |  13 +-
 source3/lib/ctdbd_conn.c                           |  20 +-
 source3/lib/dbwrap/dbwrap_ctdb.c                   |  43 +++-
 source3/lib/dbwrap/dbwrap_open.c                   |   2 +-
 source3/libsmb/cli_smb2_fnum.c                     |  23 ++
 source3/libsmb/libsmb_dir.c                        |   6 +-
 source3/locking/locking.c                          |   6 +-
 source3/locking/proto.h                            |   6 +-
 source3/modules/vfs_btrfs.c                        |   9 +-
 source3/modules/vfs_catia.c                        |  28 +--
 source3/modules/vfs_default.c                      |  80 +++---
 source3/modules/vfs_fruit.c                        |  12 +-
 source3/modules/vfs_full_audit.c                   |  30 +--
 source3/modules/vfs_glusterfs.c                    |   3 +-
 source3/modules/vfs_time_audit.c                   |  30 +--
 source3/script/build_env.sh                        |  41 ----
 source3/script/tests/test_shadow_copy.sh           |  23 ++
 source3/script/tests/test_smbclient_s3.sh          | 272 +++++++++++++++++++--
 source3/smbd/aio.c                                 |  28 +--
 source3/smbd/lanman.c                              |  20 +-
 source3/smbd/open.c                                |  30 ++-
 source3/smbd/process.c                             |   2 +-
 source3/smbd/reply.c                               |  93 +++----
 source3/smbd/server.c                              |   8 +-
 source3/smbd/smb2_ioctl_filesys.c                  |   5 +-
 source3/smbd/smb2_read.c                           |   8 +-
 source3/smbd/smb2_write.c                          |   4 +-
 source3/smbd/vfs.c                                 |  18 +-
 source3/winbindd/idmap_ad.c                        |  19 +-
 source3/wscript_build                              |   8 -
 source4/libnet/py_net.c                            |   2 +-
 source4/librpc/wscript_build                       | 242 +++++++++---------
 source4/selftest/tests.py                          |   4 +
 source4/torture/vfs/fruit.c                        |   8 +-
 testsuite/unittests/test_sambafs_srv_pipe.c        |   1 +
 testsuite/unittests/wscript                        |   3 +-
 wscript                                            |   2 +-
 wscript_build                                      |   3 +-
 66 files changed, 1304 insertions(+), 594 deletions(-)
 copy lib/ldb/ABI/{ldb-1.2.0.sigs => ldb-1.2.1.sigs} (100%)
 copy lib/ldb/ABI/{pyldb-util-1.1.10.sigs => pyldb-util-1.2.1.sigs} (100%)
 copy lib/ldb/ABI/{pyldb-util-1.1.10.sigs => pyldb-util.py3-1.2.1.sigs} (100%)
 copy lib/tevent/ABI/{tevent-0.9.31.sigs => tevent-0.9.33.sigs} (100%)
 create mode 100755 python/samba/tests/samba_tool/edit.sh
 delete mode 100755 source3/script/build_env.sh


Changeset truncated at 500 lines:

diff --git a/VERSION b/VERSION
index 12b20ea..ba67ae3 100644
--- a/VERSION
+++ b/VERSION
@@ -87,7 +87,7 @@ SAMBA_VERSION_PRE_RELEASE=
 # e.g. SAMBA_VERSION_RC_RELEASE=1                      #
 #  ->  "3.0.0rc1"                                      #
 ########################################################
-SAMBA_VERSION_RC_RELEASE=2
+SAMBA_VERSION_RC_RELEASE=3
 
 ########################################################
 # To mark SVN snapshots this should be set to 'yes'    #
diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index 73daedf..3bddec7 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -1,7 +1,7 @@
 Release Announcements
 =====================
 
-This is the second release candidate of Samba 4.7.  This is *not*
+This is the third release candidate of Samba 4.7.  This is *not*
 intended for production environments and is designed for testing
 purposes only.  Please report any defects via the Samba bug reporting
 system at https://bugzilla.samba.org/.
@@ -41,6 +41,9 @@ getfacl and symlink. Using "-mNT1" reenabled them, if the server supports SMB1.
 Note the default ("CORE") for "client min protocol" hasn't changed,
 so it's still possible to connect to SMB1-only servers by default.
 
+smbclient learned a new command "deltree" that is able to do
+a recursive deletion of a directory tree.
+
 
 NEW FEATURES/CHANGES
 ====================
@@ -75,7 +78,6 @@ LDAP read inconsistency
 See https://bugzilla.samba.org/show_bug.cgi?id=12858 for more details
 and updated advise on database recovery for affected installations.
 
-
 Samba AD with MIT Kerberos
 --------------------------
 
@@ -241,6 +243,50 @@ the talloc_autofree_context() (which is inherently thread-unsafe)
 and still be valgrind-clean on exit. Modules that don't need to
 free long-lived data on exit should use the NULL talloc context.
 
+CTDB changes
+------------
+
+* CTDB no longer allows mixed minor versions in a cluster
+
+  See the AllowMixedVersions tunable option in ctdb-tunables(7) and also
+  https://wiki.samba.org/index.php/Upgrading_a_CTDB_cluster#Policy
+
+* CTDB now ignores hints from Samba about TDB flags when attaching to databases
+
+  CTDB will use the correct flags depending on the type of database.
+  For clustered databases, the smb.conf setting
+  dbwrap_tdb_mutexes:*=true will be ignored. Instead, CTDB continues
+  to use the TDBMutexEnabled tunable.
+
+* New configuration variable CTDB_NFS_CHECKS_DIR
+
+  See ctdbd.conf(5) for more details.
+
+* The CTDB_SERVICE_AUTOSTARTSTOP configuration variable has been
+  removed
+
+  To continue to manage/unmanage services while CTDB is running:
+
+  - Start service by hand and then flag it as managed
+
+  - Mark service as unmanaged and shut it down by hand
+
+  - In some cases CTDB does something fancy - e.g. start Samba under
+    "nice", so care is needed. One technique is to disable the
+    eventscript, mark as managed, run the startup event by hand and then
+    re-enable the eventscript.
+
+* The CTDB_SCRIPT_DEBUGLEVEL configuration variable has been removed
+
+* The example NFS Ganesha call-out has been improved
+
+* A new "replicated" database type is available
+
+  Replicated databases are intended for CTDB's internal use to
+  replicate state data across the cluster, but may find other
+  uses. The data in replicated databases is valid for the lifetime of
+  CTDB and cleared on first attach.
+
 Parameter changes
 -----------------
 
@@ -256,6 +302,7 @@ the previous behaviour.  Two new values have been provided,
 and 'disabled', totally disabling NTLM authentication and password
 changes.
 
+
 smb.conf changes
 ================
 
@@ -283,6 +330,65 @@ KNOWN ISSUES
 https://wiki.samba.org/index.php/Release_Planning_for_Samba_4.7#Release_blocking_bugs
 
 
+CHANGES SINCE 4.7.0rc2
+======================
+
+o  Jeremy Allison <jra at samba.org>
+   * BUG 12836: s3: smbd: Fix a read after free if a chained SMB1 call goes
+     async.
+   * BUG 12899: s3: libsmb: Reverse sense of 'clear all attributes', ignore
+     attribute change in SMB2 to match SMB1.
+   * BUG 12914: s3: smbclient: Add new command deltree.
+
+o  Ralph Boehme <slow at samba.org>
+   * BUG 12885: s3/smbd: Let non_widelink_open() chdir() to directories
+     directly.
+   * BUG 12887: Remove SMB_VFS_STRICT_UNLOCK noop from the VFS.
+   * BUG 12891: Enable TDB mutexes in dbwrap and ctdb.
+   * BUG 12897: vfs_fruit: don't use MS NFS ACEs with Windows clients.
+   * BUG 12910: s3/notifyd: Ensure notifyd doesn't return from
+     smbd_notifyd_init.
+
+o  Alexander Bokovoy <ab at samba.org>
+   * BUG 12905: Build py3 versions of other rpc modules.
+
+o  Günther Deschner <gd at samba.org>
+   * BUG 12840: vfs_fruit: Add "fruit:model = <modelname>" parametric option.
+
+o  Dustin L. Howett
+   * BUG 12720: idmap_ad: Retry query_user exactly once if we get
+     TLDAP_SERVER_DOWN.
+
+o  Amitay Isaacs <amitay at gmail.com>
+   * BUG 12891: dbwrap_ctdb: Fix calculation of persistent flag.
+
+o  Thomas Jarosch <thomas.jarosch at intra2net.com>
+   * BUG 12927: s3: libsmb: Fix use-after-free when accessing pointer *p.
+
+o  Volker Lendecke <vl at samba.org>
+   * BUG 12925: smbd: Fix a connection run-down race condition.
+
+o  Stefan Metzmacher <metze at samba.org>
+   * tevent: version 0.9.33: make tevent_req_print() more robust against crashes.
+   * ldb: version 1.2.1
+   * BUG 12882: Do not install _ldb_text.py if we have system libldb.
+   * BUG 12890: s3:smbd: consistently use talloc_tos() memory for
+     rpc_pipe_open_interface().
+   * BUG 12900: Fix index out of bound in ldb_msg_find_common_values.
+
+o  Rowland Penny <rpenny at samba.org>
+   * BUG 12884: Easily edit a users object in AD, as if using 'ldbedit'.
+
+o  Bernhard M. Wiedemann <bwiedemann at suse.de>
+   * BUG 12906: s3: drop build_env
+
+o  Andreas Schneider <asn at samba.org>
+   * BUG 12882: waf: Do not install _ldb_text.py if we have system libldb.
+
+o  Martin Schwenke <martin at meltin.net>
+   * BUG 12898: ctdb-common: Set close-on-exec when creating PID file.
+
+
 CHANGES SINCE 4.7.0rc1
 ======================
 
diff --git a/buildtools/wafsamba/samba_patterns.py b/buildtools/wafsamba/samba_patterns.py
index 1baa601..e809f26 100644
--- a/buildtools/wafsamba/samba_patterns.py
+++ b/buildtools/wafsamba/samba_patterns.py
@@ -51,7 +51,6 @@ def write_build_options_header(fp):
     fp.write("*/\n")
     fp.write("\n")
     fp.write("#include \"includes.h\"\n")
-    fp.write("#include \"build_env.h\"\n")
     fp.write("#include \"dynconfig/dynconfig.h\"\n")
     fp.write("#include \"lib/cluster_support.h\"\n")
 
@@ -92,19 +91,6 @@ def write_build_options_header(fp):
     fp.write("              return;\n")
     fp.write("       }\n")
     fp.write("\n")
-    fp.write("#ifdef _BUILD_ENV_H\n")
-    fp.write("       /* Output information about the build environment */\n")
-    fp.write("       output(screen,\"Build environment:\\n\");\n")
-    fp.write("       output(screen,\"   Built by:    %s@%s\\n\",BUILD_ENV_USER,BUILD_ENV_HOST);\n")
-    fp.write("       output(screen,\"   Built on:    %s\\n\",BUILD_ENV_DATE);\n")
-    fp.write("\n")
-    fp.write("       output(screen,\"   Built using: %s\\n\",BUILD_ENV_COMPILER);\n")
-    fp.write("       output(screen,\"   Build host:  %s\\n\",BUILD_ENV_UNAME);\n")
-    fp.write("       output(screen,\"   SRCDIR:      %s\\n\",BUILD_ENV_SRCDIR);\n")
-    fp.write("       output(screen,\"   BUILDDIR:    %s\\n\",BUILD_ENV_BUILDDIR);\n")
-    fp.write("\n")
-    fp.write("\n")
-    fp.write("#endif\n")
     fp.write("\n")
     fp.write("       /* Output various paths to files and directories */\n")
     fp.write("       output(screen,\"\\nPaths:\\n\");\n")
diff --git a/ctdb/common/pidfile.c b/ctdb/common/pidfile.c
index b3f29e3..51c0c25 100644
--- a/ctdb/common/pidfile.c
+++ b/ctdb/common/pidfile.c
@@ -22,6 +22,8 @@
 
 #include <talloc.h>
 
+#include "lib/util/blocking.h"
+
 #include "common/pidfile.h"
 
 struct pidfile_context {
@@ -61,6 +63,12 @@ int pidfile_create(TALLOC_CTX *mem_ctx, const char *pidfile,
 		goto fail;
 	}
 
+	if (! set_close_on_exec(fd)) {
+		close(fd);
+		ret = EIO;
+		goto fail;
+	}
+
 	pid_ctx->fd = fd;
 
 	lck = (struct flock) {
diff --git a/ctdb/common/tunable.c b/ctdb/common/tunable.c
index ed7a52d..14f6828 100644
--- a/ctdb/common/tunable.c
+++ b/ctdb/common/tunable.c
@@ -145,7 +145,7 @@ static struct {
 		offsetof(struct ctdb_tunable_list, no_ip_host_on_all_disabled) },
 	{ "Samba3AvoidDeadlocks", 0, true,
 		offsetof(struct ctdb_tunable_list, samba3_hack) },
-	{ "TDBMutexEnabled", 0, false,
+	{ "TDBMutexEnabled", 1, false,
 		offsetof(struct ctdb_tunable_list, mutex_enabled) },
 	{ "LockProcessesPerDB", 200, false,
 		offsetof(struct ctdb_tunable_list, lock_processes_per_db) },
diff --git a/ctdb/config/ctdbd.conf b/ctdb/config/ctdbd.conf
index e75c65c..2d525c5 100644
--- a/ctdb/config/ctdbd.conf
+++ b/ctdb/config/ctdbd.conf
@@ -29,4 +29,4 @@
 # CTDB_DEBUGLEVEL=ERR
 
 # Set some CTDB tunable variables during CTDB startup?
-# CTDB_SET_TDBMutexEnabled=1
+# CTDB_SET_TDBMutexEnabled=0
diff --git a/ctdb/doc/ctdb-tunables.7.xml b/ctdb/doc/ctdb-tunables.7.xml
index d0bb450..7b059b7 100644
--- a/ctdb/doc/ctdb-tunables.7.xml
+++ b/ctdb/doc/ctdb-tunables.7.xml
@@ -658,7 +658,7 @@
 
     <refsect2>
       <title>TDBMutexEnabled</title>
-      <para>Default: 0</para>
+      <para>Default: 1</para>
       <para>
 	This parameter enables TDB_MUTEX_LOCKING feature on volatile
 	databases if the robust mutexes are supported. This optimizes the
diff --git a/ctdb/doc/ctdb.1.xml b/ctdb/doc/ctdb.1.xml
index 1af1f50..3aceb73 100644
--- a/ctdb/doc/ctdb.1.xml
+++ b/ctdb/doc/ctdb.1.xml
@@ -843,7 +843,7 @@ DBRecordSizeWarn        = 10000000
 DBSizeWarn              = 100000000
 PullDBPreallocation     = 10485760
 NoIPHostOnAllDisabled   = 0
-TDBMutexEnabled         = 0
+TDBMutexEnabled         = 1
 LockProcessesPerDB      = 200
 RecBufferSizeLimit      = 1000000
 QueueBufferSize         = 1024
diff --git a/ctdb/tests/tool/ctdb.listvars.001.sh b/ctdb/tests/tool/ctdb.listvars.001.sh
index f6010a4..fc8f42c 100755
--- a/ctdb/tests/tool/ctdb.listvars.001.sh
+++ b/ctdb/tests/tool/ctdb.listvars.001.sh
@@ -59,7 +59,7 @@ DBRecordSizeWarn           = 10000000
 DBSizeWarn                 = 100000000
 PullDBPreallocation        = 10485760
 NoIPHostOnAllDisabled      = 0
-TDBMutexEnabled            = 0
+TDBMutexEnabled            = 1
 LockProcessesPerDB         = 200
 RecBufferSizeLimit         = 1000000
 QueueBufferSize            = 1024
diff --git a/docs-xml/manpages/smbclient.1.xml b/docs-xml/manpages/smbclient.1.xml
index 2b712fe..432f60d 100644
--- a/docs-xml/manpages/smbclient.1.xml
+++ b/docs-xml/manpages/smbclient.1.xml
@@ -655,6 +655,16 @@
 		</varlistentry>
 
 		<varlistentry>
+		<term>deltree <mask></term>
+		<listitem><para>The client will request that the server attempt
+		to delete all files and directories matching <replaceable>mask</replaceable> from the current working
+		directory on the server. Note this will recursively delete files and directories within
+		the directories selected even without the recurse command being set. If any of the delete
+		requests fail the command will stop processing at that point, leaving files and directories
+		not yet processed untouched. This is by design.</para></listitem>
+		</varlistentry>
+
+		<varlistentry>
 		<term>dir <mask></term>
 		<listitem><para>A list of the files matching <replaceable>mask</replaceable> in the current
 		working directory on the server will be retrieved from the server
diff --git a/docs-xml/manpages/vfs_fruit.8.xml b/docs-xml/manpages/vfs_fruit.8.xml
index 0bddd4a..1637a77 100644
--- a/docs-xml/manpages/vfs_fruit.8.xml
+++ b/docs-xml/manpages/vfs_fruit.8.xml
@@ -160,6 +160,15 @@
 	    </listitem>
 	  </varlistentry>
 
+	  <varlistentry>
+	    <term>fruit:model = MacSamba</term>
+	    <listitem>
+	      <para>This option defines the model string inside the AAPL
+	      extension and will determine the appearance of the icon representing the
+	      Samba server in the Finder window.</para>
+	      <para>The default is <emphasis>MacSamba</emphasis>.</para>
+	    </listitem>
+	  </varlistentry>
 	</variablelist>
 </refsect1>
 
diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c
index fed9d2f..614dcff 100644
--- a/examples/VFS/skel_opaque.c
+++ b/examples/VFS/skel_opaque.c
@@ -687,21 +687,14 @@ static bool skel_brl_cancel_windows(struct vfs_handle_struct *handle,
 	return false;
 }
 
-static bool skel_strict_lock(struct vfs_handle_struct *handle,
-			     struct files_struct *fsp,
-			     struct lock_struct *plock)
+static bool skel_strict_lock_check(struct vfs_handle_struct *handle,
+				   struct files_struct *fsp,
+				   struct lock_struct *plock)
 {
 	errno = ENOSYS;
 	return false;
 }
 
-static void skel_strict_unlock(struct vfs_handle_struct *handle,
-			       struct files_struct *fsp,
-			       struct lock_struct *plock)
-{
-	;
-}
-
 static NTSTATUS skel_translate_name(struct vfs_handle_struct *handle,
 				    const char *mapped_name,
 				    enum vfs_translate_direction direction,
@@ -1022,8 +1015,7 @@ struct vfs_fn_pointers skel_opaque_fns = {
 	.brl_lock_windows_fn = skel_brl_lock_windows,
 	.brl_unlock_windows_fn = skel_brl_unlock_windows,
 	.brl_cancel_windows_fn = skel_brl_cancel_windows,
-	.strict_lock_fn = skel_strict_lock,
-	.strict_unlock_fn = skel_strict_unlock,
+	.strict_lock_check_fn = skel_strict_lock_check,
 	.translate_name_fn = skel_translate_name,
 	.fsctl_fn = skel_fsctl,
 	.readdir_attr_fn = skel_readdir_attr,
diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c
index d9123e0..2f59a3d 100644
--- a/examples/VFS/skel_transparent.c
+++ b/examples/VFS/skel_transparent.c
@@ -856,18 +856,11 @@ static bool skel_brl_cancel_windows(struct vfs_handle_struct *handle,
 	return SMB_VFS_NEXT_BRL_CANCEL_WINDOWS(handle, br_lck, plock);
 }
 
-static bool skel_strict_lock(struct vfs_handle_struct *handle,
-			     struct files_struct *fsp,
-			     struct lock_struct *plock)
+static bool skel_strict_lock_check(struct vfs_handle_struct *handle,
+				   struct files_struct *fsp,
+				   struct lock_struct *plock)
 {
-	return SMB_VFS_NEXT_STRICT_LOCK(handle, fsp, plock);
-}
-
-static void skel_strict_unlock(struct vfs_handle_struct *handle,
-			       struct files_struct *fsp,
-			       struct lock_struct *plock)
-{
-	SMB_VFS_NEXT_STRICT_UNLOCK(handle, fsp, plock);
+	return SMB_VFS_NEXT_STRICT_LOCK_CHECK(handle, fsp, plock);
 }
 
 static NTSTATUS skel_translate_name(struct vfs_handle_struct *handle,
@@ -1195,8 +1188,7 @@ struct vfs_fn_pointers skel_transparent_fns = {
 	.brl_lock_windows_fn = skel_brl_lock_windows,
 	.brl_unlock_windows_fn = skel_brl_unlock_windows,
 	.brl_cancel_windows_fn = skel_brl_cancel_windows,
-	.strict_lock_fn = skel_strict_lock,
-	.strict_unlock_fn = skel_strict_unlock,
+	.strict_lock_check_fn = skel_strict_lock_check,
 	.translate_name_fn = skel_translate_name,
 	.fsctl_fn = skel_fsctl,
 	.readdir_attr_fn = skel_readdir_attr,
diff --git a/lib/ldb/ABI/ldb-1.2.0.sigs b/lib/ldb/ABI/ldb-1.2.1.sigs
similarity index 100%
copy from lib/ldb/ABI/ldb-1.2.0.sigs
copy to lib/ldb/ABI/ldb-1.2.1.sigs
diff --git a/lib/ldb/ABI/pyldb-util-1.1.10.sigs b/lib/ldb/ABI/pyldb-util-1.2.1.sigs
similarity index 100%
copy from lib/ldb/ABI/pyldb-util-1.1.10.sigs
copy to lib/ldb/ABI/pyldb-util-1.2.1.sigs
diff --git a/lib/ldb/ABI/pyldb-util-1.1.10.sigs b/lib/ldb/ABI/pyldb-util.py3-1.2.1.sigs
similarity index 100%
copy from lib/ldb/ABI/pyldb-util-1.1.10.sigs
copy to lib/ldb/ABI/pyldb-util.py3-1.2.1.sigs
diff --git a/lib/ldb/common/ldb_msg.c b/lib/ldb/common/ldb_msg.c
index abad5a8..c2782db 100644
--- a/lib/ldb/common/ldb_msg.c
+++ b/lib/ldb/common/ldb_msg.c
@@ -207,6 +207,9 @@ int ldb_msg_find_common_values(struct ldb_context *ldb,
 	if (strcmp(el->name, el2->name) != 0) {
 		return LDB_ERR_INAPPROPRIATE_MATCHING;
 	}
+	if (el->num_values == 0 || el2->num_values == 0) {
+		return LDB_SUCCESS;
+	}
 	/*
 	   With few values, it is better to do the brute-force search than the
 	   clever search involving tallocs, memcpys, sorts, etc.
@@ -262,20 +265,12 @@ int ldb_msg_find_common_values(struct ldb_context *ldb,
 	n_values = el->num_values;
 	i = 0;
 	j = 0;
-	while (i != n_values) {
+	while (i != n_values && j < el2->num_values) {
 		int ret = ldb_val_cmp(&values[i], &values2[j]);
 		if (ret < 0) {
 			i++;
 		} else if (ret > 0) {
 			j++;
-			if (j == el2->num_values) {
-				/*
-				  We have walked past the end of the second
-				  list, meaning the remainder of the first
-				  list cannot collide and we're done.
-				*/
-				break;
-			}
 		} else {
 			/* we have a collision */
 			if (! remove_duplicates) {
diff --git a/lib/ldb/tests/ldb_msg.c b/lib/ldb/tests/ldb_msg.c
index e665d55..f8de418 100644
--- a/lib/ldb/tests/ldb_msg.c
+++ b/lib/ldb/tests/ldb_msg.c
@@ -87,6 +87,11 @@ static void test_ldb_msg_find_duplicate_val(void **state)
 	ret = ldb_msg_add_empty(msg, "el1", 0, &el);
 	assert_int_equal(ret, LDB_SUCCESS);
 
+	/* An empty message contains no duplicates */
+	ret = ldb_msg_find_duplicate_val(NULL, test_ctx, el, &dupe, 0);
+	assert_int_equal(ret, LDB_SUCCESS);
+	assert_null(dupe);
+
 	for (i = 0; i < 5; i++) {
 		add_uint_value(test_ctx, msg, "el1", i);
 	}
@@ -176,19 +181,19 @@ static void _assert_element_equal(struct ldb_message_element *a,
 static void test_ldb_msg_find_common_values(void **state)
 {
 	/* we only use the state as a talloc context */
-	struct ldb_message_element *el, *el2, *el3, *el4, *el2b;
+	struct ldb_message_element *el, *el2, *el3, *el4, *el2b, *empty;
 	struct ldb_message_element *orig, *orig2, *orig3, *orig4;
 	int ret;
 	const uint32_t remove_dupes = LDB_MSG_FIND_COMMON_REMOVE_DUPLICATES;
 	el = new_msg_element(*state, "test", 0, 4);
 	el2 = new_msg_element(*state, "test", 4, 4);
 	el3 = new_msg_element(*state, "test", 6, 4);
+	empty = new_msg_element(*state, "test", 0, 0);
 	orig = new_msg_element(*state, "test", 0, 4);
 	orig2 = new_msg_element(*state, "test", 4, 4);
 	orig3 = new_msg_element(*state, "test", 6, 4);
 
 	/* first round is with short value arrays, using quadratic method */
-
 	/* we expect no collisions here */
 	ret = ldb_msg_find_common_values(NULL, *state, el, el2, 0);
 	assert_int_equal(ret, LDB_SUCCESS);
@@ -256,7 +261,7 @@ static void test_ldb_msg_find_common_values(void **state)
 	assert_element_equal(el2, orig2);
 	assert_int_equal(el3->num_values, 0);
 
-	/* seeing as we have an empty element, try permutations therewith.
+	/* permutations involving empty elements.
 	   everything should succeed. */
 	ret = ldb_msg_find_common_values(NULL, *state, el3, el2, 0);


-- 
Samba Shared Repository



More information about the samba-cvs mailing list