Loading adb/Android.mk +14 −1 Original line number Diff line number Diff line Loading @@ -110,6 +110,7 @@ LOCAL_SRC_FILES := \ jdwp_service.c \ framebuffer_service.c \ remount_service.c \ disable_verity_service.c \ usb_linux_client.c ifeq ($(call is-vendor-board-platform,QCOM),true) Loading @@ -124,13 +125,25 @@ ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT))) LOCAL_CFLAGS += -DALLOW_ADBD_ROOT=1 endif ifneq (,$(filter userdebug,$(TARGET_BUILD_VARIANT))) LOCAL_CFLAGS += -DALLOW_ADBD_DISABLE_VERITY=1 endif LOCAL_MODULE := adbd LOCAL_FORCE_STATIC_EXECUTABLE := true LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT_SBIN) LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_SBIN_UNSTRIPPED) LOCAL_C_INCLUDES += system/extras/ext4_utils system/core/fs_mgr/include LOCAL_STATIC_LIBRARIES := liblog \ libfs_mgr \ libcutils \ libc \ libmincrypt \ libselinux \ libext4_utils_static LOCAL_STATIC_LIBRARIES := liblog libcutils libc libmincrypt libselinux include $(BUILD_EXECUTABLE) Loading adb/adb.h +1 −0 Original line number Diff line number Diff line Loading @@ -329,6 +329,7 @@ int handle_forward_request(const char* service, transport_type ttype, char* seri #if !ADB_HOST void framebuffer_service(int fd, void *cookie); void remount_service(int fd, void *cookie); void disable_verity_service(int fd, void* cookie); #endif /* packet allocator */ Loading adb/adb_auth.h +1 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ #define __ADB_AUTH_H void adb_auth_init(void); int adb_auth_keygen(const char* filename); void adb_auth_verified(atransport *t); void send_auth_request(atransport *t); Loading adb/adb_auth_host.c +28 −4 Original line number Diff line number Diff line Loading @@ -15,9 +15,12 @@ */ #include <stdio.h> #include <stdlib.h> #ifdef _WIN32 # ifndef WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN # endif # include "windows.h" # include "shlobj.h" #else Loading Loading @@ -110,18 +113,34 @@ out: static void get_user_info(char *buf, size_t len) { char hostname[1024], username[1024]; int ret; int ret = -1; if (getenv("HOSTNAME") != NULL) { strncpy(hostname, getenv("HOSTNAME"), sizeof(hostname)); hostname[sizeof(hostname)-1] = '\0'; ret = 0; } #ifndef _WIN32 ret = gethostname(hostname, sizeof(hostname)); if (ret < 0) ret = gethostname(hostname, sizeof(hostname)); #endif if (ret < 0) strcpy(hostname, "unknown"); ret = -1; if (getenv("LOGNAME") != NULL) { strncpy(username, getenv("LOGNAME"), sizeof(username)); username[sizeof(username)-1] = '\0'; ret = 0; } #if !defined _WIN32 && !defined ADB_HOST_ON_TARGET ret = getlogin_r(username, sizeof(username)); if (ret < 0) ret = getlogin_r(username, sizeof(username)); #endif if (ret < 0) strcpy(username, "unknown"); ret = snprintf(buf, len, " %s@%s", username, hostname); Loading Loading @@ -408,6 +427,11 @@ int adb_auth_get_userkey(unsigned char *data, size_t len) return ret + 1; } int adb_auth_keygen(const char* filename) { adb_trace_mask |= (1 << TRACE_AUTH); return (generate_key(filename) == 0); } void adb_auth_init(void) { int ret; Loading adb/commandline.c +12 −3 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ #define TRACE_TAG TRACE_ADB #include "adb.h" #include "adb_client.h" #include "adb_auth.h" #include "file_sync_service.h" static int do_cmd(transport_type ttype, char* serial, char *cmd, ...); Loading Loading @@ -189,6 +190,10 @@ void help() "\n" " adb restore <file> - restore device contents from the <file> backup archive\n" "\n" " adb disable-verity - disable dm-verity checking on USERDEBUG builds\n" " adb keygen <file> - generate adb public/private key. The private key is stored in <file>,\n" " and the public key is stored in <file>.pub. Any existing files\n" " are overwritten.\n" " adb help - show this help message\n" " adb version - show version num\n" "\n" Loading @@ -205,8 +210,7 @@ void help() " adb reboot-bootloader - reboots the device into the bootloader\n" " adb root - restarts the adbd daemon with root permissions\n" " adb usb - restarts the adbd daemon listening on USB\n" " adb tcpip <port> - restarts the adbd daemon listening on TCP on the specified port" "\n" " adb tcpip <port> - restarts the adbd daemon listening on TCP on the specified port\n" "networking:\n" " adb ppp <tty> [parameters] - Run PPP over USB.\n" " Note: you should not automatically start a PPP connection.\n" Loading Loading @@ -1452,7 +1456,7 @@ top: if(!strcmp(argv[0], "remount") || !strcmp(argv[0], "reboot") || !strcmp(argv[0], "reboot-bootloader") || !strcmp(argv[0], "tcpip") || !strcmp(argv[0], "usb") || !strcmp(argv[0], "root")) { || !strcmp(argv[0], "root") || !strcmp(argv[0], "disable-verity")) { char command[100]; if (!strcmp(argv[0], "reboot-bootloader")) snprintf(command, sizeof(command), "reboot:bootloader"); Loading Loading @@ -1735,6 +1739,11 @@ top: return restore(argc, argv); } if (!strcmp(argv[0], "keygen")) { if (argc < 2) return usage(); return adb_auth_keygen(argv[1]); } if (!strcmp(argv[0], "jdwp")) { int fd = adb_connect("jdwp"); if (fd >= 0) { Loading Loading
adb/Android.mk +14 −1 Original line number Diff line number Diff line Loading @@ -110,6 +110,7 @@ LOCAL_SRC_FILES := \ jdwp_service.c \ framebuffer_service.c \ remount_service.c \ disable_verity_service.c \ usb_linux_client.c ifeq ($(call is-vendor-board-platform,QCOM),true) Loading @@ -124,13 +125,25 @@ ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT))) LOCAL_CFLAGS += -DALLOW_ADBD_ROOT=1 endif ifneq (,$(filter userdebug,$(TARGET_BUILD_VARIANT))) LOCAL_CFLAGS += -DALLOW_ADBD_DISABLE_VERITY=1 endif LOCAL_MODULE := adbd LOCAL_FORCE_STATIC_EXECUTABLE := true LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT_SBIN) LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_SBIN_UNSTRIPPED) LOCAL_C_INCLUDES += system/extras/ext4_utils system/core/fs_mgr/include LOCAL_STATIC_LIBRARIES := liblog \ libfs_mgr \ libcutils \ libc \ libmincrypt \ libselinux \ libext4_utils_static LOCAL_STATIC_LIBRARIES := liblog libcutils libc libmincrypt libselinux include $(BUILD_EXECUTABLE) Loading
adb/adb.h +1 −0 Original line number Diff line number Diff line Loading @@ -329,6 +329,7 @@ int handle_forward_request(const char* service, transport_type ttype, char* seri #if !ADB_HOST void framebuffer_service(int fd, void *cookie); void remount_service(int fd, void *cookie); void disable_verity_service(int fd, void* cookie); #endif /* packet allocator */ Loading
adb/adb_auth.h +1 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ #define __ADB_AUTH_H void adb_auth_init(void); int adb_auth_keygen(const char* filename); void adb_auth_verified(atransport *t); void send_auth_request(atransport *t); Loading
adb/adb_auth_host.c +28 −4 Original line number Diff line number Diff line Loading @@ -15,9 +15,12 @@ */ #include <stdio.h> #include <stdlib.h> #ifdef _WIN32 # ifndef WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN # endif # include "windows.h" # include "shlobj.h" #else Loading Loading @@ -110,18 +113,34 @@ out: static void get_user_info(char *buf, size_t len) { char hostname[1024], username[1024]; int ret; int ret = -1; if (getenv("HOSTNAME") != NULL) { strncpy(hostname, getenv("HOSTNAME"), sizeof(hostname)); hostname[sizeof(hostname)-1] = '\0'; ret = 0; } #ifndef _WIN32 ret = gethostname(hostname, sizeof(hostname)); if (ret < 0) ret = gethostname(hostname, sizeof(hostname)); #endif if (ret < 0) strcpy(hostname, "unknown"); ret = -1; if (getenv("LOGNAME") != NULL) { strncpy(username, getenv("LOGNAME"), sizeof(username)); username[sizeof(username)-1] = '\0'; ret = 0; } #if !defined _WIN32 && !defined ADB_HOST_ON_TARGET ret = getlogin_r(username, sizeof(username)); if (ret < 0) ret = getlogin_r(username, sizeof(username)); #endif if (ret < 0) strcpy(username, "unknown"); ret = snprintf(buf, len, " %s@%s", username, hostname); Loading Loading @@ -408,6 +427,11 @@ int adb_auth_get_userkey(unsigned char *data, size_t len) return ret + 1; } int adb_auth_keygen(const char* filename) { adb_trace_mask |= (1 << TRACE_AUTH); return (generate_key(filename) == 0); } void adb_auth_init(void) { int ret; Loading
adb/commandline.c +12 −3 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ #define TRACE_TAG TRACE_ADB #include "adb.h" #include "adb_client.h" #include "adb_auth.h" #include "file_sync_service.h" static int do_cmd(transport_type ttype, char* serial, char *cmd, ...); Loading Loading @@ -189,6 +190,10 @@ void help() "\n" " adb restore <file> - restore device contents from the <file> backup archive\n" "\n" " adb disable-verity - disable dm-verity checking on USERDEBUG builds\n" " adb keygen <file> - generate adb public/private key. The private key is stored in <file>,\n" " and the public key is stored in <file>.pub. Any existing files\n" " are overwritten.\n" " adb help - show this help message\n" " adb version - show version num\n" "\n" Loading @@ -205,8 +210,7 @@ void help() " adb reboot-bootloader - reboots the device into the bootloader\n" " adb root - restarts the adbd daemon with root permissions\n" " adb usb - restarts the adbd daemon listening on USB\n" " adb tcpip <port> - restarts the adbd daemon listening on TCP on the specified port" "\n" " adb tcpip <port> - restarts the adbd daemon listening on TCP on the specified port\n" "networking:\n" " adb ppp <tty> [parameters] - Run PPP over USB.\n" " Note: you should not automatically start a PPP connection.\n" Loading Loading @@ -1452,7 +1456,7 @@ top: if(!strcmp(argv[0], "remount") || !strcmp(argv[0], "reboot") || !strcmp(argv[0], "reboot-bootloader") || !strcmp(argv[0], "tcpip") || !strcmp(argv[0], "usb") || !strcmp(argv[0], "root")) { || !strcmp(argv[0], "root") || !strcmp(argv[0], "disable-verity")) { char command[100]; if (!strcmp(argv[0], "reboot-bootloader")) snprintf(command, sizeof(command), "reboot:bootloader"); Loading Loading @@ -1735,6 +1739,11 @@ top: return restore(argc, argv); } if (!strcmp(argv[0], "keygen")) { if (argc < 2) return usage(); return adb_auth_keygen(argv[1]); } if (!strcmp(argv[0], "jdwp")) { int fd = adb_connect("jdwp"); if (fd >= 0) { Loading