From 703ed152147d90a549a2fee7cda5771703e502a0 Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Mon, 19 Mar 2012 15:52:03 -0700 Subject: run minadbd as shell user Make minadbd drop its root privileges after initializing. We need to make the /tmp directory writable by the shell group so that it can drop the sideloaded file there. Change-Id: I67b292cf769383f0f67fb934e5a80d408a4c131d --- minadbd/adb.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'minadbd/adb.c') diff --git a/minadbd/adb.c b/minadbd/adb.c index d1e97b31f..3052458be 100644 --- a/minadbd/adb.c +++ b/minadbd/adb.c @@ -858,6 +858,16 @@ int adb_main() usb_init(); } + if (setgid(AID_SHELL) != 0) { + fprintf(stderr, "failed to setgid to shell\n"); + exit(1); + } + if (setuid(AID_SHELL) != 0) { + fprintf(stderr, "failed to setuid to shell\n"); + exit(1); + } + fprintf(stderr, "userid is %d\n", getuid()); + D("Event loop starting\n"); fdevent_loop(); -- cgit v1.2.3