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

Jule Anger janger at samba.org
Tue Aug 23 14:50:41 UTC 2022


The branch, v4-17-stable has been updated
       via  c15dfcca9f5 VERSION: Disable GIT_SNAPSHOT for the 4.17.0rc3 release.
       via  d9f7e8d41b7 WHATSNEW: Add release notes for Samba 4.17.0rc3.
       via  4d37152c666 smbd: directly pass fsp to SMB_VFS_FGETXATTR() in fget_ea_dos_attribute()
       via  25d6dcd8897 smbd: add and use vfs_fget_dos_attributes()
       via  9df07ee0fa5 smbtorture: add test smb2.stream.attributes2
       via  81be412fb01 smbtorture: rename smb2.streams.attributes to smb2.streams.attributes1
       via  0d0eff66058 vfs_default: assert all passed in fsp's and names are non-stream type
       via  f2272106f36 vfs_streams_xattr: restrict which fcntl's are allowed on streams
       via  aca819549c3 smbd: skip access checks for stat-opens on streams in open_file()
       via  7c713f386f3 smbd: use metadata_fsp() in get_acl_group_bits()
       via  107af8fd98b smbd: ignore request to set the SPARSE attribute on streams
       via  69742bab667 smbd: use metadata_fsp() with SMB_VFS_FSET_DOS_ATTRIBUTES()
       via  814fd4e8e89 smbd: use metadata_fsp() with SMB_VFS_FGET_DOS_ATTRIBUTES()
       via  1434b66f2a1 smbd: use metadata_fsp() with SMB_VFS_FSET_NT_ACL()
       via  ba468a9b416 smbd: use metadata_fsp() with SMB_VFS_FGET_NT_ACL()
       via  ab76ab52c39 CI: add a test trying to delete a stream on a pathref ("stat open") handle
       via  3994f71f039 vfs_xattr_tdb: add "xattr_tdb:ignore_user_xattr" option
       via  aa85dac1e95 vfs_xattr_tdb: add a module config
       via  bae285ed702 vfs_xattr_tdb: move close_xattr_db()
       via  f23ef830bc7 smdb: use fsp_is_alternate_stream() in open_file()
       via  721ea813b54 waf: Fix SO version number of libsamba-errors
       via  fbcb8db069c WHATSNEW: document new volume serial number smb.conf parameter
       via  0b15ebced78 s3:smbd: let delay_for_oplock_fn() only call leases_db_get() once
       via  cb63afbda1b s3:smbd: lease_match_break_fn() only needs leases_db_get() once
       via  e764e40ad55 s3:smbd: inline fsp_lease_type_is_exclusive() logic into contend_level2_oplocks_begin_default
       via  fa8d19056bd s3:locking: move get_existing_share_mode_lock() to share_mode_lock.[ch]
       via  411af5fb48c s3:locking: pass lease_key explicitly to set_share_mode()
       via  6bf37ba4538 s3:smbd: only run validate_oplock_types() with smbd:validate_oplock_types = yes
       via  f207ef33224 s3:g_lock: avoid useless talloc_array(0) in g_lock_dump()
       via  e4538e70cbe s3:g_lock: add some const to the shared array passed via g_lock_dump*()
       via  208037a7eea lib/util: add unlikely() to SMB_ASSERT()
       via  76bff90824a s3: smbd: Plumb close_type parameter through close_file_in_loop(), file_close_conn()
       via  91273a969ab s3: smbd: Add "enum file_close_type close_type" parameter to file_close_conn().
       via  5fc9bf0f63c s3: smbd: Add "enum file_close_type close_type" parameter to close_cnum().
       via  c47b7479e74 s3/smbd: Use after free when iterating smbd_server_connection->connections
       via  0b33961e71a s3/smbd: Use after free when iterating smbd_server_connection->connections
       via  0725e1ea851 s3:utils remove documentation of -l as alias for --long
       via  c4c99397c56 s3:smbd: only clear LEASE_READ if there's no read lease is left
       via  0529214b3cc s4:torture/smb2: add smb2.lease.v[1,2]_bug_15148
       via  6ac28f43868 s3:smbd: share_mode_flags_set() takes SMB2_LEASE_* values
       via  e3ee5197a6d libcli/smb: Set error status if 'iov' pointer is NULL
       via  dee2505716d libcli/smb: Ensure we call tevent_req_nterror() on failure
       via  877287e6b4e VERSION: Bump version up to Samba 4.17.0rc3...
      from  8e1f74303ee VERSION: Disable GIT_SNAPSHOT for the 4.17.0rc2 release.

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


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

Summary of changes:
 VERSION                                    |   2 +-
 WHATSNEW.txt                               |  29 ++-
 docs-xml/manpages/net.8.xml                |  14 +-
 lib/util/fault.h                           |   2 +-
 libcli/smb/smbXcli_base.c                  |  12 +-
 libcli/util/wscript_build                  |   2 +-
 selftest/knownfail                         |   4 +-
 selftest/target/Samba3.pm                  |   8 +
 selftest/target/Samba4.pm                  |   1 +
 source3/include/g_lock.h                   |   4 +-
 source3/include/proto.h                    |   3 +
 source3/lib/g_lock.c                       |  20 +-
 source3/locking/leases_util.c              |  17 --
 source3/locking/locking.c                  |  11 -
 source3/locking/proto.h                    |   3 -
 source3/locking/share_mode_lock.c          |  30 ++-
 source3/locking/share_mode_lock.h          |   4 +
 source3/modules/vfs_default.c              |  92 +++++---
 source3/modules/vfs_streams_xattr.c        |  33 +++
 source3/modules/vfs_xattr_tdb.c            | 293 ++++++++++++++---------
 source3/rpc_server/srvsvc/srv_srvsvc_nt.c  |   2 +-
 source3/script/tests/test_delete_stream.sh | 123 ++++++++++
 source3/selftest/tests.py                  |   1 +
 source3/smbd/conn.c                        |  36 ++-
 source3/smbd/dir.c                         |   2 +-
 source3/smbd/dosmode.c                     |  24 +-
 source3/smbd/file_access.c                 |   2 +-
 source3/smbd/files.c                       |  17 +-
 source3/smbd/open.c                        |  97 +++++---
 source3/smbd/posix_acls.c                  |   2 +-
 source3/smbd/proto.h                       |   6 +-
 source3/smbd/pysmbd.c                      |   4 +-
 source3/smbd/server.c                      |   2 +-
 source3/smbd/smb2_oplock.c                 |  16 +-
 source3/smbd/smb2_service.c                |   6 +-
 source3/smbd/smbXsrv_tcon.c                |  11 +-
 source3/smbd/smbd.h                        |   1 +
 source3/smbd/vfs.c                         |  39 ++++
 source3/torture/cmd_vfs.c                  |  12 +-
 source3/torture/test_g_lock.c              |  12 +-
 source3/utils/net_g_lock.c                 |   2 +-
 source3/utils/net_usershare.c              |  16 +-
 source4/torture/smb2/lease.c               | 208 +++++++++++++++++
 source4/torture/smb2/streams.c             | 361 ++++++++++++++++++++++++++++-
 44 files changed, 1284 insertions(+), 302 deletions(-)
 create mode 100755 source3/script/tests/test_delete_stream.sh


Changeset truncated at 500 lines:

diff --git a/VERSION b/VERSION
index 47a2a58ee76..beafce89da7 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 988c4c66ed8..63c5fe09a90 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -1,7 +1,7 @@
 Release Announcements
 =====================
 
-This is the second release candidate of Samba 4.17.  This is *not*
+This is the third release candidate of Samba 4.17.  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/.
@@ -204,6 +204,33 @@ smb.conf changes
   --------------                          -----------     -------
   dns port                                New default     53
   nt hash store				  New parameter   always
+  volume serial number			  New parameter   -1
+
+CHANGES SINCE 4.17.0rc2
+=======================
+
+o  Jeremy Allison <jra at samba.org>
+   * BUG 15128: Possible use after free of connection_struct when iterating
+     smbd_server_connection->connections.
+
+o  Christian Ambach <ambi at samba.org>
+   * BUG 15145: `net usershare add` fails with flag works with --long but fails
+     with -l.
+
+o  Ralph Boehme <slow at samba.org>
+   * BUG 15126: acl_xattr VFS module may unintentionally use filesystem
+     permissions instead of ACL from xattr.
+
+o  Stefan Metzmacher <metze at samba.org>
+   * BUG 15125: Performance regression on contended path based operations.
+   * BUG 15148: Missing READ_LEASE break could cause data corruption.
+
+o  Andreas Schneider <asn at samba.org>
+   * BUG 15141: libsamba-errors uses a wrong version number.
+
+o  Joseph Sutton <josephsutton at catalyst.net.nz>
+   * BUG 15152: SMB1 negotiation can fail to handle connection errors.
+
 
 CHANGES SINCE 4.17.0rc1
 =======================
diff --git a/docs-xml/manpages/net.8.xml b/docs-xml/manpages/net.8.xml
index 557cf0d0883..497a8114057 100644
--- a/docs-xml/manpages/net.8.xml
+++ b/docs-xml/manpages/net.8.xml
@@ -118,7 +118,7 @@
 		</varlistentry>
 
 		<varlistentry>
-		<term>-l|--long</term>
+		<term>--long</term>
 		<listitem><para>
 		When listing data, give more information on each item.
 		</para></listitem>
@@ -2139,8 +2139,8 @@ can create user defined shares on demand using the commands below.
 <simplelist>
 <member>net usershare add sharename path [comment [acl] [guest_ok=[y|n]]] - to add or change a user defined share.</member>
 <member>net usershare delete sharename - to delete a user defined share.</member>
-<member>net usershare info [-l|--long] [wildcard sharename] - to print info about a user defined share.</member>
-<member>net usershare list [-l|--long] [wildcard sharename] - to list user defined shares.</member>
+<member>net usershare info [--long] [wildcard sharename] - to print info about a user defined share.</member>
+<member>net usershare list [--long] [wildcard sharename] - to list user defined shares.</member>
 </simplelist>
 
 </para>
@@ -2209,7 +2209,7 @@ any users currently connected to the deleted share.
 </refsect3>
 
 <refsect3>
-<title>USERSHARE INFO <replaceable>[-l|--long]</replaceable> <replaceable>[wildcard sharename]</replaceable></title>
+<title>USERSHARE INFO <replaceable>[--long]</replaceable> <replaceable>[wildcard sharename]</replaceable></title>
 
 <para>
 Get info on user defined shares owned by the current user matching the given pattern, or all users.
@@ -2219,7 +2219,7 @@ Get info on user defined shares owned by the current user matching the given pat
 net usershare info on its own dumps out info on the user defined shares that were
 created by the current user, or restricts them to share names that match the given
 wildcard pattern ('*' matches one or more characters, '?' matches only one character).
-If the '-l' or '--long' option is also given, it prints out info on user defined
+If the '--long' option is also given, it prints out info on user defined
 shares created by other users.
 </para>
 
@@ -2239,7 +2239,7 @@ modified by the "net usershare add" command.
 </refsect3>
 
 <refsect3>
-<title>USERSHARE LIST <replaceable>[-l|--long]</replaceable> <replaceable>wildcard sharename</replaceable></title>
+<title>USERSHARE LIST <replaceable>[--long]</replaceable> <replaceable>wildcard sharename</replaceable></title>
 
 <para>
 List all the user defined shares owned by the current user matching the given pattern, or all users.
@@ -2249,7 +2249,7 @@ List all the user defined shares owned by the current user matching the given pa
 net usershare list on its own list out the names of the user defined shares that were
 created by the current user, or restricts the list to share names that match the given
 wildcard pattern ('*' matches one or more characters, '?' matches only one character).
-If the '-l' or '--long' option is also given, it includes the names of user defined
+If the '--long' option is also given, it includes the names of user defined
 shares created by other users.
 </para>
 
diff --git a/lib/util/fault.h b/lib/util/fault.h
index f3b1666a172..6aceaf6dabc 100644
--- a/lib/util/fault.h
+++ b/lib/util/fault.h
@@ -33,7 +33,7 @@
 #ifdef _SAMBA_DEBUG_H
 #define SMB_ASSERT(b) \
 do { \
-	if (!(b)) { \
+	if (unlikely(!(b))) { \
 		DEBUG(0,("PANIC: assert failed at %s(%d): %s\n", \
 			 __FILE__, __LINE__, #b)); \
 		smb_panic("assert failed: " #b); \
diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c
index d2f55966c3a..c5d13bd5837 100644
--- a/libcli/smb/smbXcli_base.c
+++ b/libcli/smb/smbXcli_base.c
@@ -4469,7 +4469,11 @@ static void smbXcli_negprot_smb1_done(struct tevent_req *subreq)
 				  NULL, /* pinbuf */
 				  expected, ARRAY_SIZE(expected));
 	TALLOC_FREE(subreq);
-	if (inhdr == NULL || tevent_req_nterror(req, status)) {
+	if (tevent_req_nterror(req, status)) {
+		return;
+	}
+	if (inhdr == NULL) {
+		tevent_req_nterror(req, NT_STATUS_INTERNAL_ERROR);
 		return;
 	}
 
@@ -5009,7 +5013,11 @@ static void smbXcli_negprot_smb2_done(struct tevent_req *subreq)
 
 	status = smb2cli_req_recv(subreq, state, &iov,
 				  expected, ARRAY_SIZE(expected));
-	if (tevent_req_nterror(req, status) || iov == NULL) {
+	if (tevent_req_nterror(req, status)) {
+		return;
+	}
+	if (iov == NULL) {
+		tevent_req_nterror(req, NT_STATUS_INTERNAL_ERROR);
 		return;
 	}
 
diff --git a/libcli/util/wscript_build b/libcli/util/wscript_build
index 9c8fddca94b..4267cfeb57e 100644
--- a/libcli/util/wscript_build
+++ b/libcli/util/wscript_build
@@ -10,7 +10,7 @@ bld.SAMBA_LIBRARY('samba-errors',
                   deps='gnutls',
                   # private_library=True,
                   pc_files=[],
-                  vnum='1',
+                  vnum='1.0.0',
                   )
 
 bld.SAMBA_GENERATOR('ntstatus_generated',
diff --git a/selftest/knownfail b/selftest/knownfail
index 173286a96a0..0b4c5a44a7f 100644
--- a/selftest/knownfail
+++ b/selftest/knownfail
@@ -207,10 +207,10 @@
 ^samba3.smb2.oplock.stream1
 ^samba3.smb2.streams.rename
 ^samba3.smb2.streams.rename2
-^samba3.smb2.streams.attributes
+^samba3.smb2.streams.attributes1\(.*\)
 ^samba3.smb2.streams streams_xattr.rename\(nt4_dc\)
 ^samba3.smb2.streams streams_xattr.rename2\(nt4_dc\)
-^samba3.smb2.streams streams_xattr.attributes\(nt4_dc\)
+^samba3.smb2.streams streams_xattr.attributes1\(nt4_dc\)
 ^samba3.smb2.getinfo.complex
 ^samba3.smb2.getinfo.fsinfo # quotas don't work yet
 ^samba3.smb2.setinfo.setinfo
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index b12011a71fa..d413f14bacd 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -2772,6 +2772,7 @@ sub provision($$)
 	panic action = cd $self->{srcdir} && $self->{srcdir}/selftest/gdb_backtrace %d %\$(MAKE_TEST_BINARY)
 	smbd:suicide mode = yes
 	smbd:FSCTL_SMBTORTURE = yes
+	smbd:validate_oplock_types = yes
 
 	client min protocol = SMB2_02
 	server min protocol = SMB2_02
@@ -3372,6 +3373,13 @@ sub provision($$)
 	copy = tmp
 	vfs objects = streams_xattr xattr_tdb
 
+[acl_streams_xattr]
+	copy = tmp
+	vfs objects = acl_xattr streams_xattr fake_acls xattr_tdb
+	acl_xattr:ignore system acls = yes
+	acl_xattr:security_acl_name = user.acl
+	xattr_tdb:ignore_user_xattr = yes
+
 [compound_find]
 	copy = tmp
 	smbd:find async delay usec = 10000
diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm
index 1762ae4ae79..e5ae57cb7fc 100755
--- a/selftest/target/Samba4.pm
+++ b/selftest/target/Samba4.pm
@@ -778,6 +778,7 @@ sub provision_raw_step1($$)
 	panic action = $RealBin/gdb_backtrace \%d
 	smbd:suicide mode = yes
 	smbd:FSCTL_SMBTORTURE = yes
+	smbd:validate_oplock_types = yes
 	wins support = yes
 	server role = $ctx->{server_role}
 	server services = +echo $services
diff --git a/source3/include/g_lock.h b/source3/include/g_lock.h
index 3a94879d209..749cb57ed45 100644
--- a/source3/include/g_lock.h
+++ b/source3/include/g_lock.h
@@ -71,7 +71,7 @@ struct tevent_req *g_lock_dump_send(
 	TDB_DATA key,
 	void (*fn)(struct server_id exclusive,
 		   size_t num_shared,
-		   struct server_id *shared,
+		   const struct server_id *shared,
 		   const uint8_t *data,
 		   size_t datalen,
 		   void *private_data),
@@ -81,7 +81,7 @@ NTSTATUS g_lock_dump(struct g_lock_ctx *ctx,
 		     TDB_DATA key,
 		     void (*fn)(struct server_id exclusive,
 				size_t num_shared,
-				struct server_id *shared,
+				const struct server_id *shared,
 				const uint8_t *data,
 				size_t datalen,
 				void *private_data),
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 6a6edc36dfb..f632cf37c08 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -82,6 +82,9 @@ NTSTATUS vfs_at_fspcwd(TALLOC_CTX *mem_ctx,
 		       struct connection_struct *conn,
 		       struct files_struct **_fsp);
 
+NTSTATUS vfs_fget_dos_attributes(struct files_struct *fsp,
+				 uint32_t *dosmode);
+
 #include "source3/lib/interface.h"
 
 /* The following definitions come from lib/ldap_debug_handler.c  */
diff --git a/source3/lib/g_lock.c b/source3/lib/g_lock.c
index d683c4ddee6..8a07949b3d9 100644
--- a/source3/lib/g_lock.c
+++ b/source3/lib/g_lock.c
@@ -1210,7 +1210,7 @@ struct g_lock_dump_state {
 	TDB_DATA key;
 	void (*fn)(struct server_id exclusive,
 		   size_t num_shared,
-		   struct server_id *shared,
+		   const struct server_id *shared,
 		   const uint8_t *data,
 		   size_t datalen,
 		   void *private_data);
@@ -1238,12 +1238,14 @@ static void g_lock_dump_fn(TDB_DATA key, TDB_DATA data,
 		return;
 	}
 
-	shared = talloc_array(
-		state->mem_ctx, struct server_id, lck.num_shared);
-	if (shared == NULL) {
-		DBG_DEBUG("talloc failed\n");
-		state->status = NT_STATUS_NO_MEMORY;
-		return;
+	if (lck.num_shared > 0) {
+		shared = talloc_array(
+			state->mem_ctx, struct server_id, lck.num_shared);
+		if (shared == NULL) {
+			DBG_DEBUG("talloc failed\n");
+			state->status = NT_STATUS_NO_MEMORY;
+			return;
+		}
 	}
 
 	for (i=0; i<lck.num_shared; i++) {
@@ -1265,7 +1267,7 @@ static void g_lock_dump_fn(TDB_DATA key, TDB_DATA data,
 NTSTATUS g_lock_dump(struct g_lock_ctx *ctx, TDB_DATA key,
 		     void (*fn)(struct server_id exclusive,
 				size_t num_shared,
-				struct server_id *shared,
+				const struct server_id *shared,
 				const uint8_t *data,
 				size_t datalen,
 				void *private_data),
@@ -1300,7 +1302,7 @@ struct tevent_req *g_lock_dump_send(
 	TDB_DATA key,
 	void (*fn)(struct server_id exclusive,
 		   size_t num_shared,
-		   struct server_id *shared,
+		   const struct server_id *shared,
 		   const uint8_t *data,
 		   size_t datalen,
 		   void *private_data),
diff --git a/source3/locking/leases_util.c b/source3/locking/leases_util.c
index cb62bffbd7d..9ae4081cd7b 100644
--- a/source3/locking/leases_util.c
+++ b/source3/locking/leases_util.c
@@ -71,23 +71,6 @@ uint32_t fsp_lease_type(struct files_struct *fsp)
 	return fsp->lease_type;
 }
 
-static uint32_t lease_type_is_exclusive(uint32_t lease_type)
-{
-	if ((lease_type & (SMB2_LEASE_READ | SMB2_LEASE_WRITE)) ==
-	    (SMB2_LEASE_READ | SMB2_LEASE_WRITE)) {
-		return true;
-	}
-
-	return false;
-}
-
-bool fsp_lease_type_is_exclusive(struct files_struct *fsp)
-{
-	uint32_t lease_type = fsp_lease_type(fsp);
-
-	return lease_type_is_exclusive(lease_type);
-}
-
 const struct GUID *fsp_client_guid(const files_struct *fsp)
 {
 	return &fsp->conn->sconn->client->global->client_guid;
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index b002e80fee4..befdc10f369 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -468,17 +468,6 @@ char *share_mode_str(TALLOC_CTX *ctx, int num,
 		 (unsigned int)e->name_hash);
 }
 
-/*******************************************************************
- Fetch a share mode where we know one MUST exist. This call reference
- counts it internally to allow for nested lock fetches.
-********************************************************************/
-
-struct share_mode_lock *get_existing_share_mode_lock(TALLOC_CTX *mem_ctx,
-						     const struct file_id id)
-{
-	return get_share_mode_lock(mem_ctx, id, NULL, NULL, NULL);
-}
-
 struct rename_share_filename_state {
 	struct share_mode_lock *lck;
 	struct messaging_context *msg_ctx;
diff --git a/source3/locking/proto.h b/source3/locking/proto.h
index d6e7a54a766..7fc177d7aa6 100644
--- a/source3/locking/proto.h
+++ b/source3/locking/proto.h
@@ -128,8 +128,6 @@ void locking_close_file(files_struct *fsp,
 char *share_mode_str(TALLOC_CTX *ctx, int num,
 		     const struct file_id *id,
 		     const struct share_mode_entry *e);
-struct share_mode_lock *get_existing_share_mode_lock(TALLOC_CTX *mem_ctx,
-						     struct file_id id);
 
 bool rename_share_filename(struct messaging_context *msg_ctx,
 			struct share_mode_lock *lck,
@@ -212,7 +210,6 @@ bool release_posix_lock_posix_flavour(files_struct *fsp,
 /* The following definitions come from locking/leases_util.c */
 uint32_t map_oplock_to_lease_type(uint16_t op_type);
 uint32_t fsp_lease_type(struct files_struct *fsp);
-bool fsp_lease_type_is_exclusive(struct files_struct *fsp);
 const struct GUID *fsp_client_guid(const files_struct *fsp);
 
 #endif /* _LOCKING_PROTO_H_ */
diff --git a/source3/locking/share_mode_lock.c b/source3/locking/share_mode_lock.c
index dd19c53024b..75912ec5dc8 100644
--- a/source3/locking/share_mode_lock.c
+++ b/source3/locking/share_mode_lock.c
@@ -468,7 +468,7 @@ struct locking_tdb_data_fetch_state {
 static void locking_tdb_data_fetch_fn(
 	struct server_id exclusive,
 	size_t num_shared,
-	struct server_id *shared,
+	const struct server_id *shared,
 	const uint8_t *data,
 	size_t datalen,
 	void *private_data)
@@ -768,7 +768,7 @@ struct get_static_share_mode_data_state {
 static void get_static_share_mode_data_fn(
 	struct server_id exclusive,
 	size_t num_shared,
-	struct server_id *shared,
+	const struct server_id *shared,
 	const uint8_t *data,
 	size_t datalen,
 	void *private_data)
@@ -1005,6 +1005,17 @@ static int share_mode_lock_destructor(struct share_mode_lock *lck)
 	return 0;
 }
 
+/*******************************************************************
+ Fetch a share mode where we know one MUST exist. This call reference
+ counts it internally to allow for nested lock fetches.
+********************************************************************/
+
+struct share_mode_lock *get_existing_share_mode_lock(TALLOC_CTX *mem_ctx,
+						     const struct file_id id)
+{
+	return get_share_mode_lock(mem_ctx, id, NULL, NULL, NULL);
+}
+
 struct share_mode_do_locked_state {
 	TDB_DATA key;
 	void (*fn)(const uint8_t *buf,
@@ -1017,7 +1028,7 @@ struct share_mode_do_locked_state {
 static void share_mode_do_locked_fn(
 	struct server_id exclusive,
 	size_t num_shared,
-	struct server_id *shared,
+	const struct server_id *shared,
 	const uint8_t *data,
 	size_t datalen,
 	void *private_data)
@@ -1324,7 +1335,7 @@ struct fetch_share_mode_unlocked_state {
 static void fetch_share_mode_unlocked_parser(
 	struct server_id exclusive,
 	size_t num_shared,
-	struct server_id *shared,
+	const struct server_id *shared,
 	const uint8_t *data,
 	size_t datalen,
 	void *private_data)
@@ -1395,7 +1406,7 @@ struct fetch_share_mode_state {
 static void fetch_share_mode_fn(
 	struct server_id exclusive,
 	size_t num_shared,
-	struct server_id *shared,
+	const struct server_id *shared,
 	const uint8_t *data,
 	size_t datalen,
 	void *private_data);
@@ -1460,7 +1471,7 @@ struct tevent_req *fetch_share_mode_send(TALLOC_CTX *mem_ctx,
 static void fetch_share_mode_fn(
 	struct server_id exclusive,
 	size_t num_shared,
-	struct server_id *shared,
+	const struct server_id *shared,
 	const uint8_t *data,
 	size_t datalen,
 	void *private_data)
@@ -1564,7 +1575,7 @@ struct share_mode_forall_state {
 static void share_mode_forall_dump_fn(
 	struct server_id exclusive,
 	size_t num_shared,
-	struct server_id *shared,
+	const struct server_id *shared,
 	const uint8_t *data,
 	size_t datalen,
 	void *private_data)
@@ -1782,6 +1793,7 @@ bool set_share_mode(struct share_mode_lock *lck,
 		    uid_t uid,
 		    uint64_t mid,
 		    uint16_t op_type,
+		    const struct smb2_lease_key *lease_key,
 		    uint32_t share_access,
 		    uint32_t access_mask)
 {
@@ -1839,7 +1851,7 @@ bool set_share_mode(struct share_mode_lock *lck,
 	if (op_type == LEASE_OPLOCK) {
 		const struct GUID *client_guid = fsp_client_guid(fsp);
 		e.client_guid = *client_guid;
-		e.lease_key = fsp->lease->lease.lease_key;
+		e.lease_key = *lease_key;
 	}
 
 	ok = share_mode_entry_put(&e, &e_buf);
@@ -2108,7 +2120,7 @@ struct share_mode_count_entries_state {
 static void share_mode_count_entries_fn(
 	struct server_id exclusive,
 	size_t num_shared,
-	struct server_id *shared,
+	const struct server_id *shared,
 	const uint8_t *data,
 	size_t datalen,


-- 
Samba Shared Repository



More information about the samba-cvs mailing list