summaryrefslogtreecommitdiff
path: root/source3/modules
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2007-05-29 19:54:26 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:22:57 -0500
commit00959280b2801d21a2e637023c8b3006c3d24ffd (patch)
tree018ca3749434216c19b41569992d9dd8d016c824 /source3/modules
parent2b69775756a6395f14b1d0e2ef64cc7d84deeca9 (diff)
downloadsamba-00959280b2801d21a2e637023c8b3006c3d24ffd.tar.gz
samba-00959280b2801d21a2e637023c8b3006c3d24ffd.tar.bz2
samba-00959280b2801d21a2e637023c8b3006c3d24ffd.zip
r23228: Merge cleanup to the gpfs module from Tridge. Also potentially disable
gpfs share modes in special situations. This might be split up in several modules later. (This used to be commit 553fe9245165ce4a14902daa722935c94ff32d61)
Diffstat (limited to 'source3/modules')
-rw-r--r--source3/modules/gpfs.c61
1 files changed, 28 insertions, 33 deletions
diff --git a/source3/modules/gpfs.c b/source3/modules/gpfs.c
index 19050ad3ca..d274984ec7 100644
--- a/source3/modules/gpfs.c
+++ b/source3/modules/gpfs.c
@@ -25,6 +25,7 @@
#include "gpfs_gpl.h"
static void *libgpfs_handle = NULL;
+static BOOL gpfs_share_modes;
static int (*gpfs_set_share_fn)(int fd, unsigned int allow, unsigned int deny);
static int (*gpfs_set_lease_fn)(int fd, unsigned int leaseType);
@@ -39,6 +40,10 @@ BOOL set_gpfs_sharemode(files_struct *fsp, uint32 access_mask,
unsigned int deny = GPFS_DENY_NONE;
int result;
+ if (!gpfs_share_modes) {
+ return True;
+ }
+
if (gpfs_set_share_fn == NULL) {
return False;
}
@@ -84,6 +89,10 @@ int set_gpfs_lease(int fd, int leasetype)
{
int gpfs_type = GPFS_LEASE_NONE;
+ if (!gpfs_share_modes) {
+ return True;
+ }
+
if (gpfs_set_lease_fn == NULL) {
errno = EINVAL;
return -1;
@@ -138,15 +147,7 @@ void init_gpfs(void)
if (gpfs_set_share_fn == NULL) {
DEBUG(3, ("libgpfs_gpl.so does not contain the symbol "
"'gpfs_set_share'\n"));
- sys_dlclose(libgpfs_handle);
-
- /* leave libgpfs_handle != NULL around, no point
- in trying twice */
- gpfs_set_share_fn = NULL;
- gpfs_set_lease_fn = NULL;
- gpfs_getacl_fn = NULL;
- gpfs_putacl_fn = NULL;
- return;
+ goto failed;
}
gpfs_set_lease_fn = sys_dlsym(libgpfs_handle, "gpfs_set_lease");
@@ -155,45 +156,39 @@ void init_gpfs(void)
"'gpfs_set_lease'\n"));
sys_dlclose(libgpfs_handle);
- /* leave libgpfs_handle != NULL around, no point
- in trying twice */
- gpfs_set_share_fn = NULL;
- gpfs_set_lease_fn = NULL;
- gpfs_getacl_fn = NULL;
- gpfs_putacl_fn = NULL;
- return;
+ goto failed;
}
gpfs_getacl_fn = sys_dlsym(libgpfs_handle, "gpfs_getacl");
if (gpfs_getacl_fn == NULL) {
DEBUG(3, ("libgpfs_gpl.so does not contain the symbol "
"'gpfs_getacl'\n"));
- sys_dlclose(libgpfs_handle);
-
- /* leave libgpfs_handle != NULL around, no point
- in trying twice */
- gpfs_set_share_fn = NULL;
- gpfs_set_lease_fn = NULL;
- gpfs_getacl_fn = NULL;
- gpfs_putacl_fn = NULL;
- return;
+ goto failed;
}
gpfs_putacl_fn = sys_dlsym(libgpfs_handle, "gpfs_putacl");
if (gpfs_putacl_fn == NULL) {
DEBUG(3, ("libgpfs_gpl.so does not contain the symbol "
"'gpfs_putacl'\n"));
- sys_dlclose(libgpfs_handle);
+ goto failed;
+ }
- /* leave libgpfs_handle != NULL around, no point
- in trying twice */
- gpfs_set_share_fn = NULL;
- gpfs_set_lease_fn = NULL;
- gpfs_getacl_fn = NULL;
- gpfs_putacl_fn = NULL;
- return;
+ if (lp_parm_bool(-1, "gpfs", "sharemodes", True)) {
+ gpfs_share_modes = True;
+ } else {
+ gpfs_share_modes = False;
}
+ return;
+
+failed:
+ sys_dlclose(libgpfs_handle);
+ /* leave libgpfs_handle != NULL around, no point
+ in trying twice */
+ gpfs_set_share_fn = NULL;
+ gpfs_set_lease_fn = NULL;
+ gpfs_getacl_fn = NULL;
+ gpfs_putacl_fn = NULL;
}
#else