Commit 0c07fabb authored by Côme Chilliet's avatar Côme Chilliet
Browse files

Fixes #4385 Ignoring disabled- prefix when parsing SSH keys

parent d4df85c0
......@@ -22,14 +22,14 @@
class SSHPublicKeyAttribute extends FileTextAreaAttribute
{
/* cache for key extracted informations */
protected $format = '/^([-[:alnum:]=",]+\s+)?(ssh-(dss|rsa)|ecdsa-sha2-nistp\d{3})\s+([[:alnum:]+\/.=]+)(\s+([[:graph:][:space:]]+))?\s*$/';
protected $format = '/^([-[:alnum:]=",]+\s+)?(disabled-)?(ssh-(dss|rsa)|ecdsa-sha2-nistp\d{3})\s+([[:alnum:]+\/.=]+)(\s+([[:graph:][:space:]]+))?\s*$/';
function getArrayValue ()
{
if (preg_match($this->format, $this->value, $match)) {
$fingerprint = $this->fingerprint(base64_decode($match[4]));
$comment = (isset($match[6]) ? $match[6] : '');
switch ($match[2]) {
$fingerprint = $this->fingerprint(base64_decode($match[5]));
$comment = (isset($match[7]) ? $match[7] : '');
switch ($match[3]) {
case 'ssh-dss':
$type = 'DSA';
break;
......@@ -37,7 +37,7 @@ class SSHPublicKeyAttribute extends FileTextAreaAttribute
$type = 'RSA';
break;
default:
$type = $match[2];
$type = $match[3];
break;
}
return array(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment