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

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


Change-Id: I77197e0bf9daa9774db015b0ffb8be519830ee72
Signed-off-by: default avatarMike Lockwood <lockwood@google.com>
parent e0533a30
No related branches found
No related tags found
No related merge requests found
......@@ -128,7 +128,7 @@ LOCAL_MODULE := sshd
LOCAL_C_INCLUDES := external/openssl/include external/zlib
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)
......
......@@ -443,9 +443,15 @@ secure_filename(FILE *f, const char *file, struct passwd *pw,
if (fstat(fileno(f), &st) < 0 ||
(st.st_uid != 0 && st.st_uid != uid) ||
(st.st_mode & 022) != 0) {
snprintf(err, errlen, "bad ownership or modes for file %s",
buf);
return -1;
#ifdef ANDROID
/* needed to allow root login on android */
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 */
......
......@@ -46,6 +46,10 @@
#include "channels.h"
#include "groupaccess.h"
#ifdef ANDROID
#include <cutils/properties.h>
#endif
static void add_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,
const char *host, const char *address)
{
ServerOptions mo;
#ifdef ANDROID
char value[PROPERTY_VALUE_MAX];
#endif
initialize_server_options(&mo);
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);
}
......
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