diff options
author | James Walker <walkah@walkah.net> | 2010-03-24 14:27:35 -0400 |
---|---|---|
committer | James Walker <walkah@walkah.net> | 2010-03-24 14:27:35 -0400 |
commit | 10410907a0a6f1af9fb18cb3341db792baa49cf3 (patch) | |
tree | 89507813172c69afa05646a31081c428f6678a21 /plugins | |
parent | 7b1b6045e61973b8835e7253d6b532a752535297 (diff) |
A bit safer checking in the keypair parsing
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/OStatus/lib/magicenvelope.php | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/plugins/OStatus/lib/magicenvelope.php b/plugins/OStatus/lib/magicenvelope.php index 9266cab5c..799b5e307 100644 --- a/plugins/OStatus/lib/magicenvelope.php +++ b/plugins/OStatus/lib/magicenvelope.php @@ -59,12 +59,21 @@ class MagicEnvelope } if ($xrd->links) { if ($link = Discovery::getService($xrd->links, Magicsig::PUBLICKEYREL)) { - list($type, $keypair) = explode(',', $link['href']); - if (empty($keypair)) { + $keypair = false; + $parts = explode(',', $link['href']); + if (count($parts) == 2) { + $keypair = $parts[1]; + } else { // Backwards compatibility check for separator bug in 0.9.0 - list($type, $keypair) = explode(';', $link['href']); + $parts = explode(';', $link['href']); + if (count($parts) == 2) { + $keypair = $parts[1]; + } + } + + if ($keypair) { + return $keypair; } - return $keypair; } } throw new Exception('Unable to locate signer public key'); |