summaryrefslogtreecommitdiffstats
path: root/adb
diff options
context:
space:
mode:
authorNick Kralevich <nnk@google.com>2014-06-18 20:07:54 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-06-18 20:07:54 +0000
commit4224edf51dcddf9e014b198bb23fc40ef61a5834 (patch)
treefaded3a39e75abce905b612778752a8718d0f9a1 /adb
parent2757d76cd6f0b0c0560751f5e8b9c2656692ffa9 (diff)
parent89e4fad09e1ae765ab0be1580a468bc0837ef7e4 (diff)
downloadsystem_core-4224edf51dcddf9e014b198bb23fc40ef61a5834.zip
system_core-4224edf51dcddf9e014b198bb23fc40ef61a5834.tar.gz
system_core-4224edf51dcddf9e014b198bb23fc40ef61a5834.tar.bz2
am 89e4fad0: am 4e6aa6a2: Merge "adbd: unconditionally call setgroups"
* commit '89e4fad09e1ae765ab0be1580a468bc0837ef7e4': adbd: unconditionally call setgroups
Diffstat (limited to 'adb')
-rw-r--r--adb/adb.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/adb/adb.c b/adb/adb.c
index 6d3a71b..90bdbaa 100644
--- a/adb/adb.c
+++ b/adb/adb.c
@@ -1344,29 +1344,29 @@ int adb_main(int is_daemon, int server_port)
" unchanged.\n");
}
+ /* add extra groups:
+ ** AID_ADB to access the USB driver
+ ** AID_LOG to read system logs (adb logcat)
+ ** AID_INPUT to diagnose input issues (getevent)
+ ** AID_INET to diagnose network issues (netcfg, ping)
+ ** AID_GRAPHICS to access the frame buffer
+ ** AID_NET_BT and AID_NET_BT_ADMIN to diagnose bluetooth (hcidump)
+ ** AID_SDCARD_R to allow reading from the SD card
+ ** AID_SDCARD_RW to allow writing to the SD card
+ ** AID_NET_BW_STATS to read out qtaguid statistics
+ */
+ gid_t groups[] = { AID_ADB, AID_LOG, AID_INPUT, AID_INET, AID_GRAPHICS,
+ AID_NET_BT, AID_NET_BT_ADMIN, AID_SDCARD_R, AID_SDCARD_RW,
+ AID_NET_BW_STATS };
+ if (setgroups(sizeof(groups)/sizeof(groups[0]), groups) != 0) {
+ exit(1);
+ }
+
/* don't listen on a port (default 5037) if running in secure mode */
/* don't run as root if we are running in secure mode */
if (should_drop_privileges()) {
drop_capabilities_bounding_set_if_needed();
- /* add extra groups:
- ** AID_ADB to access the USB driver
- ** AID_LOG to read system logs (adb logcat)
- ** AID_INPUT to diagnose input issues (getevent)
- ** AID_INET to diagnose network issues (netcfg, ping)
- ** AID_GRAPHICS to access the frame buffer
- ** AID_NET_BT and AID_NET_BT_ADMIN to diagnose bluetooth (hcidump)
- ** AID_SDCARD_R to allow reading from the SD card
- ** AID_SDCARD_RW to allow writing to the SD card
- ** AID_NET_BW_STATS to read out qtaguid statistics
- */
- gid_t groups[] = { AID_ADB, AID_LOG, AID_INPUT, AID_INET, AID_GRAPHICS,
- AID_NET_BT, AID_NET_BT_ADMIN, AID_SDCARD_R, AID_SDCARD_RW,
- AID_NET_BW_STATS };
- if (setgroups(sizeof(groups)/sizeof(groups[0]), groups) != 0) {
- exit(1);
- }
-
/* then switch user and group to "shell" */
if (setgid(AID_SHELL) != 0) {
exit(1);