Indefero

Issue 671: PHP Internal error on some SSH Public key

Reported by William Martin, Apr 29, 2011

Hi,

I have found an ssh public key which crash indefero !


PlufErrorHandlerException making POST request to 
/index.php/preferences/
8 : Undefined offset: 2

PHP: /var/www/indefero/src/IDF/Key.php, line 84
URI: POST /index.php/preferences/

** Stacktrace **

* PlufErrorHandler
        [/var/www/indefero/src/IDF/Key.php, line 84] *
* Src *
79:     {
80:         if (preg_match('#^\[pubkey 
([^\]]+)\]\s*(\S+)\s*\[end\]$#', $this->content, $m)) {
81:             return array('mtn', $m[1], $m[2]);
82:         }
83:         else if 
(preg_match('#^ssh\-[a-z]{3}\s(\S+)(?:\s(\S+))?$#', 
$this->content, $m)) {
>> 84:             return array('ssh', $m[2], $m[1]);
85:         }
86: 
87:         throw new Exception(__('Invalid or unknown key data 
detected.'));
88:     }
89: 


Used public key is : (note the trailing space)
ssh-rsa 
AAAAB3NzaC1yc2EAAAABIwAAAQEAxD9f1yWYaGI066cv/O0RI6vzdKDkyz3HiP/MOpSqN
DRLZBisykJeGj1O2yW1J5Khv7HAsVHdaaczX4JlvHAZNvaTw6zb7QeZX499PQ/ot6txmr
fJAaqUTu+faogUBoBMjjIDIHG+Dyrbr28OZfHCI/sJR98hJc8M+fzntlxlw9P/kuzl67F
17oNT+SuZ5/u9HIbo/DQOplQrWT8h8gFZV9SX1RG3k5rMayJTKZXdZxONF4j8XotztsFG
lhKr3MwwPbUutbFaInDbM9MV+xw1rxdVZY2l5Kg2C39pdPGFUaNNsCXg5KfCHeKrpmkRd
4k+5OtPQKQu5THJCkmP1gSPfw==

Comment 1 by Byung Choi, May 3, 2011

same here, key must be in <<type>> <<key>> 
<<comment>> format. when you forget comment, then 
indefero script crashs, this needs to be fixed

Comment 2 by William Martin, May 4, 2011

commit 9644784a792f78d4da85cbd045a9009261113323
Status: Fixed
Owner: wysman

Comment 3 by Thomas Keller, May 16, 2011

@William: Could you please cherry-pick this to the release-1.1 
branch or alternatively re-tag this as Milestone:Release1.2? Thanks!

Comment 4 by William Martin, May 17, 2011

It's already done
commit bbf1a1882a676486837abb2d7496b0443a969233

Comment 5 by Thomas Keller, May 17, 2011

Again, sorry for the noise and thanks for your work.

Created: 2 years 20 days ago by William Martin

Updated: 2 years 2 days ago

Status: Fixed

Owner: William Martin

Followed by: 2 persons

Labels:
Type:Defect
Priority:Critical
Milestone:Release1.1.2