Should work with Yubico's official server now - forgot to account for newlines.
authorDan
Thu, 26 Feb 2009 16:33:06 -0500
changeset 4 73aecd46bb56
parent 3 d0fe7acaf0e8
child 5 2114640729a5
Should work with Yubico's official server now - forgot to account for newlines.
plugins/yubikey/corelib.php
--- a/plugins/yubikey/corelib.php	Thu Feb 26 11:30:17 2009 -0500
+++ b/plugins/yubikey/corelib.php	Thu Feb 26 16:33:06 2009 -0500
@@ -85,8 +85,7 @@
       );
   }
   $response = trim($response);
-  $response_nosig = preg_replace('/^h=(.+?)$/m', '', $response);
-  if ( !preg_match_all('/^([a-z0-9_]+)=(.*?)$/m', $response, $matches) )
+  if ( !preg_match_all('/^([a-z0-9_]+)=(.*?)\r?$/m', $response, $matches) )
   {
     return array(
         'success' => false,
@@ -145,8 +144,6 @@
   static $api_key = false;
   
   ksort($arr);
-  if ( isset($arr['h']) )
-    unset($arr['h']);
   
   if ( !$api_key )
   {
@@ -154,6 +151,9 @@
     $api_key = hexencode(base64_decode($api_key), '', '');
   }
   
+  if ( isset($arr['h']) )
+    unset($arr['h']);
+  
   $req = array();
   foreach ( $arr as $key => $val )
   {