[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Mon Sep 19 18:22:01 UTC 2022


The branch, master has been updated
       via  36c5f31d77a libsmb: Use find_snapshot_token() for clistr_is_previous_version_path()
       via  6a3da608b87 lib: Add separator argument to find_snapshot_token()
       via  bfe07fda67f lib: Move extract_snapshot_token() to util_path.c
       via  f0108015515 vfs: Simplify xattr_tdb_mkdirat()
       via  e343d24d237 streams_xattr: Avoid a talloc_strdup
       via  b7359c527da smbd: Fix a typo
       via  46f4d645967 smbd: Use PATH_MAX as symlink target buffer
       via  9d5f4563831 shadow_copy2: Don't implicitly return memory off talloc_tos()
       via  26bfffc6209 shadow_copy2: Avoid a few ZERO_STRUCT()s
       via  724dcb1457c source3: A few whitespace fixes
       via  f41c7ea8a27 registry3: Move registry_value_cmp() to its only user
       via  cb6d2a91d0c registry3: Remove some unused functions
       via  3b344f502d5 vfs: Simplify vfswrap_parent_pathname()
       via  e4d8dc7943b vfs: Avoid a talloc in vfswrap_parent_pathname()
       via  68d20326db8 libsmb: Use tevent_req_nterror()'s retval
      from  063976fca37 WHATSNEW: samba-tool: fewer tracebacks, more colour

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


- Log -----------------------------------------------------------------
commit 36c5f31d77a6307ba1fe009c960419a8485525cf
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Sep 17 14:02:31 2022 -0700

    libsmb: Use find_snapshot_token() for clistr_is_previous_version_path()
    
    Dedup that string parsing logic
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Mon Sep 19 18:21:56 UTC 2022 on sn-devel-184

commit 6a3da608b87b137fbe1712cb7ed5c1de3aae83c9
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Sep 17 13:48:31 2022 -0700

    lib: Add separator argument to find_snapshot_token()
    
    We'll use the logic for \ based strings next
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit bfe07fda67f1dac932f57c984b0cdac1df8bc11c
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Sep 17 10:13:27 2022 -0700

    lib: Move extract_snapshot_token() to util_path.c
    
    Make it available to replace clistr_is_previous_version_path() in
    libsmb/
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit f0108015515da97fe31eb1b896a9fc36e5052b49
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Sep 16 20:29:30 2022 -0700

    vfs: Simplify xattr_tdb_mkdirat()
    
    We have the dirfsp and the relative name. And with fstatat we don't
    need the full pathname anymore.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit e343d24d2376601afbaaaf010f0cdd8861a33bd1
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Sep 16 09:54:05 2022 -0700

    streams_xattr: Avoid a talloc_strdup
    
    We can print a short string with %.*s, no talloc_strdup()
    and *stype='\0' required.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit b7359c527da297861ca24d59bd7e2a91b8d72e85
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Sep 7 11:32:26 2022 +0200

    smbd: Fix a typo
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 46f4d64596729bf665c92fd8ca3fe57e780c1018
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Sep 7 10:39:26 2022 +0200

    smbd: Use PATH_MAX as symlink target buffer
    
    We use that instead of the arbitrary 4k in open.c as well
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 9d5f4563831c50fd7cc68594168d5944af1b53bc
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Sep 14 17:16:46 2022 -0700

    shadow_copy2: Don't implicitly return memory off talloc_tos()
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 26bfffc6209c413bed36c7684ad10c3824933961
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Sep 9 05:55:46 2022 +0200

    shadow_copy2: Avoid a few ZERO_STRUCT()s
    
    Give the compiler more hints what's going on
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 724dcb1457c4c006214887594a95abe6eb136949
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Sep 12 10:20:38 2022 -0700

    source3: A few whitespace fixes
    
    review with git sh -w
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit f41c7ea8a27fa49e3d5d5446ced5123aedd58d0e
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Sep 12 10:17:09 2022 -0700

    registry3: Move registry_value_cmp() to its only user
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit cb6d2a91d0c265dffae74b01c1494a284df9ae1d
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Sep 12 10:13:46 2022 -0700

    registry3: Remove some unused functions
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 3b344f502d595fb43e15c1677a67b75fa8f61f68
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Sep 9 13:59:28 2022 +0200

    vfs: Simplify vfswrap_parent_pathname()
    
    We don't really need a talloc_stackframe() here
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit e4d8dc7943b33f749b18f2c55738a6cfad2c8e55
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Sep 9 13:43:54 2022 +0200

    vfs: Avoid a talloc in vfswrap_parent_pathname()
    
    We copy smb_fname_in->base_name just to overwrite it again
    immediately. Expand synthetic_smb_fname() here.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 68d20326db8a2bf6296e6efc5f2ab831db3a1521
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Sep 17 10:24:08 2022 -0700

    libsmb: Use tevent_req_nterror()'s retval
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

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

Summary of changes:
 libcli/smb/smb_unix_ext.h           |  36 ++--
 source3/include/smb.h               |  12 --
 source3/lib/util_path.c             | 100 ++++++++++
 source3/lib/util_path.h             |  18 ++
 source3/libsmb/cli_smb2_fnum.c      |  17 +-
 source3/libsmb/clioplock.c          |   3 +-
 source3/libsmb/clistr.c             |  65 -------
 source3/libsmb/proto.h              |   7 -
 source3/modules/vfs_default.c       |  32 ++--
 source3/modules/vfs_shadow_copy2.c  |  32 ++--
 source3/modules/vfs_streams_xattr.c |  20 +-
 source3/modules/vfs_xattr_tdb.c     |  23 +--
 source3/registry/reg_api_util.c     | 163 ----------------
 source3/registry/reg_api_util.h     |  14 --
 source3/registry/regfio.c           | 359 ++++++++++++++++++------------------
 source3/smbd/filename.c             |  71 -------
 source3/smbd/files.c                |   4 +-
 source3/smbd/open.c                 |   6 +-
 source3/smbd/proto.h                |   1 -
 source3/utils/net_registry.c        |   9 +
 source3/wscript_build               |   1 -
 21 files changed, 380 insertions(+), 613 deletions(-)
 delete mode 100644 source3/libsmb/clistr.c


Changeset truncated at 500 lines:

diff --git a/libcli/smb/smb_unix_ext.h b/libcli/smb/smb_unix_ext.h
index e74976b1bcb..6d5b76da613 100644
--- a/libcli/smb/smb_unix_ext.h
+++ b/libcli/smb/smb_unix_ext.h
@@ -1,4 +1,4 @@
-/* 
+/*
    Unix SMB/CIFS implementation.
    SMB transaction2 handling
 
@@ -11,12 +11,12 @@
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
-   
+
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
-   
+
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
@@ -46,7 +46,7 @@
 
 #define SMB_SIZE_NO_CHANGE_LO              0xFFFFFFFF
 #define SMB_SIZE_NO_CHANGE_HI              0xFFFFFFFF
- 
+
 #define SMB_TIME_NO_CHANGE_LO              0xFFFFFFFF
 #define SMB_TIME_NO_CHANGE_HI              0xFFFFFFFF
 
@@ -139,7 +139,7 @@ Offset Size         Name
 /* SMB_QUERY_POSIX_ACL 0x204 see below */
 #define SMB_QUERY_XATTR                0x205 /* need for non-user XATTRs */
 #define SMB_QUERY_ATTR_FLAGS           0x206 /* chflags, chattr */
-#define SMB_SET_ATTR_FLAGS             0x206 
+#define SMB_SET_ATTR_FLAGS             0x206
 #define SMB_QUERY_POSIX_PERMISSION     0x207
 /* Only valid for qfileinfo */
 #define SMB_QUERY_POSIX_LOCK	       0x208
@@ -220,34 +220,34 @@ findfirst/findnext is SMB_FIND_FILE_UNIX_INFO2.
 #define SMB_QUERY_POSIX_FS_INFO     0x201
 
 /* Returns FILE_SYSTEM_POSIX_INFO struct as follows
-      (NB   For undefined values return -1 in that field) 
-   le32 OptimalTransferSize;    bsize on some os, iosize on other os, This 
+      (NB   For undefined values return -1 in that field)
+   le32 OptimalTransferSize;    bsize on some os, iosize on other os, This
 				is a hint to the client about best size. Server
-				can return -1 if no preference, ie if SMB 
+				can return -1 if no preference, ie if SMB
 				negotiated size is adequate for optimal
 				read/write performance
    le32 BlockSize; (often 512 bytes) NB: BlockSize * TotalBlocks = disk space
    le64 TotalBlocks;  redundant with other infolevels but easy to ret here
    le64 BlocksAvail;  although redundant, easy to return
-   le64 UserBlocksAvail;      bavail 
+   le64 UserBlocksAvail;      bavail
    le64 TotalFileNodes;
    le64 FreeFileNodes;
-   le64 FileSysIdentifier;    fsid 
-   (NB statfs field Namelen comes from FILE_SYSTEM_ATTRIBUTE_INFO call) 
-   (NB statfs field flags can come from FILE_SYSTEM_DEVICE_INFO call)  
+   le64 FileSysIdentifier;    fsid
+   (NB statfs field Namelen comes from FILE_SYSTEM_ATTRIBUTE_INFO call)
+   (NB statfs field flags can come from FILE_SYSTEM_DEVICE_INFO call)
 */
 
 #define SMB_QUERY_POSIX_WHO_AM_I  0x202 /* QFS Info */
 /* returns:
-        __u32 flags;  0 = Authenticated user 1 = GUEST 
-        __u32 mask;  which flags bits server understands ie 0x0001 
+        __u32 flags;  0 = Authenticated user 1 = GUEST
+        __u32 mask;  which flags bits server understands ie 0x0001
         __u64 unix_user_id;
         __u64 unix_user_gid;
-        __u32 number_of_supplementary_gids;  may be zero 
+        __u32 number_of_supplementary_gids;  may be zero
         __u32 number_of_sids;  may be zero
-        __u32 length_of_sid_array;  in bytes - may be zero 
-        __u32 pad;  reserved - MBZ 
-        __u64 gid_array[0];  may be empty 
+        __u32 length_of_sid_array;  in bytes - may be zero
+        __u32 pad;  reserved - MBZ
+        __u64 gid_array[0];  may be empty
         __u8 * psid_list  may be empty
 */
 
diff --git a/source3/include/smb.h b/source3/include/smb.h
index 6363bdc0c93..cfaf922b461 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -454,18 +454,6 @@ Offset  Data			length.
 #define NOTIFY_ACTION_REMOVED_STREAM 7
 #define NOTIFY_ACTION_MODIFIED_STREAM 8
 
-/*
- * Timestamp format used in "previous versions":
- * This is the windows-level format of the @GMT- token.
- * It is a fixed format not to be confused with the
- * format for the POSIX-Level token of the shadow_copy2
- * VFS module that can be configured via the "shadow:format"
- * configuration option but defaults to the same format.
- * See the shadow_copy2 module.
- */
-#define GMT_NAME_LEN 24 /* length of a @GMT- name */
-#define GMT_FORMAT "@GMT-%Y.%m.%d-%H.%M.%S"
-
 /* where to find the base of the SMB packet proper */
 #define smb_base(buf) (((const char *)(buf))+4)
 
diff --git a/source3/lib/util_path.c b/source3/lib/util_path.c
index 3591589cb8e..5b7c01b05e3 100644
--- a/source3/lib/util_path.c
+++ b/source3/lib/util_path.c
@@ -24,6 +24,7 @@
 #include "replace.h"
 #include <talloc.h>
 #include "lib/util/samba_util.h"
+#include "lib/util/debug.h"
 #include "lib/util_path.h"
 
 struct loadparm_substitution;
@@ -204,3 +205,102 @@ char *canonicalize_absolute_path(TALLOC_CTX *ctx, const char *pathname_in)
 	*p++ = '\0';
 	return pathname;
 }
+
+static bool find_snapshot_token(
+	const char *filename,
+	char sep,
+	const char **_start,
+	const char **_next_component,
+	NTTIME *twrp)
+{
+	const char *start = NULL;
+	const char *end = NULL;
+	struct tm tm;
+	time_t t;
+
+	start = strstr_m(filename, "@GMT-");
+
+	if (start == NULL) {
+		return false;
+	}
+
+	if ((start > filename) && (start[-1] != sep)) {
+		/* the GMT-token does not start a path-component */
+		return false;
+	}
+
+	end = strptime(start, GMT_FORMAT, &tm);
+	if (end == NULL) {
+		/* Not a valid timestring. */
+		return false;
+	}
+
+	if ((end[0] != '\0') && (end[0] != sep)) {
+		/*
+		 * It is not a complete path component, i.e. the path
+		 * component continues after the gmt-token.
+		 */
+		return false;
+	}
+
+	tm.tm_isdst = -1;
+	t = timegm(&tm);
+	unix_to_nt_time(twrp, t);
+
+	DBG_DEBUG("Extracted @GMT-Timestamp %s\n",
+		  nt_time_string(talloc_tos(), *twrp));
+
+	*_start = start;
+
+	if (end[0] == sep) {
+		end += 1;
+	}
+	*_next_component = end;
+
+	return true;
+}
+
+bool clistr_is_previous_version_path(const char *path,
+				     const char **startp,
+				     const char **endp,
+				     NTTIME *ptwrp)
+{
+	const char *start = NULL;
+	const char *next = NULL;
+	NTTIME twrp;
+	bool ok;
+
+	ok = find_snapshot_token(path, '\\', &start, &next, &twrp);
+	if (!ok) {
+		return false;
+	}
+
+	if (startp != NULL) {
+		*startp = start;
+	}
+	if (endp != NULL) {
+		*endp = next;
+	}
+	if (ptwrp != NULL) {
+		*ptwrp = twrp;
+	}
+	return true;
+}
+
+bool extract_snapshot_token(char *fname, NTTIME *twrp)
+{
+	const char *start = NULL;
+	const char *next = NULL;
+	size_t remaining;
+	bool found;
+
+	found = find_snapshot_token(fname, '/', &start, &next, twrp);
+	if (!found) {
+		return false;
+	}
+
+	remaining = strlen(next);
+	memmove(discard_const_p(char, start), next, remaining+1);
+
+	return true;
+}
diff --git a/source3/lib/util_path.h b/source3/lib/util_path.h
index 3e7d04de550..33699da28c2 100644
--- a/source3/lib/util_path.h
+++ b/source3/lib/util_path.h
@@ -26,10 +26,28 @@
 
 #include "replace.h"
 #include <talloc.h>
+#include "lib/util/time.h"
+
+/*
+ * Timestamp format used in "previous versions":
+ * This is the windows-level format of the @GMT- token.
+ * It is a fixed format not to be confused with the
+ * format for the POSIX-Level token of the shadow_copy2
+ * VFS module that can be configured via the "shadow:format"
+ * configuration option but defaults to the same format.
+ * See the shadow_copy2 module.
+ */
+#define GMT_NAME_LEN 24 /* length of a @GMT- name */
+#define GMT_FORMAT "@GMT-%Y.%m.%d-%H.%M.%S"
 
 char *lock_path(TALLOC_CTX *mem_ctx, const char *name);
 char *state_path(TALLOC_CTX *mem_ctx, const char *name);
 char *cache_path(TALLOC_CTX *mem_ctx, const char *name);
 char *canonicalize_absolute_path(TALLOC_CTX *ctx, const char *abs_path);
+bool extract_snapshot_token(char *fname, NTTIME *twrp);
+bool clistr_is_previous_version_path(const char *path,
+				     const char **startp,
+				     const char **endp,
+				     NTTIME *ptwrp);
 
 #endif
diff --git a/source3/libsmb/cli_smb2_fnum.c b/source3/libsmb/cli_smb2_fnum.c
index bd3d705a641..9076dbd8b90 100644
--- a/source3/libsmb/cli_smb2_fnum.c
+++ b/source3/libsmb/cli_smb2_fnum.c
@@ -224,7 +224,7 @@ struct tevent_req *cli_smb2_create_fnum_send(
 	size_t fname_len = 0;
 	const char *startp = NULL;
 	const char *endp = NULL;
-	time_t tstamp = (time_t)0;
+	NTTIME ntt;
 	NTSTATUS status;
 
 	req = tevent_req_create(mem_ctx, &state,
@@ -245,11 +245,9 @@ struct tevent_req *cli_smb2_create_fnum_send(
 
 	/* Check for @GMT- paths. Remove the @GMT and turn into TWrp if so. */
 	fname_len = strlen(fname);
-	if (clistr_is_previous_version_path(fname, &startp, &endp, &tstamp)) {
+	if (clistr_is_previous_version_path(fname, &startp, &endp, &ntt)) {
 		size_t len_before_gmt = startp - fname;
 		size_t len_after_gmt = fname + fname_len - endp;
-		DATA_BLOB twrp_blob;
-		NTTIME ntt;
 
 		char *new_fname = talloc_array(state, char,
 				len_before_gmt + len_after_gmt + 1);
@@ -263,16 +261,15 @@ struct tevent_req *cli_smb2_create_fnum_send(
 		fname = new_fname;
 		fname_len = len_before_gmt + len_after_gmt;
 
-		unix_to_nt_time(&ntt, tstamp);
-		twrp_blob = data_blob_const((const void *)&ntt, 8);
-
 		status = smb2_create_blob_add(
 			state,
 			&state->in_cblobs,
 			SMB2_CREATE_TAG_TWRP,
-			twrp_blob);
-		if (!NT_STATUS_IS_OK(status)) {
-			tevent_req_nterror(req, status);
+			(DATA_BLOB) {
+				.data = (uint8_t *)&ntt,
+				.length = sizeof(ntt),
+			});
+		if (tevent_req_nterror(req, status)) {
 			return tevent_req_post(req, ev);
 		}
 	}
diff --git a/source3/libsmb/clioplock.c b/source3/libsmb/clioplock.c
index 01c98f1c302..fcef01f8d83 100644
--- a/source3/libsmb/clioplock.c
+++ b/source3/libsmb/clioplock.c
@@ -85,8 +85,7 @@ static void cli_smb_oplock_break_waiter_done(struct tevent_req *subreq)
 				  NULL, /* pinbuf */
 				  NULL, 0); /* expected */
 	TALLOC_FREE(subreq);
-	if (!NT_STATUS_IS_OK(status)) {
-		tevent_req_nterror(req, status);
+	if (tevent_req_nterror(req, status)) {
 		return;
 	}
 	if (wct < 8) {
diff --git a/source3/libsmb/clistr.c b/source3/libsmb/clistr.c
deleted file mode 100644
index 1e5641a03f2..00000000000
--- a/source3/libsmb/clistr.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/* 
-   Unix SMB/CIFS implementation.
-   client string routines
-   Copyright (C) Andrew Tridgell 2001
-   Copyright (C) Andrew Bartlett <abartlet at samba.org> 2003
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-   
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-   
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "includes.h"
-#include "libsmb/proto.h"
-
-bool clistr_is_previous_version_path(const char *path,
-		const char **startp,
-		const char **endp,
-		time_t *ptime)
-{
-	char *q;
-	time_t timestamp;
-	struct tm tm;
-	const char *p = strstr_m(path, "@GMT-");
-
-	if (p == NULL) {
-		return false;
-	}
-	if (p > path && (p[-1] != '\\')) {
-		return false;
-	}
-	q = strptime(p, GMT_FORMAT, &tm);
-	if (q == NULL) {
-		return false;
-	}
-	tm.tm_isdst = -1;
-	timestamp = timegm(&tm);
-	if (timestamp == (time_t)-1) {
-		return false;
-	}
-	if (q[0] != '\0' && q[0] != '\\') {
-		return false;
-	}
-	if (startp) {
-		*startp = p;
-	}
-	if (endp) {
-		if (q[0] == '\\') {
-			q++;
-		}
-		*endp = q;
-	}
-	if (ptime) {
-		*ptime = timestamp;
-	}
-	return true;
-}
diff --git a/source3/libsmb/proto.h b/source3/libsmb/proto.h
index caae206a3eb..b17318d4d17 100644
--- a/source3/libsmb/proto.h
+++ b/source3/libsmb/proto.h
@@ -989,13 +989,6 @@ NTSTATUS cli_query_mxac(struct cli_state *cli,
 			const char *filename,
 			uint32_t *mxac);
 
-/* The following definitions come from libsmb/clistr.c  */
-
-bool clistr_is_previous_version_path(const char *path,
-			const char **startp,
-			const char **endp,
-			time_t *ptime);
-
 /* The following definitions come from libsmb/clitrans.c  */
 
 struct tevent_req *cli_trans_send(
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 6cad87152ef..d98cec49e33 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -748,7 +748,7 @@ static int vfswrap_openat(vfs_handle_struct *handle,
 		 *   conflicting flags are specified in how.flags.
 		 *
 		 * So we better clear ignored/invalid flags
-		 * and only keep the exptected once.
+		 * and only keep the expected ones.
 		 */
 		flags &= (O_PATH|O_CLOEXEC|O_DIRECTORY|O_NOFOLLOW);
 	}
@@ -1422,14 +1422,12 @@ static NTSTATUS vfswrap_parent_pathname(struct vfs_handle_struct *handle,
 					struct smb_filename **parent_dir_out,
 					struct smb_filename **atname_out)
 {
-	TALLOC_CTX *frame = talloc_stackframe();
 	struct smb_filename *parent = NULL;
 	struct smb_filename *name = NULL;
 	char *p = NULL;
 
-	parent = cp_smb_filename_nostream(frame, smb_fname_in);
+	parent = cp_smb_filename_nostream(mem_ctx, smb_fname_in);
 	if (parent == NULL) {
-		TALLOC_FREE(frame);
 		return NT_STATUS_NO_MEMORY;
 	}
 	SET_STAT_INVALID(parent->st);
@@ -1439,7 +1437,7 @@ static NTSTATUS vfswrap_parent_pathname(struct vfs_handle_struct *handle,
 		TALLOC_FREE(parent->base_name);
 		parent->base_name = talloc_strdup(parent, ".");
 		if (parent->base_name == NULL) {
-			TALLOC_FREE(frame);
+			TALLOC_FREE(parent);
 			return NT_STATUS_NO_MEMORY;
 		}
 		p = smb_fname_in->base_name;
@@ -1449,27 +1447,23 @@ static NTSTATUS vfswrap_parent_pathname(struct vfs_handle_struct *handle,
 	}
 
 	if (atname_out == NULL) {
-		*parent_dir_out = talloc_move(mem_ctx, &parent);
-		TALLOC_FREE(frame);
+		*parent_dir_out = parent;
 		return NT_STATUS_OK;
 	}
 
-	name = cp_smb_filename(frame, smb_fname_in);
+	name = synthetic_smb_fname(
+		parent,
+		p,
+		smb_fname_in->stream_name,
+		&smb_fname_in->st,
+		smb_fname_in->twrp,
+		smb_fname_in->flags);
 	if (name == NULL) {
-		TALLOC_FREE(frame);
 		return NT_STATUS_NO_MEMORY;
 	}
-	TALLOC_FREE(name->base_name);
 
-	name->base_name = talloc_strdup(name, p);
-	if (name->base_name == NULL) {
-		TALLOC_FREE(frame);
-		return NT_STATUS_NO_MEMORY;
-	}
-
-	*parent_dir_out = talloc_move(mem_ctx, &parent);
-	*atname_out = talloc_move(*parent_dir_out, &name);
-	TALLOC_FREE(frame);
+	*parent_dir_out = parent;
+	*atname_out = name;
 	return NT_STATUS_OK;
 }
 
diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c
index 43f02488f84..16e39c2f070 100644
--- a/source3/modules/vfs_shadow_copy2.c
+++ b/source3/modules/vfs_shadow_copy2.c
@@ -69,7 +69,6 @@ struct shadow_copy2_snaplist_info {
 	time_t fetch_time; /* snaplist update time */
 };
 
-
 /*
  * shadow_copy2 private structure. This structure will be


-- 
Samba Shared Repository



More information about the samba-cvs mailing list