[SCM] Samba Shared Repository - branch master updated

David Disseldorp ddiss at samba.org
Mon Aug 12 01:19:02 UTC 2019


The branch, master has been updated
       via  e6b7d782020 s3: VFS: vfs_snapper: Make setxattr return errno = EROFS on a shadow copy path.
       via  3beffd18add s3: VFS: vfs_snapper: Make removexattr return errno = EROFS on a shadow copy path.
       via  5d791718532 s3: VFS: vfs_snapper: Make chflags return errno = EROFS on a shadow copy path.
       via  2022338b7f9 s3: VFS: vfs_snapper: Make rmdir return errno = EROFS on a shadow copy path.
       via  6539d3be92f s3: VFS: vfs_snapper: Make mkdir return errno = EROFS on a shadow copy path.
       via  f5dbda6f327 s3: VFS: vfs_snapper: Make mknod return errno = EROFS on a shadow copy path.
       via  78b3784f3ff s3: VFS: vfs_snapper: Make ntimes return errno = EROFS on a shadow copy path.
       via  872cd6fbda9 s3: VFS: vfs_snapper: Make chown return errno = EROFS on a shadow copy path.
       via  8eb79cd0524 s3: VFS: vfs_snapper: Make chmod return errno = EROFS on a shadow copy path.
       via  0b64e84c01a s3: VFS: vfs_snapper: Make unlink return errno = EROFS on a shadow copy path.
      from  9f193b747f3 loadparm: fix mem leak found by ASAN

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


- Log -----------------------------------------------------------------
commit e6b7d782020e86fc8e28438c969a2e9e1da288f1
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Aug 9 10:32:41 2019 -0700

    s3: VFS: vfs_snapper: Make setxattr return errno = EROFS on a shadow copy path.
    
    smbd has no business modifying a shadow copy filesystem, it should be read-only.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: David Disseldorp <ddiss at samba.org>
    
    Autobuild-User(master): David Disseldorp <ddiss at samba.org>
    Autobuild-Date(master): Mon Aug 12 01:18:45 UTC 2019 on sn-devel-184

commit 3beffd18adddbf7f4c1e01e68440a760e866183f
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Aug 9 10:31:38 2019 -0700

    s3: VFS: vfs_snapper: Make removexattr return errno = EROFS on a shadow copy path.
    
    smbd has no business modifying a shadow copy filesystem, it should be read-only.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: David Disseldorp <ddiss at samba.org>

commit 5d791718532502ce1ec79aaaaccd2a9b129f73a5
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Aug 9 10:30:19 2019 -0700

    s3: VFS: vfs_snapper: Make chflags return errno = EROFS on a shadow copy path.
    
    smbd has no business modifying a shadow copy filesystem, it should be read-only.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: David Disseldorp <ddiss at samba.org>

commit 2022338b7f9d6e44c43f3d8c4280cfcca346514c
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Aug 9 10:29:23 2019 -0700

    s3: VFS: vfs_snapper: Make rmdir return errno = EROFS on a shadow copy path.
    
    smbd has no business modifying a shadow copy filesystem, it should be read-only.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: David Disseldorp <ddiss at samba.org>

commit 6539d3be92f044174b862e6cbb04b5ca47651ff4
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Aug 9 10:27:25 2019 -0700

    s3: VFS: vfs_snapper: Make mkdir return errno = EROFS on a shadow copy path.
    
    smbd has no business modifying a shadow copy filesystem, it should be read-only.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: David Disseldorp <ddiss at samba.org>

commit f5dbda6f32771afbd44db6dc0d865d3c221b22b4
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Aug 9 10:26:20 2019 -0700

    s3: VFS: vfs_snapper: Make mknod return errno = EROFS on a shadow copy path.
    
    smbd has no business modifying a shadow copy filesystem, it should be read-only.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: David Disseldorp <ddiss at samba.org>

commit 78b3784f3ffd1c76a4a41f95cbcc6fe4c68b012f
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Aug 9 10:25:14 2019 -0700

    s3: VFS: vfs_snapper: Make ntimes return errno = EROFS on a shadow copy path.
    
    smbd has no business modifying a shadow copy filesystem, it should be read-only.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: David Disseldorp <ddiss at samba.org>

commit 872cd6fbda959936d6b0c3b3e403377837c3abba
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Aug 9 10:24:11 2019 -0700

    s3: VFS: vfs_snapper: Make chown return errno = EROFS on a shadow copy path.
    
    smbd has no business modifying a shadow copy filesystem, it should be read-only.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: David Disseldorp <ddiss at samba.org>

commit 8eb79cd0524e4a9792017ca7999085b5cd6f01c4
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Aug 9 10:19:31 2019 -0700

    s3: VFS: vfs_snapper: Make chmod return errno = EROFS on a shadow copy path.
    
    smbd has no business modifying a shadow copy filesystem, it should be read-only.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: David Disseldorp <ddiss at samba.org>

commit 0b64e84c01a36302a2298c1d1af4c7f4c41ed6eb
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Aug 9 10:07:04 2019 -0700

    s3: VFS: vfs_snapper: Make unlink return errno = EROFS on a shadow copy path.
    
    smbd has no business modifying a shadow copy filesystem, it should be read-only.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: David Disseldorp <ddiss at samba.org>

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

Summary of changes:
 source3/modules/vfs_snapper.c | 325 ++++++------------------------------------
 1 file changed, 46 insertions(+), 279 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/modules/vfs_snapper.c b/source3/modules/vfs_snapper.c
index d862eb3151d..03bcf658ec6 100644
--- a/source3/modules/vfs_snapper.c
+++ b/source3/modules/vfs_snapper.c
@@ -2204,80 +2204,38 @@ static int snapper_gmt_open(vfs_handle_struct *handle,
 static int snapper_gmt_unlink(vfs_handle_struct *handle,
 			      const struct smb_filename *smb_fname)
 {
-	time_t timestamp;
-	char *stripped;
-	int ret, saved_errno;
-	struct smb_filename *conv;
+	time_t timestamp = 0;
 
 	if (!snapper_gmt_strip_snapshot(talloc_tos(), handle,
 					smb_fname->base_name,
-					&timestamp, &stripped)) {
+					&timestamp, NULL)) {
 		return -1;
 	}
-	if (timestamp == 0) {
-		return SMB_VFS_NEXT_UNLINK(handle, smb_fname);
-	}
-	conv = cp_smb_filename(talloc_tos(), smb_fname);
-	if (conv == NULL) {
-		errno = ENOMEM;
-		return -1;
-	}
-	conv->base_name = snapper_gmt_convert(conv, handle,
-					      stripped, timestamp);
-	TALLOC_FREE(stripped);
-	if (conv->base_name == NULL) {
+	if (timestamp != 0) {
+		errno = EROFS;
 		return -1;
 	}
-	ret = SMB_VFS_NEXT_UNLINK(handle, conv);
-	saved_errno = errno;
-	TALLOC_FREE(conv);
-	errno = saved_errno;
-	return ret;
+	return SMB_VFS_NEXT_UNLINK(handle, smb_fname);
 }
 
 static int snapper_gmt_chmod(vfs_handle_struct *handle,
 			const struct smb_filename *smb_fname,
 			mode_t mode)
 {
-	time_t timestamp;
-	char *stripped = NULL;
-	int ret, saved_errno;
-	char *conv = NULL;
-	struct smb_filename *conv_smb_fname = NULL;
+	time_t timestamp = 0;
 
 	if (!snapper_gmt_strip_snapshot(talloc_tos(),
 				handle,
 				smb_fname->base_name,
 				&timestamp,
-				&stripped)) {
-		return -1;
-	}
-	if (timestamp == 0) {
-		TALLOC_FREE(stripped);
-		return SMB_VFS_NEXT_CHMOD(handle, smb_fname, mode);
-	}
-	conv = snapper_gmt_convert(talloc_tos(), handle, stripped, timestamp);
-	TALLOC_FREE(stripped);
-	if (conv == NULL) {
+				NULL)) {
 		return -1;
 	}
-	conv_smb_fname = synthetic_smb_fname(talloc_tos(),
-					conv,
-					NULL,
-					NULL,
-					smb_fname->flags);
-	if (conv_smb_fname == NULL) {
-		TALLOC_FREE(conv);
-		errno = ENOMEM;
+	if (timestamp != 0) {
+		errno = EROFS;
 		return -1;
 	}
-
-	ret = SMB_VFS_NEXT_CHMOD(handle, conv_smb_fname, mode);
-	saved_errno = errno;
-	TALLOC_FREE(conv);
-	TALLOC_FREE(conv_smb_fname);
-	errno = saved_errno;
-	return ret;
+	return SMB_VFS_NEXT_CHMOD(handle, smb_fname, mode);
 }
 
 static int snapper_gmt_chown(vfs_handle_struct *handle,
@@ -2285,44 +2243,20 @@ static int snapper_gmt_chown(vfs_handle_struct *handle,
 			uid_t uid,
 			gid_t gid)
 {
-	time_t timestamp;
-	char *stripped = NULL;
-	int ret, saved_errno;
-	char *conv = NULL;
-	struct smb_filename *conv_smb_fname = NULL;
+	time_t timestamp = 0;
 
 	if (!snapper_gmt_strip_snapshot(talloc_tos(),
 				handle,
 				smb_fname->base_name,
 				&timestamp,
-				&stripped)) {
-		return -1;
-	}
-	if (timestamp == 0) {
-		TALLOC_FREE(stripped);
-		return SMB_VFS_NEXT_CHOWN(handle, smb_fname, uid, gid);
-	}
-	conv = snapper_gmt_convert(talloc_tos(), handle, stripped, timestamp);
-	TALLOC_FREE(stripped);
-	if (conv == NULL) {
+				NULL)) {
 		return -1;
 	}
-	conv_smb_fname = synthetic_smb_fname(talloc_tos(),
-					conv,
-					NULL,
-					NULL,
-					smb_fname->flags);
-	if (conv_smb_fname == NULL) {
-		TALLOC_FREE(conv);
-		errno = ENOMEM;
+	if (timestamp != 0) {
+		errno = EROFS;
 		return -1;
 	}
-	ret = SMB_VFS_NEXT_CHOWN(handle, conv_smb_fname, uid, gid);
-	saved_errno = errno;
-	TALLOC_FREE(conv);
-	TALLOC_FREE(conv_smb_fname);
-	errno = saved_errno;
-	return ret;
+	return SMB_VFS_NEXT_CHOWN(handle, smb_fname, uid, gid);
 }
 
 static int snapper_gmt_chdir(vfs_handle_struct *handle,
@@ -2376,35 +2310,18 @@ static int snapper_gmt_ntimes(vfs_handle_struct *handle,
 			      const struct smb_filename *smb_fname,
 			      struct smb_file_time *ft)
 {
-	time_t timestamp;
-	char *stripped;
-	int ret, saved_errno;
-	struct smb_filename *conv;
+	time_t timestamp = 0;
 
 	if (!snapper_gmt_strip_snapshot(talloc_tos(), handle,
 					smb_fname->base_name,
-					&timestamp, &stripped)) {
-		return -1;
-	}
-	if (timestamp == 0) {
-		return SMB_VFS_NEXT_NTIMES(handle, smb_fname, ft);
-	}
-	conv = cp_smb_filename(talloc_tos(), smb_fname);
-	if (conv == NULL) {
-		errno = ENOMEM;
+					&timestamp, NULL)) {
 		return -1;
 	}
-	conv->base_name = snapper_gmt_convert(conv, handle,
-					      stripped, timestamp);
-	TALLOC_FREE(stripped);
-	if (conv->base_name == NULL) {
+	if (timestamp != 0) {
+		errno = EROFS;
 		return -1;
 	}
-	ret = SMB_VFS_NEXT_NTIMES(handle, conv, ft);
-	saved_errno = errno;
-	TALLOC_FREE(conv);
-	errno = saved_errno;
-	return ret;
+	return SMB_VFS_NEXT_NTIMES(handle, smb_fname, ft);
 }
 
 static int snapper_gmt_readlink(vfs_handle_struct *handle,
@@ -2455,38 +2372,17 @@ static int snapper_gmt_mknod(vfs_handle_struct *handle,
 			SMB_DEV_T dev)
 {
 	time_t timestamp = (time_t)0;
-	char *stripped = NULL;
-	int ret, saved_errno = 0;
-	struct smb_filename *conv_smb_fname = NULL;
 
 	if (!snapper_gmt_strip_snapshot(talloc_tos(), handle,
 					smb_fname->base_name,
-					&timestamp, &stripped)) {
+					&timestamp, NULL)) {
 		return -1;
 	}
-	if (timestamp == 0) {
-		return SMB_VFS_NEXT_MKNOD(handle, smb_fname, mode, dev);
-	}
-	conv_smb_fname = cp_smb_filename(talloc_tos(), smb_fname);
-	if (conv_smb_fname == NULL) {
-		errno = ENOMEM;
-		return -1;
-	}
-	conv_smb_fname->base_name = snapper_gmt_convert(conv_smb_fname, handle,
-					      stripped, timestamp);
-	TALLOC_FREE(stripped);
-	if (conv_smb_fname->base_name == NULL) {
+	if (timestamp != 0) {
+		errno = EROFS;
 		return -1;
 	}
-	ret = SMB_VFS_NEXT_MKNOD(handle, conv_smb_fname, mode, dev);
-	if (ret == -1) {
-		saved_errno = errno;
-	}
-	TALLOC_FREE(conv_smb_fname);
-	if (saved_errno != 0) {
-		errno = saved_errno;
-	}
-	return ret;
+	return SMB_VFS_NEXT_MKNOD(handle, smb_fname, mode, dev);
 }
 
 static struct smb_filename *snapper_gmt_realpath(vfs_handle_struct *handle,
@@ -2621,78 +2517,33 @@ static int snapper_gmt_mkdir(vfs_handle_struct *handle,
 				const struct smb_filename *fname,
 				mode_t mode)
 {
-	time_t timestamp;
-	char *stripped;
-	int ret, saved_errno;
-	char *conv;
-	struct smb_filename *smb_fname = NULL;
+	time_t timestamp = 0;
 
 	if (!snapper_gmt_strip_snapshot(talloc_tos(), handle, fname->base_name,
-					&timestamp, &stripped)) {
-		return -1;
-	}
-	if (timestamp == 0) {
-		return SMB_VFS_NEXT_MKDIR(handle, fname, mode);
-	}
-	conv = snapper_gmt_convert(talloc_tos(), handle, stripped, timestamp);
-	TALLOC_FREE(stripped);
-	if (conv == NULL) {
+					&timestamp, NULL)) {
 		return -1;
 	}
-	smb_fname = synthetic_smb_fname(talloc_tos(),
-					conv,
-					NULL,
-					NULL,
-					fname->flags);
-	TALLOC_FREE(conv);
-	if (smb_fname == NULL) {
-		errno = ENOMEM;
+	if (timestamp != 0) {
+		errno = EROFS;
 		return -1;
 	}
-
-	ret = SMB_VFS_NEXT_MKDIR(handle, smb_fname, mode);
-	saved_errno = errno;
-	TALLOC_FREE(smb_fname);
-	errno = saved_errno;
-	return ret;
+	return SMB_VFS_NEXT_MKDIR(handle, fname, mode);
 }
 
 static int snapper_gmt_rmdir(vfs_handle_struct *handle,
 				const struct smb_filename *fname)
 {
-	time_t timestamp;
-	char *stripped;
-	int ret, saved_errno;
-	char *conv;
-	struct smb_filename *smb_fname = NULL;
+	time_t timestamp = 0;
 
 	if (!snapper_gmt_strip_snapshot(talloc_tos(), handle, fname->base_name,
-					&timestamp, &stripped)) {
+					&timestamp, NULL)) {
 		return -1;
 	}
-	if (timestamp == 0) {
-		return SMB_VFS_NEXT_RMDIR(handle, fname);
-	}
-	conv = snapper_gmt_convert(talloc_tos(), handle, stripped, timestamp);
-	TALLOC_FREE(stripped);
-	if (conv == NULL) {
-		return -1;
-	}
-	smb_fname = synthetic_smb_fname(talloc_tos(),
-					conv,
-					NULL,
-					NULL,
-					fname->flags);
-	TALLOC_FREE(conv);
-	if (smb_fname == NULL) {
-		errno = ENOMEM;
+	if (timestamp != 0) {
+		errno = EROFS;
 		return -1;
 	}
-	ret = SMB_VFS_NEXT_RMDIR(handle, smb_fname);
-	saved_errno = errno;
-	TALLOC_FREE(smb_fname);
-	errno = saved_errno;
-	return ret;
+	return SMB_VFS_NEXT_RMDIR(handle, fname);
 }
 
 static int snapper_gmt_chflags(vfs_handle_struct *handle,
@@ -2700,43 +2551,16 @@ static int snapper_gmt_chflags(vfs_handle_struct *handle,
 				unsigned int flags)
 {
 	time_t timestamp = 0;
-	char *stripped = NULL;
-	int ret = -1;
-	int saved_errno = 0;
-	char *conv = NULL;
-	struct smb_filename *conv_smb_fname = NULL;
 
 	if (!snapper_gmt_strip_snapshot(talloc_tos(), handle,
-				smb_fname->base_name, &timestamp, &stripped)) {
-		return -1;
-	}
-	if (timestamp == 0) {
-		return SMB_VFS_NEXT_CHFLAGS(handle, smb_fname, flags);
-	}
-	conv = snapper_gmt_convert(talloc_tos(), handle, stripped, timestamp);
-	TALLOC_FREE(stripped);
-	if (conv == NULL) {
+				smb_fname->base_name, &timestamp, NULL)) {
 		return -1;
 	}
-	conv_smb_fname = synthetic_smb_fname(talloc_tos(),
-					conv,
-					NULL,
-					NULL,
-					smb_fname->flags);
-	TALLOC_FREE(conv);
-	if (conv_smb_fname == NULL) {
-		errno = ENOMEM;
+	if (timestamp != 0) {
+		errno = EROFS;
 		return -1;
 	}
-	ret = SMB_VFS_NEXT_CHFLAGS(handle, conv_smb_fname, flags);
-	if (ret == -1) {
-		saved_errno = errno;
-	}
-	TALLOC_FREE(conv_smb_fname);
-	if (saved_errno != 0) {
-		errno = saved_errno;
-	}
-	return ret;
+	return SMB_VFS_NEXT_CHFLAGS(handle, smb_fname, flags);
 }
 
 static ssize_t snapper_gmt_getxattr(vfs_handle_struct *handle,
@@ -2843,47 +2667,19 @@ static int snapper_gmt_removexattr(vfs_handle_struct *handle,
 				const char *aname)
 {
 	time_t timestamp = 0;
-	char *stripped = NULL;
-	ssize_t ret;
-	int saved_errno = 0;
-	char *conv = NULL;
-	struct smb_filename *conv_smb_fname = NULL;
 
 	if (!snapper_gmt_strip_snapshot(talloc_tos(),
 					handle,
 					smb_fname->base_name,
 					&timestamp,
-					&stripped)) {
-		return -1;
-	}
-	if (timestamp == 0) {
-		return SMB_VFS_NEXT_REMOVEXATTR(handle, smb_fname, aname);
-	}
-	conv = snapper_gmt_convert(talloc_tos(), handle, stripped, timestamp);
-	TALLOC_FREE(stripped);
-	if (conv == NULL) {
+					NULL)) {
 		return -1;
 	}
-	conv_smb_fname = synthetic_smb_fname(talloc_tos(),
-					conv,
-					NULL,
-					NULL,
-					smb_fname->flags);
-	TALLOC_FREE(conv);
-	if (conv_smb_fname == NULL) {
-		errno = ENOMEM;
+	if (timestamp != 0) {
+		errno = EROFS;
 		return -1;
 	}
-	ret = SMB_VFS_NEXT_REMOVEXATTR(handle, conv_smb_fname, aname);
-	if (ret == -1) {
-		saved_errno = errno;
-	}
-	TALLOC_FREE(conv_smb_fname);
-	TALLOC_FREE(conv);
-	if (saved_errno != 0) {
-		errno = saved_errno;
-	}
-	return ret;
+	return SMB_VFS_NEXT_REMOVEXATTR(handle, smb_fname, aname);
 }
 
 static int snapper_gmt_setxattr(struct vfs_handle_struct *handle,
@@ -2892,49 +2688,20 @@ static int snapper_gmt_setxattr(struct vfs_handle_struct *handle,
 				size_t size, int flags)
 {
 	time_t timestamp = 0;
-	char *stripped = NULL;
-	ssize_t ret;
-	int saved_errno = 0;
-	char *conv = NULL;
-	struct smb_filename *conv_smb_fname = NULL;
 
 	if (!snapper_gmt_strip_snapshot(talloc_tos(),
 					handle,
 					smb_fname->base_name,
 					&timestamp,
-					&stripped)) {
+					NULL)) {
 		return -1;
 	}
-	if (timestamp == 0) {
-		return SMB_VFS_NEXT_SETXATTR(handle, smb_fname,
-					aname, value, size, flags);
-	}
-	conv = snapper_gmt_convert(talloc_tos(), handle, stripped, timestamp);
-	TALLOC_FREE(stripped);
-	if (conv == NULL) {
-		return -1;
-	}
-	conv_smb_fname = synthetic_smb_fname(talloc_tos(),
-					conv,
-					NULL,
-					NULL,
-					smb_fname->flags);
-	TALLOC_FREE(conv);
-	if (conv_smb_fname == NULL) {
-		errno = ENOMEM;
+	if (timestamp != 0) {
+		errno = EROFS;
 		return -1;
 	}
-	ret = SMB_VFS_NEXT_SETXATTR(handle, conv_smb_fname,
+	return SMB_VFS_NEXT_SETXATTR(handle, smb_fname,
 				aname, value, size, flags);
-	if (ret == -1) {
-		saved_errno = errno;
-	}
-	TALLOC_FREE(conv_smb_fname);
-	TALLOC_FREE(conv);
-	if (saved_errno != 0) {
-		errno = saved_errno;
-	}
-	return ret;
 }
 
 static int snapper_gmt_get_real_filename(struct vfs_handle_struct *handle,


-- 
Samba Shared Repository



More information about the samba-cvs mailing list