summaryrefslogtreecommitdiff
path: root/client/main.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2016-06-29 17:42:01 -0700
committerElliott Hughes <enh@google.com>2016-08-11 13:53:18 -0700
commit0caae18a8749c2dc5b8fedd130ed20236b2eccf0 (patch)
tree8e34de3e43363904ffe0f4b7a9dd8ff761a3c803 /client/main.cpp
parentde35e2b10eb73adf6dfc87914a3b2a9f5caf4e5c (diff)
downloadadb-0caae18a8749c2dc5b8fedd130ed20236b2eccf0.tar.gz
Clean up key handling in adb.
This includes the locking we need to be able to re-load the keys at runtime. We should rename "adb_auth_client.cpp" to "adb_auth_adbd.cpp" or "adbd_auth.cpp" in a later change. Change-Id: I9e1d5b6b7d0497d6f6e5d9c4fb660118cdff05a8 Test: "adb devices" works against a non-AOSP device with $ADB_VENDOR_KEYS set, says "unauthorized" without. Bug: http://b/29273531
Diffstat (limited to 'client/main.cpp')
-rw-r--r--client/main.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/client/main.cpp b/client/main.cpp
index d2ca44e..e160169 100644
--- a/client/main.cpp
+++ b/client/main.cpp
@@ -110,7 +110,6 @@ int adb_server_main(int is_daemon, int server_port, int ack_reply_fd) {
usb_init();
local_init(DEFAULT_ADB_LOCAL_TRANSPORT_PORT);
- adb_auth_init();
std::string error;
std::string local_name = android::base::StringPrintf("tcp:%d", server_port);
@@ -118,11 +117,14 @@ int adb_server_main(int is_daemon, int server_port, int ack_reply_fd) {
fatal("could not install *smartsocket* listener: %s", error.c_str());
}
- // Inform our parent that we are up and running.
if (is_daemon) {
close_stdin();
setup_daemon_logging();
+ }
+
+ adb_auth_init();
+ if (is_daemon) {
#if !defined(_WIN32)
// Start a new session for the daemon. Do this here instead of after the fork so
// that a ctrl-c between the "starting server" and "done starting server" messages
@@ -132,6 +134,8 @@ int adb_server_main(int is_daemon, int server_port, int ack_reply_fd) {
}
#endif
+ // Inform our parent that we are up and running.
+
// Any error output written to stderr now goes to adb.log. We could
// keep around a copy of the stderr fd and use that to write any errors
// encountered by the following code, but that is probably overkill.