-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 | 31 | ||||
-rw-r--r-- | lib/expat.cc | 9 | ||||
-rw-r--r-- | test/RP.cc | 1 |
12 files changed, 71 insertions, 28 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,7 +1,7 @@ | |||
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 |
5 | the Software without restriction, including without limitation the rights to | 5 | the Software without restriction, including without limitation the rights to |
6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies |
7 | of the Software, and to permit persons to whom the Software is furnished to do | 7 | of the Software, and to permit persons to whom the Software is furnished to do |
diff --git a/Makefile.am b/Makefile.am index 3227bdb..7726dad 100644 --- a/Makefile.am +++ b/Makefile.am | |||
@@ -1,10 +1,11 @@ | |||
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 | ||
8 | all-local: NEWS | 9 | all-local: NEWS |
9 | if HAVE_DOXYGEN | 10 | if HAVE_DOXYGEN |
10 | clean-local: | 11 | clean-local: |
@@ -1,8 +1,14 @@ | |||
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 |
7 | effect</ni> | 13 | effect</ni> |
8 | <ni>minor bugfixes</ni> | 14 | <ni>minor bugfixes</ni> |
@@ -1,11 +1,11 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | tool_libtoolize="$(type -P glibtoolize || type -P libtoolize)" | 2 | tool_libtoolize="$(type -P glibtoolize || type -P libtoolize)" |
3 | if test -z "$tool_libtoolize" ; then | 3 | 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 \ |
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 | ||
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,9 +1,11 @@ | |||
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 |
7 | AC_PROG_CXX | 9 | AC_PROG_CXX |
8 | AC_PROG_CC | 10 | AC_PROG_CC |
9 | AC_PROG_LIBTOOL | 11 | AC_PROG_LIBTOOL |
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 | |||
@@ -23,12 +23,15 @@ namespace opkele { | |||
23 | 23 | ||
24 | inline bool parse(const char *s,int len,bool final=false) { | 24 | inline bool parse(const char *s,int len,bool final=false) { |
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 | ||
33 | virtual void character_data(const XML_Char * /* s */,int /* l */) { } | 36 | virtual void character_data(const XML_Char * /* s */,int /* l */) { } |
34 | void set_character_data_handler(); | 37 | void set_character_data_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 | |||
@@ -215,13 +215,14 @@ namespace opkele { | |||
215 | } | 215 | } |
216 | } | 216 | } |
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"); |
226 | if(o2 && m=="setup_needed") | 227 | if(o2 && m=="setup_needed") |
227 | throw id_res_setup(OPKELE_CP_ "setup needed, no setup url provided"); | 228 | throw id_res_setup(OPKELE_CP_ "setup needed, no setup url provided"); |
diff --git a/lib/discovery.cc b/lib/discovery.cc index bd1f917..b4ed3b6 100644 --- a/lib/discovery.cc +++ b/lib/discovery.cc | |||
@@ -280,12 +280,13 @@ namespace opkele { | |||
280 | } | 280 | } |
281 | 281 | ||
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; |
290 | } | 291 | } |
291 | 292 | ||
@@ -450,31 +451,46 @@ namespace opkele { | |||
450 | void end_element(const XML_Char *n) { | 451 | void end_element(const XML_Char *n) { |
451 | if(skipping<0) return; | 452 | if(skipping<0) return; |
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) { |
458 | assert(cdata==&cdata_buf); | ||
457 | xrd_service->types.insert(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)) { |
463 | skipping = -1; | ||
464 | }else{ | ||
460 | assert(!pt_stack.empty()); | 465 | assert(!pt_stack.empty()); |
461 | assert(pt_stack.back()==(NSURI_XRD "\tService")); | 466 | assert(pt_stack.back()==(NSURI_XRD "\tService")); |
462 | pt_stack.pop_back(); | 467 | pt_stack.pop_back(); |
463 | xrd_service = 0; | 468 | xrd_service = 0; |
469 | } | ||
464 | }else if(is_qelement(n,NSURI_XRD "\tStatus")) { | 470 | }else if(is_qelement(n,NSURI_XRD "\tStatus")) { |
465 | assert(xrd); | 471 | if(!xrd) { |
472 | skipping=-1; | ||
473 | }else{ | ||
466 | if(is_qelement(pt_stack.back().c_str(),n)) { | 474 | if(is_qelement(pt_stack.back().c_str(),n)) { |
467 | assert(cdata==&status_string); | 475 | assert(cdata==&status_string); |
468 | pt_stack.pop_back(); | 476 | pt_stack.pop_back(); |
469 | if(status_code!=100) | 477 | if(status_code!=100) |
470 | skipping = -1; | 478 | skipping = -1; |
471 | } | 479 | } |
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) { |
483 | skipping=-1; | ||
484 | }else{ | ||
474 | xrd->expires = util::w3c_to_time(cdata_buf); | 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; |
479 | } | 495 | } |
480 | void character_data(const XML_Char *s,int l) { | 496 | void character_data(const XML_Char *s,int l) { |
@@ -566,12 +582,19 @@ namespace opkele { | |||
566 | } | 582 | } |
567 | } | 583 | } |
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; |
576 | return idigger.discover(oi,identity); | 599 | return idigger.discover(oi,identity); |
577 | } | 600 | } |
diff --git a/lib/expat.cc b/lib/expat.cc index c4dab7e..fb58a9a 100644 --- a/lib/expat.cc +++ b/lib/expat.cc | |||
@@ -89,9 +89,18 @@ namespace opkele { | |||
89 | 89 | ||
90 | void expat_t::set_namespace_decl_handler() { | 90 | void expat_t::set_namespace_decl_handler() { |
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 | } |
@@ -1,9 +1,10 @@ | |||
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> |
8 | using namespace std; | 9 | using namespace std; |
9 | #include <kingate/exception.h> | 10 | #include <kingate/exception.h> |