-rw-r--r-- | .gitignore | 33 | ||||
-rw-r--r-- | COPYING | 2 | ||||
-rw-r--r-- | Makefile.am | 3 | ||||
-rw-r--r-- | NEWS.xml | 6 | ||||
-rwxr-xr-x | autogen.sh | 2 | ||||
-rw-r--r-- | autoregen.sh | 2 | ||||
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | include/opkele/expat.h | 3 | ||||
-rw-r--r-- | lib/basic_rp.cc | 3 | ||||
-rw-r--r-- | lib/discovery.cc | 53 | ||||
-rw-r--r-- | lib/expat.cc | 9 | ||||
-rw-r--r-- | test/RP.cc | 1 |
12 files changed, 82 insertions, 39 deletions
@@ -1,21 +1,16 @@ | |||
1 | configure | 1 | /configure |
2 | Makefile.in | 2 | Makefile.in |
3 | Doxyfile | 3 | /Doxyfile |
4 | config.log | 4 | /config.log |
5 | depcomp | 5 | /config.h |
6 | config.guess | 6 | /INSTALL |
7 | config.h | 7 | /NEWS |
8 | config.sub | ||
9 | ltmain.sh | ||
10 | INSTALL | ||
11 | NEWS | ||
12 | Makefile | 8 | Makefile |
13 | config.status | 9 | /config.status |
14 | stamp-h1 | 10 | /stamp-h1 |
15 | config.h.in | 11 | /config.h.in |
16 | libtool | 12 | /autom4te.cache |
17 | autom4te.cache | 13 | /libopkele.pc |
18 | libopkele.pc | 14 | /aclocal.m4 |
19 | missing | 15 | /aclocal.d |
20 | aclocal.m4 | 16 | /aux.d |
21 | install-sh | ||
@@ -1,4 +1,4 @@ | |||
1 | Copyright (c) 2005-2008 Klever Group (http://www.klever.net/) | 1 | Copyright (c) 2005-2009 Klever Group (http://www.klever.net/) |
2 | 2 | ||
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of |
4 | this software and associated documentation files (the "Software"), to deal in | 4 | this software and associated documentation files (the "Software"), to deal in |
diff --git a/Makefile.am b/Makefile.am index 3227bdb..7726dad 100644 --- a/Makefile.am +++ b/Makefile.am | |||
@@ -1,7 +1,8 @@ | |||
1 | |||
2 | SUBDIRS=include lib test | 1 | SUBDIRS=include lib test |
3 | EXTRA_DIST= NEWS NEWS.xml NEWS.xsl | 2 | EXTRA_DIST= NEWS NEWS.xml NEWS.xsl |
4 | 3 | ||
4 | ACLOCAL_AMFLAGS=-I aclocal.d | ||
5 | |||
5 | pkgconfigdir=${libdir}/pkgconfig | 6 | pkgconfigdir=${libdir}/pkgconfig |
6 | pkgconfig_DATA=libopkele.pc | 7 | pkgconfig_DATA=libopkele.pc |
7 | 8 | ||
@@ -1,5 +1,11 @@ | |||
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> |
@@ -4,7 +4,7 @@ if test -z "$tool_libtoolize" ; then | |||
4 | echo "Failed to find libtoolize." ; exit 1; | 4 | echo "Failed to find libtoolize." ; exit 1; |
5 | fi | 5 | fi |
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 \ |
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 | ||
2 | eval 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,6 +1,8 @@ | |||
1 | AC_INIT([libopkele], [2.0.1], [libopkele-bugs@klever.net]) | 1 | AC_INIT([libopkele], [2.0.2], [libopkele-bugs@klever.net]) |
2 | AC_CONFIG_SRCDIR([include/opkele/opkele-config.h]) | 2 | AC_CONFIG_SRCDIR([include/opkele/opkele-config.h]) |
3 | AC_CONFIG_HEADERS([config.h include/opkele/acconfig.h]) | 3 | AC_CONFIG_HEADERS([config.h include/opkele/acconfig.h]) |
4 | AC_CONFIG_MACRO_DIR([aclocal.d]) | ||
5 | AC_CONFIG_AUX_DIR([aux.d]) | ||
4 | AM_INIT_AUTOMAKE([dist-bzip2]) | 6 | AM_INIT_AUTOMAKE([dist-bzip2]) |
5 | 7 | ||
6 | AC_PROG_INSTALL | 8 | AC_PROG_INSTALL |
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 | |||
@@ -26,6 +26,9 @@ namespace opkele { | |||
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(); |
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 | |||
@@ -218,7 +218,8 @@ namespace opkele { | |||
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")); |
diff --git a/lib/discovery.cc b/lib/discovery.cc index bd1f917..b4ed3b6 100644 --- a/lib/discovery.cc +++ b/lib/discovery.cc | |||
@@ -283,6 +283,7 @@ namespace opkele { | |||
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(); |
@@ -453,25 +454,40 @@ namespace opkele { | |||
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 | } |
@@ -569,6 +585,13 @@ namespace opkele { | |||
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) { |
diff --git a/lib/expat.cc b/lib/expat.cc index c4dab7e..fb58a9a 100644 --- a/lib/expat.cc +++ b/lib/expat.cc | |||
@@ -92,6 +92,15 @@ namespace opkele { | |||
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 | } |
@@ -1,6 +1,7 @@ | |||
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> |