summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--.gitignore33
-rw-r--r--COPYING2
-rw-r--r--Makefile.am3
-rw-r--r--NEWS.xml6
-rwxr-xr-xautogen.sh2
-rw-r--r--autoregen.sh2
-rw-r--r--configure.ac4
-rw-r--r--include/opkele/expat.h3
-rw-r--r--lib/basic_rp.cc3
-rw-r--r--lib/discovery.cc53
-rw-r--r--lib/expat.cc9
-rw-r--r--test/RP.cc1
12 files changed, 82 insertions, 39 deletions
diff --git a/.gitignore b/.gitignore
index 87771db..16be7d8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,21 +1,16 @@
1configure 1/configure
2Makefile.in 2Makefile.in
3Doxyfile 3/Doxyfile
4config.log 4/config.log
5depcomp 5/config.h
6config.guess 6/INSTALL
7config.h 7/NEWS
8config.sub
9ltmain.sh
10INSTALL
11NEWS
12Makefile 8Makefile
13config.status 9/config.status
14stamp-h1 10/stamp-h1
15config.h.in 11/config.h.in
16libtool 12/autom4te.cache
17autom4te.cache 13/libopkele.pc
18libopkele.pc 14/aclocal.m4
19missing 15/aclocal.d
20aclocal.m4 16/aux.d
21install-sh
diff --git a/COPYING b/COPYING
index 46d3f30..b9cc74c 100644
--- a/COPYING
+++ b/COPYING
@@ -1,5 +1,5 @@
1Copyright (c) 2005-2008 Klever Group (http://www.klever.net/) 1Copyright (c) 2005-2009 Klever Group (http://www.klever.net/)
2 2
3Permission is hereby granted, free of charge, to any person obtaining a copy of 3Permission is hereby granted, free of charge, to any person obtaining a copy of
4this software and associated documentation files (the "Software"), to deal in 4this software and associated documentation files (the "Software"), to deal in
5the Software without restriction, including without limitation the rights to 5the Software without restriction, including without limitation the rights to
diff --git a/Makefile.am b/Makefile.am
index 3227bdb..7726dad 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,8 +1,9 @@
1
2SUBDIRS=include lib test 1SUBDIRS=include lib test
3EXTRA_DIST= NEWS NEWS.xml NEWS.xsl 2EXTRA_DIST= NEWS NEWS.xml NEWS.xsl
4 3
4ACLOCAL_AMFLAGS=-I aclocal.d
5
5pkgconfigdir=${libdir}/pkgconfig 6pkgconfigdir=${libdir}/pkgconfig
6pkgconfig_DATA=libopkele.pc 7pkgconfig_DATA=libopkele.pc
7 8
8all-local: NEWS 9all-local: NEWS
diff --git a/NEWS.xml b/NEWS.xml
index 160b197..0206018 100644
--- a/NEWS.xml
+++ b/NEWS.xml
@@ -1,6 +1,12 @@
1<?xml version="1.0" encoding="us-ascii"?> 1<?xml version="1.0" encoding="us-ascii"?>
2<news> 2<news>
3 <version version="2.0.2" date="April 11th, 2009">
4 <ni>Handling of unknown encodings during discovery</ni>
5 <ni>Discovery robustness improvements</ni>
6 <ni>Workaround for OPs (e.g. livejournal.com) breaking specs</ni>
7 <ni>Build fixes and improvements</ni>
8 </version>
3 <version version="2.0.1" date="November 22nd, 2008"> 9 <version version="2.0.1" date="November 22nd, 2008">
4 <ni>Compile-time fixes and improvements</ni> 10 <ni>Compile-time fixes and improvements</ni>
5 <ni>Portability improvements for FreeBSD</ni> 11 <ni>Portability improvements for FreeBSD</ni>
6 <ni>Really suppress debugging message from htmltidy when --disable-debug is in 12 <ni>Really suppress debugging message from htmltidy when --disable-debug is in
diff --git a/autogen.sh b/autogen.sh
index bf32a35..578206d 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -3,9 +3,9 @@ tool_libtoolize="$(type -P glibtoolize || type -P libtoolize)"
3if test -z "$tool_libtoolize" ; then 3if test -z "$tool_libtoolize" ; then
4 echo "Failed to find libtoolize." ; exit 1; 4 echo "Failed to find libtoolize." ; exit 1;
5fi 5fi
6 "$tool_libtoolize" -f \ 6 "$tool_libtoolize" -f \
7&& aclocal \ 7&& aclocal -I aclocal.d \
8&& autoheader \ 8&& autoheader \
9&& automake -a \ 9&& automake -a \
10&& autoconf \ 10&& autoconf \
11&& ./configure "$@" 11&& ./configure "$@"
diff --git a/autoregen.sh b/autoregen.sh
new file mode 100644
index 0000000..ce75a08
--- a/dev/null
+++ b/autoregen.sh
@@ -0,0 +1,2 @@
1#!/bin/bash
2eval sh autogen.sh $(./config.status --version | grep '^ with options "'|sed -e 's/^[^"]\+"//' -e 's/"$//') "$@"
diff --git a/configure.ac b/configure.ac
index a7b56ff..2ded490 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,9 @@
1AC_INIT([libopkele], [2.0.1], [libopkele-bugs@klever.net]) 1AC_INIT([libopkele], [2.0.2], [libopkele-bugs@klever.net])
2AC_CONFIG_SRCDIR([include/opkele/opkele-config.h]) 2AC_CONFIG_SRCDIR([include/opkele/opkele-config.h])
3AC_CONFIG_HEADERS([config.h include/opkele/acconfig.h]) 3AC_CONFIG_HEADERS([config.h include/opkele/acconfig.h])
4AC_CONFIG_MACRO_DIR([aclocal.d])
5AC_CONFIG_AUX_DIR([aux.d])
4AM_INIT_AUTOMAKE([dist-bzip2]) 6AM_INIT_AUTOMAKE([dist-bzip2])
5 7
6AC_PROG_INSTALL 8AC_PROG_INSTALL
7AC_PROG_CXX 9AC_PROG_CXX
diff --git a/include/opkele/expat.h b/include/opkele/expat.h
index 3ab1630..21be003 100644
--- a/include/opkele/expat.h
+++ b/include/opkele/expat.h
@@ -25,8 +25,11 @@ namespace opkele {
25 assert(_x); 25 assert(_x);
26 return XML_Parse(_x,s,len,final); 26 return XML_Parse(_x,s,len,final);
27 } 27 }
28 28
29 virtual int unknown_encoding(const XML_Char * /* n */,XML_Encoding * /* i */) { return XML_STATUS_ERROR; }
30 void set_unknown_encoding_handler();
31
29 virtual void start_element(const XML_Char * /* n */,const XML_Char ** /* a */) { } 32 virtual void start_element(const XML_Char * /* n */,const XML_Char ** /* a */) { }
30 virtual void end_element(const XML_Char * /* n */) { } 33 virtual void end_element(const XML_Char * /* n */) { }
31 void set_element_handler(); 34 void set_element_handler();
32 35
diff --git a/lib/basic_rp.cc b/lib/basic_rp.cc
index 3cad71c..9c7113b 100644
--- a/lib/basic_rp.cc
+++ b/lib/basic_rp.cc
@@ -217,9 +217,10 @@ namespace opkele {
217 217
218 void basic_RP::id_res(const basic_openid_message& om,extension_t *ext) { 218 void basic_RP::id_res(const basic_openid_message& om,extension_t *ext) {
219 reset_vars(); 219 reset_vars();
220 bool o2 = om.has_field("ns") 220 bool o2 = om.has_field("ns")
221 && om.get_field("ns")==OIURI_OPENID20; 221 && om.get_field("ns")==OIURI_OPENID20
222 && om.has_field("op_endpoint") && !om.get_field("op_endpoint").empty();
222 if( (!o2) && om.has_field("user_setup_url")) 223 if( (!o2) && om.has_field("user_setup_url"))
223 throw id_res_setup(OPKELE_CP_ "assertion failed, setup url provided", 224 throw id_res_setup(OPKELE_CP_ "assertion failed, setup url provided",
224 om.get_field("user_setup_url")); 225 om.get_field("user_setup_url"));
225 string m = om.get_field("mode"); 226 string m = om.get_field("mode");
diff --git a/lib/discovery.cc b/lib/discovery.cc
index bd1f917..b4ed3b6 100644
--- a/lib/discovery.cc
+++ b/lib/discovery.cc
@@ -282,8 +282,9 @@ namespace opkele {
282 void prepare_to_parse() { 282 void prepare_to_parse() {
283 (*(expat_t*)this) = parser_create_ns(); 283 (*(expat_t*)this) = parser_create_ns();
284 set_user_data(); set_element_handler(); 284 set_user_data(); set_element_handler();
285 set_character_data_handler(); 285 set_character_data_handler();
286 set_unknown_encoding_handler();
286 287
287 if(xmode&xmode_html) { 288 if(xmode&xmode_html) {
288 html_openid1.clear(); html_openid2.clear(); 289 html_openid1.clear(); html_openid2.clear();
289 parser_choked = false; 290 parser_choked = false;
@@ -452,27 +453,42 @@ namespace opkele {
452 if(skipping) { 453 if(skipping) {
453 --skipping; return; 454 --skipping; return;
454 } 455 }
455 if(is_qelement(n,NSURI_XRD "\tType")) { 456 if(is_qelement(n,NSURI_XRD "\tType")) {
456 assert(xrd); assert(xrd_service); assert(cdata==&cdata_buf); 457 if(xrd && xrd_service) {
457 xrd_service->types.insert(cdata_buf); 458 assert(cdata==&cdata_buf);
459 xrd_service->types.insert(cdata_buf);
460 }
458 }else if(is_qelement(n,NSURI_XRD "\tService")) { 461 }else if(is_qelement(n,NSURI_XRD "\tService")) {
459 assert(xrd); assert(xrd_service); 462 if(!(xrd && xrd_service)) {
460 assert(!pt_stack.empty()); 463 skipping = -1;
461 assert(pt_stack.back()==(NSURI_XRD "\tService")); 464 }else{
462 pt_stack.pop_back(); 465 assert(!pt_stack.empty());
463 xrd_service = 0; 466 assert(pt_stack.back()==(NSURI_XRD "\tService"));
464 }else if(is_qelement(n,NSURI_XRD "\tStatus")) {
465 assert(xrd);
466 if(is_qelement(pt_stack.back().c_str(),n)) {
467 assert(cdata==&status_string);
468 pt_stack.pop_back(); 467 pt_stack.pop_back();
469 if(status_code!=100) 468 xrd_service = 0;
470 skipping = -1; 469 }
470 }else if(is_qelement(n,NSURI_XRD "\tStatus")) {
471 if(!xrd) {
472 skipping=-1;
473 }else{
474 if(is_qelement(pt_stack.back().c_str(),n)) {
475 assert(cdata==&status_string);
476 pt_stack.pop_back();
477 if(status_code!=100)
478 skipping = -1;
479 }
471 } 480 }
472 }else if(is_qelement(n,NSURI_XRD "\tExpires")) { 481 }else if(is_qelement(n,NSURI_XRD "\tExpires")) {
473 assert(xrd); 482 if(!xrd) {
474 xrd->expires = util::w3c_to_time(cdata_buf); 483 skipping=-1;
484 }else{
485 xrd->expires = util::w3c_to_time(cdata_buf);
486 }
487 }else if(is_qelement(n,NSURI_XRD "\tXRD")) {
488 assert(!pt_stack.empty());
489 assert(pt_stack.back()==(NSURI_XRD "\tXRD"));
490 pt_stack.pop_back();
475 }else if((xmode&xmode_html) && is_element(n,"head")) { 491 }else if((xmode&xmode_html) && is_element(n,"head")) {
476 skipping = -1; 492 skipping = -1;
477 } 493 }
478 cdata = 0; 494 cdata = 0;
@@ -568,8 +584,15 @@ namespace opkele {
568 } 584 }
569 } 585 }
570 } 586 }
571 587
588 int unknown_encoding(const XML_Char* /* n */,XML_Encoding *i) {
589 for(unsigned int ii=0;ii < sizeof(i->map)/sizeof(i->map[0]);++ii)
590 i->map[ii] = ii;
591 i->convert = 0; i->release = 0;
592 return XML_STATUS_OK;
593 }
594
572 }; 595 };
573 596
574 string idiscover(endpoint_discovery_iterator oi,const string& identity) { 597 string idiscover(endpoint_discovery_iterator oi,const string& identity) {
575 idigger_t idigger; 598 idigger_t idigger;
diff --git a/lib/expat.cc b/lib/expat.cc
index c4dab7e..fb58a9a 100644
--- a/lib/expat.cc
+++ b/lib/expat.cc
@@ -91,7 +91,16 @@ namespace opkele {
91 assert(_x); 91 assert(_x);
92 XML_SetNamespaceDeclHandler(_x,_start_namespace_decl,_end_namespace_decl); 92 XML_SetNamespaceDeclHandler(_x,_start_namespace_decl,_end_namespace_decl);
93 } 93 }
94 94
95 static int _unknown_encoding(void *ehd,const XML_Char *n,XML_Encoding *i) {
96 return ((expat_t*)ehd)->unknown_encoding(n,i);
97 }
98
99 void expat_t::set_unknown_encoding_handler() {
100 assert(_x);
101 XML_SetUnknownEncodingHandler(_x,_unknown_encoding,this);
102 }
103
95 } 104 }
96 105
97} 106}
diff --git a/test/RP.cc b/test/RP.cc
index 35ee71d..f015723 100644
--- a/test/RP.cc
+++ b/test/RP.cc
@@ -1,7 +1,8 @@
1#include <uuid/uuid.h> 1#include <uuid/uuid.h>
2#include <iostream> 2#include <iostream>
3#include <cassert> 3#include <cassert>
4#include <cstdlib>
4#include <stdexcept> 5#include <stdexcept>
5#include <string> 6#include <string>
6#include <set> 7#include <set>
7#include <iterator> 8#include <iterator>