Ignore:
Timestamp:
Jul 11, 2008, 1:13:42 AM (17 years ago)
Author:
Paul Smedley
Message:

Update branch to 3.0.31 release

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.0/source/smbd/oplock_linux.c

    r1 r140  
    2424#if HAVE_KERNEL_OPLOCKS_LINUX
    2525
    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 
    4226static SIG_ATOMIC_T signals_received;
    4327#define FD_PENDING_SIZE 100
     
    7761}
    7862
    79 /****************************************************************************
    80  Try to gain a linux capability.
    81 ****************************************************************************/
    82 
    83 static void set_capability(unsigned capability)
    84 {
    85 #ifndef _LINUX_CAPABILITY_VERSION
    86 #define _LINUX_CAPABILITY_VERSION 0x19980330
    87 #endif
    88         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 
    10563/*
    10664 Call to set the kernel lease signal handler
     
    12886        ret = fcntl(fd, F_SETLEASE, leasetype);
    12987        if (ret == -1 && errno == EACCES) {
    130                 set_capability(CAP_LEASE);
     88                set_effective_capability(LEASE_CAPABILITY);
    13189                ret = fcntl(fd, F_SETLEASE, leasetype);
    13290        }
Note: See TracChangeset for help on using the changeset viewer.