From 284204e6bb52d859c9457adbeff22db7ef457dfe Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 5 Nov 2020 12:50:00 +0100 Subject: [PATCH] Detect duplicate keys form user configuration Apparently there are some duplicates in the phabricator configuration, even though the interface has a check against this. --- scripts/gitolite/rebuild_gitolite.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/gitolite/rebuild_gitolite.php b/scripts/gitolite/rebuild_gitolite.php index 9045b64d64..bc2dd4fce5 100755 --- a/scripts/gitolite/rebuild_gitolite.php +++ b/scripts/gitolite/rebuild_gitolite.php @@ -51,7 +51,7 @@ class Configuration { protected $config_file; // Indexed by key content, contains configuration user name. - protected $system_keys; + protected $stored_keys; // Indexed by config user name. protected $used_keys; @@ -80,8 +80,8 @@ class Configuration { public function storeUserPublicKey($user, $key) { $full_key_content = $this->getPublicKeyContent($key); - if (array_key_exists($full_key_content, $this->system_keys)) { - return $this->system_keys[$full_key_content]; + if (array_key_exists($full_key_content, $this->stored_keys)) { + return $this->stored_keys[$full_key_content]; } $config_user_name = $this->getConfigUserName($user, $key); @@ -92,6 +92,8 @@ class Configuration { $full_key_content); } + $this->stored_keys[$full_key_content] = $config_user_name; + return $config_user_name; } @@ -180,7 +182,7 @@ class Configuration { } $key = file_get_contents("$this->keys_directory/$file"); $file_we = basename($file, '.pub'); - $this->system_keys[$key] = $file_we; + $this->stored_keys[$key] = $file_we; $this->used_keys[$file_we] = true; } }