Skip to content

Commit 4b9fcd9

Browse files
committed
Move adb_keys to product partition
/adb_keys will be moved to /product/etc/security as it's a product-specific file. To prevent regression, /adb_keys will be a symlink to the new location. Bug: 353430323 Test: boot and connect adb with ADB_VENDOR_KEYS Change-Id: Iaec1acfa5e8e758058fabf2ec0edd85bd64e7700
1 parent 5a74561 commit 4b9fcd9

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

libs/adbd_auth/adbd_auth.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,13 +390,16 @@ struct AdbdAuthContext {
390390
}
391391
}
392392

393-
static constexpr const char* key_paths[] = {"/adb_keys", "/data/misc/adb/adb_keys"};
393+
static constexpr std::pair<const char*, bool> key_paths[] = {
394+
{"/adb_keys", true /* follow symlinks */ },
395+
{"/data/misc/adb/adb_keys", false /* don't follow symlinks */ },
396+
};
394397
void IteratePublicKeys(bool (*callback)(void*, const char*, size_t), void* opaque) {
395-
for (const auto& path : key_paths) {
398+
for (const auto& [path, follow_symlinks] : key_paths) {
396399
if (access(path, R_OK) == 0) {
397400
LOG(INFO) << "adbd_auth: loading keys from " << path;
398401
std::string content;
399-
if (!android::base::ReadFileToString(path, &content)) {
402+
if (!android::base::ReadFileToString(path, &content, follow_symlinks)) {
400403
PLOG(ERROR) << "adbd_auth: couldn't read " << path;
401404
continue;
402405
}

0 commit comments

Comments
 (0)