Changeset 140 for branches/samba-3.0/source/smbd/oplock_linux.c
- Timestamp:
- Jul 11, 2008, 1:13:42 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.0/source/smbd/oplock_linux.c
r1 r140 24 24 #if HAVE_KERNEL_OPLOCKS_LINUX 25 25 26 /* these can be removed when they are in glibc headers */27 struct cap_user_header {28 uint32 version;29 int pid;30 } header;31 struct cap_user_data {32 uint32 effective;33 uint32 permitted;34 uint32 inheritable;35 } data;36 37 extern int capget(struct cap_user_header * hdrp,38 struct cap_user_data * datap);39 extern int capset(struct cap_user_header * hdrp,40 const struct cap_user_data * datap);41 42 26 static SIG_ATOMIC_T signals_received; 43 27 #define FD_PENDING_SIZE 100 … … 77 61 } 78 62 79 /****************************************************************************80 Try to gain a linux capability.81 ****************************************************************************/82 83 static void set_capability(unsigned capability)84 {85 #ifndef _LINUX_CAPABILITY_VERSION86 #define _LINUX_CAPABILITY_VERSION 0x1998033087 #endif88 header.version = _LINUX_CAPABILITY_VERSION;89 header.pid = 0;90 91 if (capget(&header, &data) == -1) {92 DEBUG(3,("Unable to get kernel capabilities (%s)\n",93 strerror(errno)));94 return;95 }96 97 data.effective |= (1<<capability);98 99 if (capset(&header, &data) == -1) {100 DEBUG(3,("Unable to set %d capability (%s)\n",101 capability, strerror(errno)));102 }103 }104 105 63 /* 106 64 Call to set the kernel lease signal handler … … 128 86 ret = fcntl(fd, F_SETLEASE, leasetype); 129 87 if (ret == -1 && errno == EACCES) { 130 set_ capability(CAP_LEASE);88 set_effective_capability(LEASE_CAPABILITY); 131 89 ret = fcntl(fd, F_SETLEASE, leasetype); 132 90 }
Note:
See TracChangeset
for help on using the changeset viewer.