Detect duplicate keys form user configuration
Apparently there are some duplicates in the phabricator configuration, even though the interface has a check against this.
This commit is contained in:
@@ -51,7 +51,7 @@ class Configuration {
|
|||||||
protected $config_file;
|
protected $config_file;
|
||||||
|
|
||||||
// Indexed by key content, contains configuration user name.
|
// Indexed by key content, contains configuration user name.
|
||||||
protected $system_keys;
|
protected $stored_keys;
|
||||||
|
|
||||||
// Indexed by config user name.
|
// Indexed by config user name.
|
||||||
protected $used_keys;
|
protected $used_keys;
|
||||||
@@ -80,8 +80,8 @@ class Configuration {
|
|||||||
public function storeUserPublicKey($user, $key) {
|
public function storeUserPublicKey($user, $key) {
|
||||||
$full_key_content = $this->getPublicKeyContent($key);
|
$full_key_content = $this->getPublicKeyContent($key);
|
||||||
|
|
||||||
if (array_key_exists($full_key_content, $this->system_keys)) {
|
if (array_key_exists($full_key_content, $this->stored_keys)) {
|
||||||
return $this->system_keys[$full_key_content];
|
return $this->stored_keys[$full_key_content];
|
||||||
}
|
}
|
||||||
|
|
||||||
$config_user_name = $this->getConfigUserName($user, $key);
|
$config_user_name = $this->getConfigUserName($user, $key);
|
||||||
@@ -92,6 +92,8 @@ class Configuration {
|
|||||||
$full_key_content);
|
$full_key_content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->stored_keys[$full_key_content] = $config_user_name;
|
||||||
|
|
||||||
return $config_user_name;
|
return $config_user_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,7 +182,7 @@ class Configuration {
|
|||||||
}
|
}
|
||||||
$key = file_get_contents("$this->keys_directory/$file");
|
$key = file_get_contents("$this->keys_directory/$file");
|
||||||
$file_we = basename($file, '.pub');
|
$file_we = basename($file, '.pub');
|
||||||
$this->system_keys[$key] = $file_we;
|
$this->stored_keys[$key] = $file_we;
|
||||||
$this->used_keys[$file_we] = true;
|
$this->used_keys[$file_we] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user