pluto: Switch to user 'vpn' on Android.

This commit is contained in:
Tobias Brunner
2011-10-18 11:36:52 +02:00
parent b9307badfe
commit bdbbab35b1
2 changed files with 17 additions and 6 deletions
+1 -1
View File
@@ -41,7 +41,7 @@
#include <threading/thread.h> #include <threading/thread.h>
#ifdef ANDROID #ifdef ANDROID
#include <private/android_filesystem_config.h> #include <private/android_filesystem_config.h> /* for AID_VPN */
#endif #endif
#ifndef LOG_AUTHPRIV /* not defined on OpenSolaris */ #ifndef LOG_AUTHPRIV /* not defined on OpenSolaris */
+11
View File
@@ -81,6 +81,10 @@
#include "whack_attribute.h" #include "whack_attribute.h"
#include "pluto.h" #include "pluto.h"
#ifdef ANDROID
#include <private/android_filesystem_config.h> /* for AID_VPN */
#endif
/** /**
* Number of threads in the thread pool, if not specified in config. * Number of threads in the thread pool, if not specified in config.
*/ */
@@ -739,6 +743,13 @@ int main(int argc, char **argv)
} }
} }
#endif #endif
#ifdef ANDROID
if (setuid(AID_VPN) != 0)
{
plog("unable to change daemon user");
abort();
}
#endif
#ifdef CAPABILITIES_LIBCAP #ifdef CAPABILITIES_LIBCAP
{ {