[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Fri Aug 19 12:44:01 UTC 2022


The branch, master has been updated
       via  06f35edaf12 lib: Map ERANGE to NT_STATUS_INTEGER_OVERFLOW
       via  b954d181cd2 vfs_gpfs: Prevent mangling of GPFS timestamps after 2106
      from  96e2a82760e s3:smbd: only clear LEASE_READ if there's no read lease is left

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


- Log -----------------------------------------------------------------
commit 06f35edaf129ce3195960905d38af73ec12fc716
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Sep 1 13:24:55 2020 +0200

    lib: Map ERANGE to NT_STATUS_INTEGER_OVERFLOW
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=15151
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Christof Schmitt <cs at samba.org>
    
    Autobuild-User(master): Volker Lendecke <vl at samba.org>
    Autobuild-Date(master): Fri Aug 19 12:43:06 UTC 2022 on sn-devel-184

commit b954d181cd25d9029d3c222e8d97fe7a3b0b2400
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Aug 31 16:14:14 2020 +0200

    vfs_gpfs: Prevent mangling of GPFS timestamps after 2106
    
    gpfs_set_times as of August 2020 stores 32-bit unsigned tv_sec. We
    should not silently garble time stamps but reject the attempt to set
    an out-of-range timestamp.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=15151
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Christof Schmitt <cs at samba.org>

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

Summary of changes:
 source3/lib/errmap_unix.c  |  3 +++
 source3/modules/vfs_gpfs.c | 43 +++++++++++++++++++++++++++++++++----------
 2 files changed, 36 insertions(+), 10 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/lib/errmap_unix.c b/source3/lib/errmap_unix.c
index 73b2f532a06..029efae0f51 100644
--- a/source3/lib/errmap_unix.c
+++ b/source3/lib/errmap_unix.c
@@ -119,6 +119,9 @@ static const struct {
 	{ EOVERFLOW,      NT_STATUS_ALLOTTED_SPACE_EXCEEDED },
 #endif
 	{ EINPROGRESS,	NT_STATUS_MORE_PROCESSING_REQUIRED },
+#ifdef ERANGE
+	{ ERANGE, NT_STATUS_INTEGER_OVERFLOW },
+#endif
 };
 
 /*********************************************************************
diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c
index bb15ba630b9..1f3d803e1c5 100644
--- a/source3/modules/vfs_gpfs.c
+++ b/source3/modules/vfs_gpfs.c
@@ -1672,15 +1672,27 @@ static int vfs_gpfs_lstat(struct vfs_handle_struct *handle,
 	return ret;
 }
 
-static void timespec_to_gpfs_time(struct timespec ts, gpfs_timestruc_t *gt,
-				  int idx, int *flags)
+static int timespec_to_gpfs_time(
+	struct timespec ts, gpfs_timestruc_t *gt, int idx, int *flags)
 {
-	if (!is_omit_timespec(&ts)) {
-		*flags |= 1 << idx;
-		gt[idx].tv_sec = ts.tv_sec;
-		gt[idx].tv_nsec = ts.tv_nsec;
-		DEBUG(10, ("Setting GPFS time %d, flags 0x%x\n", idx, *flags));
+	if (is_omit_timespec(&ts)) {
+		return 0;
 	}
+
+	if (ts.tv_sec > UINT32_MAX) {
+		DBG_WARNING("GPFS uses 32-bit unsigned timestamps, "
+			    "%ju is too large\n",
+			    (uintmax_t)ts.tv_sec);
+		errno = ERANGE;
+		return -1;
+	}
+
+	*flags |= 1 << idx;
+	gt[idx].tv_sec = ts.tv_sec;
+	gt[idx].tv_nsec = ts.tv_nsec;
+	DBG_DEBUG("Setting GPFS time %d, flags 0x%x\n", idx, *flags);
+
+	return 0;
 }
 
 static int smbd_gpfs_set_times(struct files_struct *fsp,
@@ -1691,10 +1703,21 @@ static int smbd_gpfs_set_times(struct files_struct *fsp,
 	int rc;
 
 	ZERO_ARRAY(gpfs_times);
-	timespec_to_gpfs_time(ft->atime, gpfs_times, 0, &flags);
-	timespec_to_gpfs_time(ft->mtime, gpfs_times, 1, &flags);
+	rc = timespec_to_gpfs_time(ft->atime, gpfs_times, 0, &flags);
+	if (rc != 0) {
+		return rc;
+	}
+
+	rc = timespec_to_gpfs_time(ft->mtime, gpfs_times, 1, &flags);
+	if (rc != 0) {
+		return rc;
+	}
+
 	/* No good mapping from LastChangeTime to ctime, not storing */
-	timespec_to_gpfs_time(ft->create_time, gpfs_times, 3, &flags);
+	rc = timespec_to_gpfs_time(ft->create_time, gpfs_times, 3, &flags);
+	if (rc != 0) {
+		return rc;
+	}
 
 	if (!flags) {
 		DBG_DEBUG("nothing to do, return to avoid EINVAL\n");


-- 
Samba Shared Repository



More information about the samba-cvs mailing list