[SCM] Samba Shared Repository - branch master updated
Jeremy Allison
jra at samba.org
Tue Jan 21 23:34:03 UTC 2020
The branch, master has been updated
via ad236bb7590 s3: lib: nmblib. Clean up and harden nmb packet processing.
via a39c4d9bed2 vfs_gpfs: Preserve errno across unbecome_root call
via 01e563be72f smbd: Remove unused define
via 6a19404e98e smbd: Remove unused function linux_set_lease_capability
via fed2c3edc52 vfs_gpfs: Cleanup lease mapping function
via 49584782789 vfs_gpfs: Change lease helper function to only provide mapping
via 96252a0ec4c vfs_gpfs: Remove function call from "if" statement
via d9c992a7a9f vfs_gpfs: Reformat function definition of vfs_gpfs_setlease
via 22cd011bc41 vfs_gpfs: Remove call to linux_set_lease_capability
from 648f94d2031 script/release.sh: make it possible to run from a git worktree
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit ad236bb7590e423b4c69fe6028f2f3495977f48b
Author: Jeremy Allison <jra at samba.org>
Date: Fri Jan 17 13:49:48 2020 -0800
s3: lib: nmblib. Clean up and harden nmb packet processing.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14239
OSS-FUZZ: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20156
OSS-FUZZ: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20157
Credit to oss-fuzz.
No security implications.
Signed-off-by: Jeremy Allison <jra at samba.org>
Pair programmed with: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Tue Jan 21 23:33:41 UTC 2020 on sn-devel-184
commit a39c4d9bed2468495e0efc13620fea5a1fb650f8
Author: Christof Schmitt <cs at samba.org>
Date: Thu Jan 16 14:15:15 2020 -0700
vfs_gpfs: Preserve errno across unbecome_root call
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 01e563be72f8e37a1f4fafe7a5a8b2c7b19db7c8
Author: Christof Schmitt <cs at samba.org>
Date: Thu Jan 16 13:50:03 2020 -0700
smbd: Remove unused define
CAP_LEASE is not used in the file oplock_linux.c, so remove it there.
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 6a19404e98ed1ed234c6948e78d1b1304c48a45d
Author: Christof Schmitt <cs at samba.org>
Date: Thu Jan 16 13:45:54 2020 -0700
smbd: Remove unused function linux_set_lease_capability
This function is no longer used. In case this capability would be
required, set_effective_capability(LEASE_CAPABILITY) could also be
called directly.
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit fed2c3edc5285d712e5c060a8fc0f05fc19ae6bb
Author: Christof Schmitt <cs at samba.org>
Date: Thu Jan 16 12:18:46 2020 -0700
vfs_gpfs: Cleanup lease mapping function
Shorten the function a bit by directly returning the mapped value.
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 49584782789f345a38f5efa577439c934bc4b7a6
Author: Christof Schmitt <cs at samba.org>
Date: Thu Jan 16 12:17:46 2020 -0700
vfs_gpfs: Change lease helper function to only provide mapping
The set_gpfs_lease function first maps the lease argument to the GPFS
version and then issues the API call. Change this to only do the mapping
in the helper function.
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 96252a0ec4c460372f79f8fb31a876ab511c941d
Author: Christof Schmitt <cs at samba.org>
Date: Thu Jan 16 12:15:29 2020 -0700
vfs_gpfs: Remove function call from "if" statement
Follow the current coding guidelines to first issue the function call
and then check the return code.
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit d9c992a7a9fef7cdaea304b9c22f9e4025588e87
Author: Christof Schmitt <cs at samba.org>
Date: Thu Jan 16 12:13:46 2020 -0700
vfs_gpfs: Reformat function definition of vfs_gpfs_setlease
Remove trailing whitespace and put each argument on a seperate line.
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 22cd011bc41f648cd3570a511ea3c45eac67e52c
Author: Christof Schmitt <cs at samba.org>
Date: Thu Jan 16 12:12:53 2020 -0700
vfs_gpfs: Remove call to linux_set_lease_capability
The API call is already done as root user (become_root), so that the
lease contains the root user. The lease capability is already implied by
the root user, so the explicit call to linux_set_lease_capability is not
required.
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
-----------------------------------------------------------------------
Summary of changes:
source3/libsmb/nmblib.c | 12 ++++++++----
source3/modules/vfs_gpfs.c | 36 ++++++++++++++++++++----------------
source3/smbd/oplock_linux.c | 12 ------------
source3/smbd/proto.h | 1 -
4 files changed, 28 insertions(+), 33 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/libsmb/nmblib.c b/source3/libsmb/nmblib.c
index b6dca800e94..84cbb054b8e 100644
--- a/source3/libsmb/nmblib.c
+++ b/source3/libsmb/nmblib.c
@@ -192,10 +192,14 @@ static int parse_nmb_name(char *inbuf,int ofs,int length, struct nmb_name *name)
m = ubuf[offset];
- if (!m)
- return(0);
- if ((m & 0xC0) || offset+m+2 > length)
- return(0);
+ /* m must be 32 to exactly fill in the 16 bytes of the netbios name */
+ if (m != 32) {
+ return 0;
+ }
+ /* Cannot go past length. */
+ if (offset+m+2 > length) {
+ return 0;
+ }
memset((char *)name,'\0',sizeof(*name));
diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c
index de18d32ac23..1c843db503d 100644
--- a/source3/modules/vfs_gpfs.c
+++ b/source3/modules/vfs_gpfs.c
@@ -219,27 +219,21 @@ static int vfs_gpfs_close(vfs_handle_struct *handle, files_struct *fsp)
return SMB_VFS_NEXT_CLOSE(handle, fsp);
}
-static int set_gpfs_lease(int fd, int leasetype)
+static int lease_type_to_gpfs(int leasetype)
{
- int gpfs_type = GPFS_LEASE_NONE;
-
if (leasetype == F_RDLCK) {
- gpfs_type = GPFS_LEASE_READ;
+ return GPFS_LEASE_READ;
}
+
if (leasetype == F_WRLCK) {
- gpfs_type = GPFS_LEASE_WRITE;
+ return GPFS_LEASE_WRITE;
}
- /* we unconditionally set CAP_LEASE, rather than looking for
- -1/EACCES as there is a bug in some versions of
- libgpfs_gpl.so which results in a leaked fd on /dev/ss0
- each time we try this with the wrong capabilities set
- */
- linux_set_lease_capability();
- return gpfswrap_set_lease(fd, gpfs_type);
+ return GPFS_LEASE_NONE;
}
-static int vfs_gpfs_setlease(vfs_handle_struct *handle, files_struct *fsp,
+static int vfs_gpfs_setlease(vfs_handle_struct *handle,
+ files_struct *fsp,
int leasetype)
{
struct gpfs_config_data *config;
@@ -251,19 +245,29 @@ static int vfs_gpfs_setlease(vfs_handle_struct *handle, files_struct *fsp,
struct gpfs_config_data,
return -1);
- if (linux_set_lease_sighandler(fsp->fh->fd) == -1) {
- ret = -1;
+ ret = linux_set_lease_sighandler(fsp->fh->fd);
+ if (ret == -1) {
goto failure;
}
if (config->leases) {
+ int gpfs_lease_type = lease_type_to_gpfs(leasetype);
+ int saved_errno = 0;
+
/*
* Ensure the lease owner is root to allow
* correct delivery of lease-break signals.
*/
become_root();
- ret = set_gpfs_lease(fsp->fh->fd,leasetype);
+ ret = gpfswrap_set_lease(fsp->fh->fd, gpfs_lease_type);
+ if (ret < 0) {
+ saved_errno = errno;
+ }
unbecome_root();
+
+ if (saved_errno != 0) {
+ errno = saved_errno;
+ }
}
failure:
diff --git a/source3/smbd/oplock_linux.c b/source3/smbd/oplock_linux.c
index 7549d492ce0..44ed976b92c 100644
--- a/source3/smbd/oplock_linux.c
+++ b/source3/smbd/oplock_linux.c
@@ -33,10 +33,6 @@
#define F_GETLEASE 1025
#endif
-#ifndef CAP_LEASE
-#define CAP_LEASE 28
-#endif
-
#ifndef RT_SIGNAL_LEASE
#define RT_SIGNAL_LEASE (SIGRTMIN+1)
#endif
@@ -45,14 +41,6 @@
#define F_SETSIG 10
#endif
-/*
- * public function to get linux lease capability. Needed by some VFS modules (eg. gpfs.c)
- */
-void linux_set_lease_capability(void)
-{
- set_effective_capability(LEASE_CAPABILITY);
-}
-
/*
* Call to set the kernel lease signal handler
*/
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index de4a53c6187..d325f7d56e0 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -757,7 +757,6 @@ void init_kernel_oplocks(struct smbd_server_connection *sconn);
/* The following definitions come from smbd/oplock_linux.c */
-void linux_set_lease_capability(void);
int linux_set_lease_sighandler(int fd);
int linux_setlease(int fd, int leasetype);
struct kernel_oplocks *linux_init_kernel_oplocks(struct smbd_server_connection *sconn);
--
Samba Shared Repository
More information about the samba-cvs
mailing list