[SCM] Samba Shared Repository - branch master updated

Ralph Böhme slow at samba.org
Wed Aug 7 18:00:01 UTC 2019


The branch, master has been updated
       via  551e3590f98 s3: VFS: Make setxattr return errno = EROFS on a shadow copy path.
       via  fc405e919d6 s3: VFS: Make removexattr return errno = EROFS on a shadow copy path.
       via  5ed5d5445f3 s3: VFS: Make chflags return errno = EROFS on a shadow copy path.
       via  d81570e5fb2 s3: VFS: Make rmdir return errno = EROFS on a shadow copy path.
       via  9d35f74766f s3: VFS: Make mkdir return errno = EROFS on a shadow copy path.
       via  2e43661a1b9 s3: VFS: Make mknod return errno = EROFS on a shadow copy path.
       via  15761609ee9 s3: VFS: Make ntimes return errno = EROFS on a shadow copy path.
       via  68330458e6e s3: VFS: Make chown return errno = EROFS on a shadow copy path.
       via  e8e1b00aef9 s3: VFS: Make chmod return errno = EROFS on a shadow copy path.
       via  2e3f644f0aa s3: VFS: Make unlink return errno = EROFS on a shadow copy path.
      from  959b77988d0 s4:librpc/rpc: Use generic roh_connect_channel_send/recv

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


- Log -----------------------------------------------------------------
commit 551e3590f98393879ab4c97e7fa734602d4e9f7c
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Aug 1 13:40:43 2019 -0700

    s3: VFS: 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: Ralph Boehme <slow at samba.org>
    
    Autobuild-User(master): Ralph Böhme <slow at samba.org>
    Autobuild-Date(master): Wed Aug  7 17:59:25 UTC 2019 on sn-devel-184

commit fc405e919d606a3cdb59d557cadeeb953534c1b5
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Aug 1 13:39:42 2019 -0700

    s3: VFS: 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: Ralph Boehme <slow at samba.org>

commit 5ed5d5445f3bc8c9a864af6f0731ba389d53a511
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Aug 1 13:35:47 2019 -0700

    s3: VFS: 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: Ralph Boehme <slow at samba.org>

commit d81570e5fb201181134e2f601a53f49c035bdfab
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Aug 1 13:33:27 2019 -0700

    s3: VFS: 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: Ralph Boehme <slow at samba.org>

commit 9d35f74766fb0feee7cdbc24f5ca0364ef4b62b9
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Aug 1 13:32:32 2019 -0700

    s3: VFS: 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: Ralph Boehme <slow at samba.org>

commit 2e43661a1b907209a3ae165f1ec2b4bcb1c93ddf
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Aug 1 13:31:01 2019 -0700

    s3: VFS: 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: Ralph Boehme <slow at samba.org>

commit 15761609ee9bf5b1276992103f3b4ebbda9c5e83
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Aug 1 13:29:54 2019 -0700

    s3: VFS: 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: Ralph Boehme <slow at samba.org>

commit 68330458e6e3ccc0e5a62d3fa5b99a66d02771ac
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Aug 1 13:25:37 2019 -0700

    s3: VFS: 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: Ralph Boehme <slow at samba.org>

commit e8e1b00aef923c701b122cdcc6de16a05b9915ca
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Aug 1 13:23:48 2019 -0700

    s3: VFS: 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: Ralph Boehme <slow at samba.org>

commit 2e3f644f0aa78a255df41325ea6f3bee7f733208
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Aug 1 13:18:42 2019 -0700

    s3: VFS: 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: Ralph Boehme <slow at samba.org>

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

Summary of changes:
 source3/modules/vfs_shadow_copy2.c | 340 +++++--------------------------------
 1 file changed, 40 insertions(+), 300 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c
index e5def9669f4..f84a76b5357 100644
--- a/source3/modules/vfs_shadow_copy2.c
+++ b/source3/modules/vfs_shadow_copy2.c
@@ -1480,39 +1480,17 @@ static int shadow_copy2_unlink(vfs_handle_struct *handle,
 			       const struct smb_filename *smb_fname)
 {
 	time_t timestamp = 0;
-	char *stripped = NULL;
-	int saved_errno = 0;
-	int ret;
-	struct smb_filename *conv;
 
 	if (!shadow_copy2_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 = shadow_copy2_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);
-	if (ret == -1) {
-		saved_errno = errno;
-	}
-	TALLOC_FREE(conv);
-	if (saved_errno != 0) {
-		errno = saved_errno;
-	}
-	return ret;
+	return SMB_VFS_NEXT_UNLINK(handle, smb_fname);
 }
 
 static int shadow_copy2_chmod(vfs_handle_struct *handle,
@@ -1520,49 +1498,19 @@ static int shadow_copy2_chmod(vfs_handle_struct *handle,
 			mode_t mode)
 {
 	time_t timestamp = 0;
-	char *stripped = NULL;
-	int saved_errno = 0;
-	int ret;
-	char *conv = NULL;
-	struct smb_filename *conv_smb_fname;
 
 	if (!shadow_copy2_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 = shadow_copy2_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);
-	if (ret == -1) {
-		saved_errno = errno;
-	}
-	TALLOC_FREE(conv);
-	TALLOC_FREE(conv_smb_fname);
-	if (saved_errno != 0) {
-		errno = saved_errno;
-	}
-	return ret;
+	return SMB_VFS_NEXT_CHMOD(handle, smb_fname, mode);
 }
 
 static int shadow_copy2_chown(vfs_handle_struct *handle,
@@ -1571,47 +1519,19 @@ static int shadow_copy2_chown(vfs_handle_struct *handle,
 			gid_t gid)
 {
 	time_t timestamp = 0;
-	char *stripped = NULL;
-	int saved_errno = 0;
-	int ret;
-	char *conv = NULL;
-	struct smb_filename *conv_smb_fname = NULL;
 
 	if (!shadow_copy2_strip_snapshot(talloc_tos(),
 				handle,
 				smb_fname->base_name,
 				&timestamp,
-				&stripped)) {
-		return -1;
-	}
-	if (timestamp == 0) {
-		return SMB_VFS_NEXT_CHOWN(handle, smb_fname, uid, gid);
-	}
-	conv = shadow_copy2_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);
-	if (ret == -1) {
-		saved_errno = errno;
-	}
-	TALLOC_FREE(conv);
-	TALLOC_FREE(conv_smb_fname);
-	if (saved_errno != 0) {
-		errno = saved_errno;
-	}
-	return ret;
+	return SMB_VFS_NEXT_CHOWN(handle, smb_fname, uid, gid);
 }
 
 static void store_cwd_data(vfs_handle_struct *handle,
@@ -1720,39 +1640,17 @@ static int shadow_copy2_ntimes(vfs_handle_struct *handle,
 			       struct smb_file_time *ft)
 {
 	time_t timestamp = 0;
-	char *stripped = NULL;
-	int saved_errno = 0;
-	int ret;
-	struct smb_filename *conv;
 
 	if (!shadow_copy2_strip_snapshot(talloc_tos(), handle,
 					 smb_fname->base_name,
-					 &timestamp, &stripped)) {
+					 &timestamp, NULL)) {
 		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;
-		return -1;
-	}
-	conv->base_name = shadow_copy2_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);
-	if (ret == -1) {
-		saved_errno = errno;
-	}
-	TALLOC_FREE(conv);
-	if (saved_errno != 0) {
-		errno = saved_errno;
-	}
-	return ret;
+	return SMB_VFS_NEXT_NTIMES(handle, smb_fname, ft);
 }
 
 static int shadow_copy2_readlink(vfs_handle_struct *handle,
@@ -1803,39 +1701,17 @@ static int shadow_copy2_mknod(vfs_handle_struct *handle,
 				SMB_DEV_T dev)
 {
 	time_t timestamp = 0;
-	char *stripped = NULL;
-	int saved_errno = 0;
-	int ret;
-	struct smb_filename *conv = NULL;
 
 	if (!shadow_copy2_strip_snapshot(talloc_tos(), handle,
 					 smb_fname->base_name,
-					 &timestamp, &stripped)) {
-		return -1;
-	}
-	if (timestamp == 0) {
-		return SMB_VFS_NEXT_MKNOD(handle, smb_fname, mode, dev);
-	}
-	conv = cp_smb_filename(talloc_tos(), smb_fname);
-	if (conv == NULL) {
-		errno = ENOMEM;
+					 &timestamp, NULL)) {
 		return -1;
 	}
-	conv->base_name = shadow_copy2_convert(
-		conv, handle, stripped, timestamp);
-	TALLOC_FREE(stripped);
-	if (conv->base_name == NULL) {
+	if (timestamp != 0) {
+		errno = EROFS;
 		return -1;
 	}
-	ret = SMB_VFS_NEXT_MKNOD(handle, conv, mode, dev);
-	if (ret == -1) {
-		saved_errno = errno;
-	}
-	TALLOC_FREE(conv);
-	if (saved_errno != 0) {
-		errno = saved_errno;
-	}
-	return ret;
+	return SMB_VFS_NEXT_MKNOD(handle, smb_fname, mode, dev);
 }
 
 static struct smb_filename *shadow_copy2_realpath(vfs_handle_struct *handle,
@@ -2370,92 +2246,38 @@ static int shadow_copy2_mkdir(vfs_handle_struct *handle,
 				mode_t mode)
 {
 	time_t timestamp = 0;
-	char *stripped = NULL;
-	int saved_errno = 0;
-	int ret;
-	char *conv;
-	struct smb_filename *conv_smb_fname = NULL;
 
 	if (!shadow_copy2_strip_snapshot(talloc_tos(),
 					handle,
 					smb_fname->base_name,
 					&timestamp,
-					&stripped)) {
-		return -1;
-	}
-	if (timestamp == 0) {
-		return SMB_VFS_NEXT_MKDIR(handle, smb_fname, mode);
-	}
-	conv = shadow_copy2_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);
+	if (timestamp != 0) {
+		errno = EROFS;
 		return -1;
 	}
-	ret = SMB_VFS_NEXT_MKDIR(handle, conv_smb_fname, mode);
-	if (ret == -1) {
-		saved_errno = errno;
-	}
-	TALLOC_FREE(conv);
-	TALLOC_FREE(conv_smb_fname);
-	if (saved_errno != 0) {
-		errno = saved_errno;
-	}
-	return ret;
+	return SMB_VFS_NEXT_MKDIR(handle, smb_fname, mode);
 }
 
 static int shadow_copy2_rmdir(vfs_handle_struct *handle,
 				const struct smb_filename *smb_fname)
 {
 	time_t timestamp = 0;
-	char *stripped = NULL;
-	int saved_errno = 0;
-	int ret;
-	char *conv;
-	struct smb_filename *conv_smb_fname = NULL;
 
 	if (!shadow_copy2_strip_snapshot(talloc_tos(),
 					handle,
 					smb_fname->base_name,
 					&timestamp,
-					&stripped)) {
-		return -1;
-	}
-	if (timestamp == 0) {
-		return SMB_VFS_NEXT_RMDIR(handle, smb_fname);
-	}
-	conv = shadow_copy2_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);
+	if (timestamp != 0) {
+		errno = EROFS;
 		return -1;
 	}
-	ret = SMB_VFS_NEXT_RMDIR(handle, conv_smb_fname);
-	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_RMDIR(handle, smb_fname);
 }
 
 static int shadow_copy2_chflags(vfs_handle_struct *handle,
@@ -2463,46 +2285,19 @@ static int shadow_copy2_chflags(vfs_handle_struct *handle,
 				unsigned int flags)
 {
 	time_t timestamp = 0;
-	char *stripped = NULL;
-	int saved_errno = 0;
-	int ret;
-	char *conv;
-	struct smb_filename *conv_smb_fname = NULL;
 
 	if (!shadow_copy2_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 = shadow_copy2_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);
+	if (timestamp != 0) {
+		errno = EROFS;
 		return -1;
 	}
-	ret = SMB_VFS_NEXT_CHFLAGS(handle, smb_fname, flags);
-	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_CHFLAGS(handle, smb_fname, flags);
 }
 
 static ssize_t shadow_copy2_getxattr(vfs_handle_struct *handle,
@@ -2609,46 +2404,19 @@ static int shadow_copy2_removexattr(vfs_handle_struct *handle,
 				const char *aname)
 {
 	time_t timestamp = 0;
-	char *stripped = NULL;
-	int saved_errno = 0;
-	int ret;
-	char *conv;
-	struct smb_filename *conv_smb_fname = NULL;
 
 	if (!shadow_copy2_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 = shadow_copy2_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);
+	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 shadow_copy2_setxattr(struct vfs_handle_struct *handle,
@@ -2657,48 +2425,20 @@ static int shadow_copy2_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;
-	struct smb_filename *conv_smb_fname = NULL;
 
 	if (!shadow_copy2_strip_snapshot(talloc_tos(),
 				handle,
 				smb_fname->base_name,
 				&timestamp,
-				&stripped)) {
-		return -1;
-	}
-	if (timestamp == 0) {
-		return SMB_VFS_NEXT_SETXATTR(handle, smb_fname,
-					aname, value, size, flags);
-	}
-	conv = shadow_copy2_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);
+	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 shadow_copy2_get_real_filename(struct vfs_handle_struct *handle,


-- 
Samba Shared Repository



More information about the samba-cvs mailing list