plugin_openid: Patched OpenID library to do an autofallback, if

/dev/urandom is not accessible instead of failing completely.
This commit is contained in:
Grischa Brockhaus 2012-03-24 13:36:38 +01:00
parent ef165780c6
commit 0487572b3d
4 changed files with 58 additions and 3 deletions

View file

@ -1,3 +1,7 @@
Version 0.6 (brockhaus)
---------------------------------
* Patched OpenID library to do an autofallback, if /dev/urandom is not accessible instead of failing completely.
Version 0.5 (brockhaus)
---------------------------------
* New PHP-OpenId lib

View file

@ -46,11 +46,14 @@ class Auth_OpenID_CryptUtil {
$f = false;
} else {
$f = @fopen(Auth_OpenID_RAND_SOURCE, "r");
// Grischa Brockhaus patch: Do an autofallback, don't fail!
/*
if ($f === false) {
$msg = 'Define Auth_OpenID_RAND_SOURCE as null to ' .
' continue with an insecure random number generator.';
trigger_error($msg, E_USER_ERROR);
}
*/
}
}
if ($f === false) {

View file

@ -9,7 +9,56 @@ COPYING file.
Rob Richards
rrichards@ctindustries.net
----------------------------
22.03.2012 Grischa Brockhaus
* Replaced with newest version of library
* Added this pull request changes https://github.com/arnaud-lb/php-openid/commit/bb6da3326a330b2d4dd235a23316d23bc5569016
(Fixing some big problems with new ERROR HANDLING in S9Y 1.7)
(Fixing some big problems with new ERROR HANDLING in S9Y 1.7)
----------------------------
24.03.2012 Grischa Brockhaus
* Do an atofallback, if /dev/urandom is not accessible in CryptUtil
Changed
static function getBytes($num_bytes)
{
static $f = null;
$bytes = '';
if ($f === null) {
if (Auth_OpenID_RAND_SOURCE === null) {
$f = false;
} else {
$f = @fopen(Auth_OpenID_RAND_SOURCE, "r");
if ($f === false) {
$msg = 'Define Auth_OpenID_RAND_SOURCE as null to ' .
' continue with an insecure random number generator.';
trigger_error($msg, E_USER_ERROR);
}
}
}
to
static function getBytes($num_bytes)
{
static $f = null;
$bytes = '';
if ($f === null) {
if (Auth_OpenID_RAND_SOURCE === null) {
$f = false;
} else {
$f = @fopen(Auth_OpenID_RAND_SOURCE, "r");
// Grischa Brockhaus patch: Do an autofallback, don't fail!
/*
if ($f === false) {
$msg = 'Define Auth_OpenID_RAND_SOURCE as null to ' .
' continue with an insecure random number generator.';
trigger_error($msg, E_USER_ERROR);
}
*/
}
}
----------------------------

View file

@ -13,7 +13,7 @@ class serendipity_event_openid extends serendipity_event
$propbag->add('description', PLUGIN_OPENID_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Grischa Brockhaus, Rob Richards');
$propbag->add('version', '0.5');
$propbag->add('version', '0.6');
$propbag->add('requirements', array(
'serendipity' => '1.2',
'smarty' => '2.6.7',
@ -138,7 +138,6 @@ class serendipity_event_openid extends serendipity_event
}
} else if (! empty($serendipity['GET']['openidflag']) && ($serendipity['GET']['openidflag']==1)) {
$eventData = serendipity_common_openid::authenticate_openid($_GET, $this->get_consumertest_path());
print_r($eventData);
} else if (! empty($serendipity['POST']['openid_url']) && ! empty($serendipity['POST']['action'])) {
$eventData = serendipity_common_openid::redir_openidserver($serendipity['POST']['openid_url'], $this->get_consumertest_path(), 1);
}