From 6a97ddfa725b6e099c3af7fc830f8ff92f7c00ac Mon Sep 17 00:00:00 2001 From: terrafrost Date: Sun, 10 Apr 2016 10:58:49 -0500 Subject: [PATCH] SSH/Agent: if comment is empty don't include it --- phpseclib/System/SSH/Agent.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/phpseclib/System/SSH/Agent.php b/phpseclib/System/SSH/Agent.php index 4ca34d4c..0f4874dc 100644 --- a/phpseclib/System/SSH/Agent.php +++ b/phpseclib/System/SSH/Agent.php @@ -320,9 +320,10 @@ class System_SSH_Agent for ($i = 0; $i < $keyCount; $i++) { $length = current(unpack('N', fread($this->fsock, 4))); $key_blob = fread($this->fsock, $length); + $key_str = 'ssh-rsa ' . base64_encode($key_blob); $length = current(unpack('N', fread($this->fsock, 4))); if ($length) { - $key_comment = fread($this->fsock, $length); + $key_str.= ' ' . fread($this->fsock, $length); } $length = current(unpack('N', substr($key_blob, 0, 4))); $key_type = substr($key_blob, 4, $length); @@ -332,7 +333,7 @@ class System_SSH_Agent include_once 'Crypt/RSA.php'; } $key = new Crypt_RSA(); - $key->loadKey('ssh-rsa ' . base64_encode($key_blob) . ' ' . $key_comment); + $key->loadKey($key_str); break; case 'ssh-dss': // not currently supported