diff options
author | Chia-chi Yeh <chiachi@android.com> | 2009-06-19 07:15:05 +0800 |
---|---|---|
committer | Chia-chi Yeh <chiachi@android.com> | 2009-06-30 11:45:17 +0800 |
commit | 964fc4881b3f3c90ec3a59350464d39158b88d52 (patch) | |
tree | 091c9bf77510e34e035fbd6bb9a7b86c0a6c1aec /security | |
parent | 3de11fd60d9941c720762553a9789dde578b67c9 (diff) |
security: Add AID_NET_RAW and AID_NET_ADMIN capability check in cap_capable().
Signed-off-by: Chia-chi Yeh <chiachi@android.com>
Diffstat (limited to 'security')
-rw-r--r-- | security/commoncap.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/security/commoncap.c b/security/commoncap.c index 7cd61a5f5205..56893283cad5 100644 --- a/security/commoncap.c +++ b/security/commoncap.c @@ -28,6 +28,10 @@ #include <linux/prctl.h> #include <linux/securebits.h> +#ifdef CONFIG_ANDROID_PARANOID_NETWORK +#include <linux/android_aid.h> +#endif + int cap_netlink_send(struct sock *sk, struct sk_buff *skb) { NETLINK_CB(skb).eff_cap = current_cap(); @@ -60,6 +64,12 @@ EXPORT_SYMBOL(cap_netlink_recv); int cap_capable(struct task_struct *tsk, const struct cred *cred, int cap, int audit) { +#ifdef CONFIG_ANDROID_PARANOID_NETWORK + if (cap == CAP_NET_RAW && in_egroup_p(AID_NET_RAW)) + return 0; + if (cap == CAP_NET_ADMIN && in_egroup_p(AID_NET_ADMIN)) + return 0; +#endif return cap_raised(cred->cap_effective, cap) ? 0 : -EPERM; } |