summaryrefslogtreecommitdiff
path: root/modules/openid/xrds.inc
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-01-31 18:39:46 +0000
committerDries Buytaert <dries@buytaert.net>2010-01-31 18:39:46 +0000
commit6c9b682bb61d41e91d209903b9008093b88e056b (patch)
treecfe003aed4d4326707784662bd11102b63c70e72 /modules/openid/xrds.inc
parenta3dd7ebad728f3778add41fd0fea1fc3c5fb6254 (diff)
downloadbrdo-6c9b682bb61d41e91d209903b9008093b88e056b.tar.gz
brdo-6c9b682bb61d41e91d209903b9008093b88e056b.tar.bz2
- Patch #579448 by c960657: fixed OpenID specification violation. Search for OP Identifier element to authenticate.
Diffstat (limited to 'modules/openid/xrds.inc')
-rw-r--r--modules/openid/xrds.inc27
1 files changed, 15 insertions, 12 deletions
diff --git a/modules/openid/xrds.inc b/modules/openid/xrds.inc
index 8470997db..0c6717ea4 100644
--- a/modules/openid/xrds.inc
+++ b/modules/openid/xrds.inc
@@ -25,10 +25,19 @@ function xrds_parse($xml) {
/**
* Parser callback functions
*/
-function _xrds_element_start(&$parser, $name, $attribs) {
- global $xrds_open_elements;
+function _xrds_element_start(&$parser, $name, $attributes) {
+ global $xrds_open_elements, $xrds_current_service;
$xrds_open_elements[] = _xrds_strip_namespace($name);
+
+ $path = strtoupper(implode('/', $xrds_open_elements));
+ if ($path == 'XRDS/XRD/SERVICE') {
+ foreach ($attributes as $attribute_name => $value) {
+ if (_xrds_strip_namespace($attribute_name) == 'PRIORITY') {
+ $xrds_current_service['priority'] = intval($value);
+ }
+ }
+ }
}
function _xrds_element_end(&$parser, $name) {
@@ -36,17 +45,11 @@ function _xrds_element_end(&$parser, $name) {
$name = _xrds_strip_namespace($name);
if ($name == 'SERVICE') {
- if (in_array(OPENID_NS_2_0 . '/signon', $xrds_current_service['types']) ||
- in_array(OPENID_NS_2_0 . '/server', $xrds_current_service['types'])) {
- $xrds_current_service['version'] = 2;
- }
- elseif (in_array(OPENID_NS_1_1, $xrds_current_service['types']) ||
- in_array(OPENID_NS_1_0, $xrds_current_service['types'])) {
- $xrds_current_service['version'] = 1;
- }
- if (!empty($xrds_current_service['version'])) {
- $xrds_services[] = $xrds_current_service;
+ if (!isset($xrds_current_service['priority'])) {
+ // If the priority attribute is absent, the default is infinity.
+ $xrds_current_service['priority'] = PHP_INT_MAX;
}
+ $xrds_services[] = $xrds_current_service;
$xrds_current_service = array();
}
array_pop($xrds_open_elements);