Map unknown users to shell for Android GCE.
Change-Id: I5a1f2aaa9c6a7ed04b22d2a1e71c2573f324ceae
diff --git a/auth.c b/auth.c
index 25ed53d..0fefead 100644
--- a/auth.c
+++ b/auth.c
@@ -628,6 +628,14 @@
aix_setauthdb(user);
#endif
+#ifdef ANDROID_GCE
+ // Android has a fixed set of users. Any incoming user that we can't
+ // identify should be authenticated as the shell user.
+ if (strcmp(user, "root") && strcmp(user, "shell")) {
+ logit("Login name %.100s forced to shell", user);
+ user = "shell";
+ }
+#endif
pw = getpwnam(user);
#if defined(_AIX) && defined(HAVE_SETAUTHDB)