Skip to content
Snippets Groups Projects
Commit 8e48564f authored by Mike Lockwood's avatar Mike Lockwood
Browse files

Allow root login if ro.debuggable is set (userdebug and eng builds)


Change-Id: I4aed01758ca5589a6bf1642e9f2f2894221c82b9
Signed-off-by: default avatarMike Lockwood <lockwood@google.com>
parent 2f1b9342
No related branches found
No related tags found
No related merge requests found
...@@ -128,7 +128,7 @@ LOCAL_MODULE := sshd ...@@ -128,7 +128,7 @@ LOCAL_MODULE := sshd
LOCAL_C_INCLUDES := external/openssl/include external/zlib LOCAL_C_INCLUDES := external/openssl/include external/zlib
PRIVATE_C_INCLUDES := external/openssl/openbsd-compat PRIVATE_C_INCLUDES := external/openssl/openbsd-compat
LOCAL_SHARED_LIBRARIES += libssh libssl libcrypto libdl libz LOCAL_SHARED_LIBRARIES += libssh libssl libcrypto libdl libz libcutils
include $(BUILD_EXECUTABLE) include $(BUILD_EXECUTABLE)
......
...@@ -443,9 +443,15 @@ secure_filename(FILE *f, const char *file, struct passwd *pw, ...@@ -443,9 +443,15 @@ secure_filename(FILE *f, const char *file, struct passwd *pw,
if (fstat(fileno(f), &st) < 0 || if (fstat(fileno(f), &st) < 0 ||
(st.st_uid != 0 && st.st_uid != uid) || (st.st_uid != 0 && st.st_uid != uid) ||
(st.st_mode & 022) != 0) { (st.st_mode & 022) != 0) {
snprintf(err, errlen, "bad ownership or modes for file %s", #ifdef ANDROID
buf); /* needed to allow root login on android */
return -1; if (getuid() != 0)
#endif
{
snprintf(err, errlen, "bad ownership or modes for file %s",
buf);
return -1;
}
} }
/* for each component of the canonical path, walking upwards */ /* for each component of the canonical path, walking upwards */
......
...@@ -46,6 +46,10 @@ ...@@ -46,6 +46,10 @@
#include "channels.h" #include "channels.h"
#include "groupaccess.h" #include "groupaccess.h"
#ifdef ANDROID
#include <cutils/properties.h>
#endif
static void add_listen_addr(ServerOptions *, char *, int); static void add_listen_addr(ServerOptions *, char *, int);
static void add_one_listen_addr(ServerOptions *, char *, int); static void add_one_listen_addr(ServerOptions *, char *, int);
...@@ -1455,9 +1459,18 @@ parse_server_match_config(ServerOptions *options, const char *user, ...@@ -1455,9 +1459,18 @@ parse_server_match_config(ServerOptions *options, const char *user,
const char *host, const char *address) const char *host, const char *address)
{ {
ServerOptions mo; ServerOptions mo;
#ifdef ANDROID
char value[PROPERTY_VALUE_MAX];
#endif
initialize_server_options(&mo); initialize_server_options(&mo);
parse_server_config(&mo, "reprocess config", &cfg, user, host, address); parse_server_config(&mo, "reprocess config", &cfg, user, host, address);
#ifdef ANDROID
/* Allow root login if ro.debuggable is set */
property_get("ro.debuggable", value, "");
if (strcmp(value, "1") == 0)
mo.permit_root_login = PERMIT_YES;
#endif
copy_set_server_options(options, &mo, 0); copy_set_server_options(options, &mo, 0);
} }
......
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