adb: don't require adb keys to be named "*.adb_key".
Don't require the extension on explicit file paths passed on; only
check for it in monitored directories.
Bug: http://b/33638233
Test: ADB_TRACE=1 ADB_VENDOR_KEYS=$HOME/foo adb server nodaemon
Change-Id: I7387e0bbe0f2e16878bf22b05d5c6e8d0f9e5a92
diff --git a/adb/adb_auth_host.cpp b/adb/adb_auth_host.cpp
index ff2d76d..ec9b1c3 100644
--- a/adb/adb_auth_host.cpp
+++ b/adb/adb_auth_host.cpp
@@ -207,11 +207,6 @@
}
if (S_ISREG(st.st_mode)) {
- if (!android::base::EndsWith(path, ".adb_key")) {
- LOG(INFO) << "skipping non-adb_key '" << path << "'";
- return false;
- }
-
return read_key_file(path);
} else if (S_ISDIR(st.st_mode)) {
if (!allow_dir) {
@@ -236,7 +231,12 @@
continue;
}
- result |= read_keys((path + OS_PATH_SEPARATOR + name).c_str(), false);
+ if (!android::base::EndsWith(name, ".adb_key")) {
+ LOG(INFO) << "skipping non-adb_key '" << path << "/" << name << "'";
+ continue;
+ }
+
+ result |= read_key_file((path + OS_PATH_SEPARATOR + name));
}
return result;
}