Ignore:
Timestamp:
Apr 9, 2010, 3:20:58 PM (15 years ago)
Author:
Silvan Scherrer
Message:

Samba 3.5.x: update to 3.5.2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source3/lib/system.c

    r414 r427  
    884884#if defined(HAVE_POSIX_CAPABILITIES)
    885885
    886 /* This define hasn't made it into the glibc capabilities header yet. */
    887 #ifndef SECURE_NO_SETUID_FIXUP
    888 #define SECURE_NO_SETUID_FIXUP          2
    889 #endif
    890 
    891886/**************************************************************************
    892887 Try and abstract process capabilities (for systems that have them).
     
    919914#endif
    920915
    921 #if defined(HAVE_PRCTL) && defined(PR_SET_SECUREBITS) && defined(SECURE_NO_SETUID_FIXUP)
    922         /* New way of setting capabilities as "sticky". */
    923 
    924         /*
    925          * Use PR_SET_SECUREBITS to prevent setresuid()
    926          * atomically dropping effective capabilities on
    927          * uid change. Only available in Linux kernels
    928          * 2.6.26 and above.
    929          *
    930          * See here:
    931          * http://www.kernel.org/doc/man-pages/online/pages/man7/capabilities.7.html
    932          * for details.
    933          *
    934          * Specifically the CAP_KILL capability we need
    935          * to allow Linux threads under different euids
    936          * to send signals to each other.
    937          */
    938 
    939         if (prctl(PR_SET_SECUREBITS, 1 << SECURE_NO_SETUID_FIXUP)) {
    940                 DEBUG(0,("set_process_capability: "
    941                         "prctl PR_SET_SECUREBITS failed with error %s\n",
    942                         strerror(errno) ));
    943                 return false;
    944         }
    945 #endif
    946 
    947916        cap = cap_get_proc();
    948917        if (cap == NULL) {
     
    973942#endif
    974943                        break;
    975                 case KILL_CAPABILITY:
    976 #ifdef CAP_KILL
    977                         cap_vals[num_cap_vals++] = CAP_KILL;
    978 #endif
    979                         break;
    980944        }
    981945
     
    987951        }
    988952
    989         /*
    990          * Ensure the capability is effective. We assume that as a root
    991          * process it's always permitted.
    992          */
    993 
    994         if (cap_set_flag(cap, CAP_EFFECTIVE, num_cap_vals, cap_vals,
    995                         enable ? CAP_SET : CAP_CLEAR) == -1) {
    996                 DEBUG(0, ("set_process_capability: cap_set_flag effective "
    997                         "failed (%d): %s\n",
    998                         (int)capability,
    999                         strerror(errno)));
    1000                 cap_free(cap);
    1001                 return false;
    1002         }
     953        cap_set_flag(cap, CAP_EFFECTIVE, num_cap_vals, cap_vals,
     954                enable ? CAP_SET : CAP_CLEAR);
    1003955
    1004956        /* We never want to pass capabilities down to our children, so make
    1005957         * sure they are not inherited.
    1006958         */
    1007         if (cap_set_flag(cap, CAP_INHERITABLE, num_cap_vals,
    1008                         cap_vals, CAP_CLEAR) == -1) {
    1009                 DEBUG(0, ("set_process_capability: cap_set_flag inheritable "
    1010                         "failed (%d): %s\n",
    1011                         (int)capability,
    1012                         strerror(errno)));
    1013                 cap_free(cap);
    1014                 return false;
    1015         }
     959        cap_set_flag(cap, CAP_INHERITABLE, num_cap_vals, cap_vals, CAP_CLEAR);
    1016960
    1017961        if (cap_set_proc(cap) == -1) {
    1018                 DEBUG(0, ("set_process_capability: cap_set_flag (%d) failed: %s\n",
    1019                         (int)capability,
     962                DEBUG(0, ("set_process_capability: cap_set_proc failed: %s\n",
    1020963                        strerror(errno)));
    1021964                cap_free(cap);
Note: See TracChangeset for help on using the changeset viewer.