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 @@ ...@@ -22,14 +22,14 @@
class SSHPublicKeyAttribute extends FileTextAreaAttribute class SSHPublicKeyAttribute extends FileTextAreaAttribute
{ {
/* cache for key extracted informations */ /* 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 () function getArrayValue ()
{ {
if (preg_match($this->format, $this->value, $match)) { if (preg_match($this->format, $this->value, $match)) {
$fingerprint = $this->fingerprint(base64_decode($match[4])); $fingerprint = $this->fingerprint(base64_decode($match[5]));
$comment = (isset($match[6]) ? $match[6] : ''); $comment = (isset($match[7]) ? $match[7] : '');
switch ($match[2]) { switch ($match[3]) {
case 'ssh-dss': case 'ssh-dss':
$type = 'DSA'; $type = 'DSA';
break; break;
...@@ -37,7 +37,7 @@ class SSHPublicKeyAttribute extends FileTextAreaAttribute ...@@ -37,7 +37,7 @@ class SSHPublicKeyAttribute extends FileTextAreaAttribute
$type = 'RSA'; $type = 'RSA';
break; break;
default: default:
$type = $match[2]; $type = $match[3];
break; break;
} }
return array( 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