diff options
author | James Peach <jpeach@samba.org> | 2006-03-22 23:49:09 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:15:42 -0500 |
commit | 40d0707827ee154bcb03013abe6f72f1026a70c9 (patch) | |
tree | b465d32e79fc65a682aa55dd96e4a665109bfc15 /source3/lib/system.c | |
parent | e836508704dd964e22e8bfc0f8e9ec520a2c94f2 (diff) | |
download | samba-40d0707827ee154bcb03013abe6f72f1026a70c9.tar.gz samba-40d0707827ee154bcb03013abe6f72f1026a70c9.tar.xz samba-40d0707827ee154bcb03013abe6f72f1026a70c9.zip |
r14668: Set the FILE_STATUS_OFFLINE bit by observing the events a DMAPI-based
HSM is interested in. Tested on both IRIX and SLES9.
(This used to be commit 514a767c57f8194547e5b708ad2573ab9a0719c6)
Diffstat (limited to 'source3/lib/system.c')
-rw-r--r-- | source3/lib/system.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/source3/lib/system.c b/source3/lib/system.c index ffb70317150..2e5f42307bd 100644 --- a/source3/lib/system.c +++ b/source3/lib/system.c @@ -22,6 +22,10 @@ #include "includes.h" +#ifdef HAVE_SYS_PRCTL_H +#include <sys/prctl.h> +#endif + /* The idea is that this file will eventually have wrappers around all important system calls in samba. The aims are: @@ -661,6 +665,19 @@ static BOOL set_process_capability(enum smbd_capability capability, cap_t cap; +#if defined(HAVE_PRCTL) && defined(PR_GET_KEEPCAPS) && defined(PR_SET_KEEPCAPS) + /* On Linux, make sure that any capabilities we grab are sticky + * across UID changes. We expect that this would allow us to keep both + * the effective and permitted capability sets, but as of circa 2.6.16, + * only the permitted set is kept. It is a bug (which we work around) + * that the effective set is lost, but we still require the effective + * set to be kept. + */ + if (!prctl(PR_GET_KEEPCAPS)) { + prctl(PR_SET_KEEPCAPS, 1); + } +#endif + cap = cap_get_proc(); if (cap == NULL) { DEBUG(0,("set_process_capability: cap_get_proc failed: %s\n", @@ -675,6 +692,15 @@ static BOOL set_process_capability(enum smbd_capability capability, cap_vals[num_cap_vals++] = CAP_NETWORK_MGT; #endif break; + case DMAPI_ACCESS_CAPABILITY: +#ifdef CAP_DEVICE_MGT + /* IRIX has CAP_DEVICE_MGT for DMAPI access. */ + cap_vals[num_cap_vals++] = CAP_DEVICE_MGT; +#elif CAP_MKNOD + /* Linux has CAP_MKNOD for DMAPI access. */ + cap_vals[num_cap_vals++] = CAP_MKNOD; +#endif + break; } SMB_ASSERT(num_cap_vals <= ARRAY_SIZE(cap_vals)); @@ -686,6 +712,10 @@ static BOOL set_process_capability(enum smbd_capability capability, cap_set_flag(cap, CAP_EFFECTIVE, num_cap_vals, cap_vals, enable ? CAP_SET : CAP_CLEAR); + + /* We never want to pass capabilities down to our children, so make + * sure they are not inherited. + */ cap_set_flag(cap, CAP_INHERITABLE, num_cap_vals, cap_vals, CAP_CLEAR); if (cap_set_proc(cap) == -1) { |