X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=security%2Fcommoncap.c;h=5a5ef5ca7ea97eb9a2ef3901e3faff71fcaefcc6;hb=c3c70c443c2ef1fce31f201a93780c884b903993;hp=04c12f58d656200b29c1e0c60c31e7ac62349741;hpb=6c89cce75c6f93088a5a2a25bb9674a9194592cc;p=powerpc.git diff --git a/security/commoncap.c b/security/commoncap.c index 04c12f58d6..5a5ef5ca7e 100644 --- a/security/commoncap.c +++ b/security/commoncap.c @@ -7,7 +7,7 @@ * */ -#include +#include #include #include #include @@ -32,9 +32,9 @@ int cap_netlink_send(struct sock *sk, struct sk_buff *skb) EXPORT_SYMBOL(cap_netlink_send); -int cap_netlink_recv(struct sk_buff *skb) +int cap_netlink_recv(struct sk_buff *skb, int cap) { - if (!cap_raised(NETLINK_CB(skb).eff_cap, CAP_NET_ADMIN)) + if (!cap_raised(NETLINK_CB(skb).eff_cap, cap)) return -EPERM; return 0; } @@ -59,8 +59,8 @@ int cap_settime(struct timespec *ts, struct timezone *tz) int cap_ptrace (struct task_struct *parent, struct task_struct *child) { /* Derived from arch/i386/kernel/ptrace.c:sys_ptrace. */ - if (!cap_issubset (child->cap_permitted, current->cap_permitted) && - !capable(CAP_SYS_PTRACE)) + if (!cap_issubset(child->cap_permitted, parent->cap_permitted) && + !__capable(parent, CAP_SYS_PTRACE)) return -EPERM; return 0; } @@ -169,7 +169,7 @@ void cap_bprm_apply_creds (struct linux_binprm *bprm, int unsafe) /* For init, we want to retain the capabilities set * in the init_task struct. Thus we skip the usual * capability rules */ - if (current->pid != 1) { + if (!is_init(current)) { current->cap_permitted = new_permitted; current->cap_effective = cap_intersect (new_permitted, bprm->cap_effective);