Skip to content
Snippets Groups Projects
Commit 25b172db authored by Robert Love's avatar Robert Love Committed by Brian Swetland
Browse files

paranoid_network: Check euid and egid, not uid and gid.


Signed-off-by: default avatarRobert Love <rlove@google.com>
parent bb39136d
No related merge requests found
......@@ -141,13 +141,13 @@ static void bt_reclassify_sock_lock(struct socket *sock, int proto)
#ifdef CONFIG_ANDROID_PARANOID_NETWORK
static inline int current_has_bt_admin(void)
{
return (!current->uid || current->gid == AID_NET_BT_ADMIN ||
return (!current->euid || current->egid == AID_NET_BT_ADMIN ||
groups_search(current->group_info, AID_NET_BT_ADMIN));
}
static inline int current_has_bt(void)
{
return (current_has_bt_admin() || current->gid == AID_NET_BT ||
return (current_has_bt_admin() || current->egid == AID_NET_BT ||
groups_search(current->group_info, AID_NET_BT));
}
# else
......@@ -166,15 +166,12 @@ static int bt_sock_create(struct net *net, struct socket *sock, int proto)
{
int err;
#ifdef CONFIG_ANDROID_PARANOID_NETWORK
if (proto == BTPROTO_RFCOMM || proto == BTPROTO_SCO ||
proto == BTPROTO_L2CAP) {
if (!current_has_bt())
return -EPERM;
} else if (!current_has_bt_admin()) {
} else if (!current_has_bt_admin())
return -EPERM;
}
#endif
if (net != &init_net)
return -EAFNOSUPPORT;
......
......@@ -250,7 +250,7 @@ EXPORT_SYMBOL(build_ehash_secret);
#ifdef CONFIG_ANDROID_PARANOID_NETWORK
static inline int current_has_network(void)
{
return (!current->uid || current->gid == AID_INET ||
return (!current->euid || current->egid == AID_INET ||
groups_search(current->group_info, AID_INET));
}
# else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment