The Samba-Bugzilla – Attachment 3314 Details for
Bug 5285
missing capget/capset detection leading to compile errors with libcap-2.x
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
move to portable capability functions (3-0-test)
capget-3.0.diff (text/plain), 2.90 KB, created by
Guenther Deschner
on 2008-05-28 06:34:29 UTC
(
hide
)
Description:
move to portable capability functions (3-0-test)
Filename:
MIME Type:
Creator:
Guenther Deschner
Created:
2008-05-28 06:34:29 UTC
Size:
2.90 KB
patch
obsolete
> source/include/smb.h | 3 ++- > source/lib/system.c | 5 +++++ > source/smbd/oplock_linux.c | 44 +------------------------------------------- > 3 files changed, 8 insertions(+), 44 deletions(-) > >diff --git a/source/include/smb.h b/source/include/smb.h >index 46afcde..13e9162 100644 >--- a/source/include/smb.h >+++ b/source/include/smb.h >@@ -1710,7 +1710,8 @@ minimum length == 18. > > enum smbd_capability { > KERNEL_OPLOCK_CAPABILITY, >- DMAPI_ACCESS_CAPABILITY >+ DMAPI_ACCESS_CAPABILITY, >+ LEASE_CAPABILITY > }; > > /* if a kernel does support oplocks then a structure of the following >diff --git a/source/lib/system.c b/source/lib/system.c >index b23aa04..de5f552 100644 >--- a/source/lib/system.c >+++ b/source/lib/system.c >@@ -776,6 +776,11 @@ static BOOL set_process_capability(enum smbd_capability capability, > cap_vals[num_cap_vals++] = CAP_MKNOD; > #endif > break; >+ case LEASE_CAPABILITY: >+#ifdef CAP_LEASE >+ cap_vals[num_cap_vals++] = CAP_LEASE; >+#endif >+ break; > } > > SMB_ASSERT(num_cap_vals <= ARRAY_SIZE(cap_vals)); >diff --git a/source/smbd/oplock_linux.c b/source/smbd/oplock_linux.c >index 14db98c..c6c11a7 100644 >--- a/source/smbd/oplock_linux.c >+++ b/source/smbd/oplock_linux.c >@@ -23,22 +23,6 @@ > > #if HAVE_KERNEL_OPLOCKS_LINUX > >-/* these can be removed when they are in glibc headers */ >-struct cap_user_header { >- uint32 version; >- int pid; >-} header; >-struct cap_user_data { >- uint32 effective; >- uint32 permitted; >- uint32 inheritable; >-} data; >- >-extern int capget(struct cap_user_header * hdrp, >- struct cap_user_data * datap); >-extern int capset(struct cap_user_header * hdrp, >- const struct cap_user_data * datap); >- > static SIG_ATOMIC_T signals_received; > #define FD_PENDING_SIZE 100 > static SIG_ATOMIC_T fd_pending_array[FD_PENDING_SIZE]; >@@ -76,32 +60,6 @@ static void signal_handler(int sig, siginfo_t *info, void *unused) > sys_select_signal(RT_SIGNAL_LEASE); > } > >-/**************************************************************************** >- Try to gain a linux capability. >-****************************************************************************/ >- >-static void set_capability(unsigned capability) >-{ >-#ifndef _LINUX_CAPABILITY_VERSION >-#define _LINUX_CAPABILITY_VERSION 0x19980330 >-#endif >- header.version = _LINUX_CAPABILITY_VERSION; >- header.pid = 0; >- >- if (capget(&header, &data) == -1) { >- DEBUG(3,("Unable to get kernel capabilities (%s)\n", >- strerror(errno))); >- return; >- } >- >- data.effective |= (1<<capability); >- >- if (capset(&header, &data) == -1) { >- DEBUG(3,("Unable to set %d capability (%s)\n", >- capability, strerror(errno))); >- } >-} >- > /* > Call to set the kernel lease signal handler > */ >@@ -127,7 +85,7 @@ int linux_setlease(int fd, int leasetype) > > ret = fcntl(fd, F_SETLEASE, leasetype); > if (ret == -1 && errno == EACCES) { >- set_capability(CAP_LEASE); >+ set_effective_capability(LEASE_CAPABILITY); > ret = fcntl(fd, F_SETLEASE, leasetype); > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 5285
:
3153
|
3268
| 3314 |
3315