-rw-r--r-- | include/opkele/iterator.h | 4 | ||||
-rw-r--r-- | lib/discovery.cc | 4 | ||||
-rw-r--r-- | lib/message.cc | 2 | ||||
-rw-r--r-- | lib/prequeue_rp.cc | 4 | ||||
-rw-r--r-- | lib/secret.cc | 2 | ||||
-rw-r--r-- | lib/util.cc | 6 |
6 files changed, 11 insertions, 11 deletions
diff --git a/include/opkele/iterator.h b/include/opkele/iterator.h index 28c1c83..8f86234 100644 --- a/include/opkele/iterator.h +++ b/include/opkele/iterator.h | |||
@@ -150,29 +150,29 @@ namespace opkele { | |||
150 | assert(!empty); | 150 | assert(!empty); |
151 | return *it; } | 151 | return *it; } |
152 | typename IT::pointer operator->() const { | 152 | typename IT::pointer operator->() const { |
153 | assert(!empty); | 153 | assert(!empty); |
154 | return it.operator->(); } | 154 | return it.operator->(); } |
155 | 155 | ||
156 | basic_filterator<IT>& operator++() { | 156 | basic_filterator<IT>& operator++() { |
157 | bool found = false; | 157 | bool found = false; |
158 | for(++it;!(it==ei || (found=is_interesting()));++it); | 158 | for(++it;!(it==ei || (found=is_interesting()));++it) ; |
159 | if(!found) empty=true; | 159 | if(!found) empty=true; |
160 | return *this; | 160 | return *this; |
161 | } | 161 | } |
162 | basic_filterator<IT> operator++(int) { | 162 | basic_filterator<IT> operator++(int) { |
163 | basic_filterator<IT> rv(*this); | 163 | basic_filterator<IT> rv(*this); |
164 | ++(*this); | 164 | ++(*this); |
165 | return rv; | 165 | return rv; |
166 | } | 166 | } |
167 | 167 | ||
168 | void prepare() { | 168 | void prepare() { |
169 | bool found = false; | 169 | bool found = false; |
170 | for(;!(it==ei || (found=is_interesting()));++it); | 170 | for(;!(it==ei || (found=is_interesting()));++it) ; |
171 | if(!found) empty = true; | 171 | if(!found) empty = true; |
172 | } | 172 | } |
173 | virtual bool is_interesting() const = 0; | 173 | virtual bool is_interesting() const = 0; |
174 | }; | 174 | }; |
175 | 175 | ||
176 | template<typename IT,typename T=typename IT::value_type::first_type,typename TR=T&,typename TP=T*> | 176 | template<typename IT,typename T=typename IT::value_type::first_type,typename TR=T&,typename TP=T*> |
177 | class map_keys_iterator : public iterator< | 177 | class map_keys_iterator : public iterator< |
178 | typename IT::iterator_category, | 178 | typename IT::iterator_category, |
diff --git a/lib/discovery.cc b/lib/discovery.cc index d1989ec..984e308 100644 --- a/lib/discovery.cc +++ b/lib/discovery.cc | |||
@@ -334,17 +334,17 @@ namespace opkele { | |||
334 | const char *colon = (const char*)memchr(p,':',bytes); | 334 | const char *colon = (const char*)memchr(p,':',bytes); |
335 | const char *space = (const char*)memchr(p,' ',bytes); | 335 | const char *space = (const char*)memchr(p,' ',bytes); |
336 | if(space && ( (!colon) || space<colon ) ) { | 336 | if(space && ( (!colon) || space<colon ) ) { |
337 | xrds_location.clear(); http_content_type.clear(); | 337 | xrds_location.clear(); http_content_type.clear(); |
338 | }else if(colon) { | 338 | }else if(colon) { |
339 | const char *hv = ++colon; | 339 | const char *hv = ++colon; |
340 | size_t hnl = colon-h; | 340 | size_t hnl = colon-h; |
341 | int rb; | 341 | int rb; |
342 | for(rb = bytes-hnl-1;rb>0 && isspace(*hv);++hv,--rb); | 342 | for(rb = bytes-hnl-1;rb>0 && isspace(*hv);++hv,--rb) ; |
343 | while(rb>0 && isspace(hv[rb-1])) --rb; | 343 | while(rb>0 && isspace(hv[rb-1])) --rb; |
344 | if(rb) { | 344 | if(rb) { |
345 | if( (hnl>=sizeof(XRDS_HEADER)) | 345 | if( (hnl>=sizeof(XRDS_HEADER)) |
346 | && !strncasecmp(h,XRDS_HEADER":", | 346 | && !strncasecmp(h,XRDS_HEADER":", |
347 | sizeof(XRDS_HEADER)) ) { | 347 | sizeof(XRDS_HEADER)) ) { |
348 | xrds_location.assign(hv,rb); | 348 | xrds_location.assign(hv,rb); |
349 | }else if( (hnl>=sizeof(CT_HEADER)) | 349 | }else if( (hnl>=sizeof(CT_HEADER)) |
350 | && !strncasecmp(h,CT_HEADER":", | 350 | && !strncasecmp(h,CT_HEADER":", |
@@ -495,17 +495,17 @@ namespace opkele { | |||
495 | }else if(is_element(n,"link")) { | 495 | }else if(is_element(n,"link")) { |
496 | string rels; | 496 | string rels; |
497 | string href; | 497 | string href; |
498 | for(;*a;a+=2) { | 498 | for(;*a;a+=2) { |
499 | if( !strcasecmp(a[0],"rel") ) { | 499 | if( !strcasecmp(a[0],"rel") ) { |
500 | rels.assign(a[1]); | 500 | rels.assign(a[1]); |
501 | }else if( !strcasecmp(a[0],"href") ) { | 501 | }else if( !strcasecmp(a[0],"href") ) { |
502 | const char *ns = a[1]; | 502 | const char *ns = a[1]; |
503 | for(;*ns && isspace(*ns);++ns); | 503 | for(;*ns && isspace(*ns);++ns) ; |
504 | href.assign(ns); | 504 | href.assign(ns); |
505 | string::size_type lns=href.find_last_not_of(data::_whitespace_chars); | 505 | string::size_type lns=href.find_last_not_of(data::_whitespace_chars); |
506 | href.erase(lns+1); | 506 | href.erase(lns+1); |
507 | } | 507 | } |
508 | } | 508 | } |
509 | for(string::size_type ns=rels.find_first_not_of(data::_whitespace_chars); | 509 | for(string::size_type ns=rels.find_first_not_of(data::_whitespace_chars); |
510 | ns!=string::npos; ns=rels.find_first_not_of(data::_whitespace_chars,ns)) { | 510 | ns!=string::npos; ns=rels.find_first_not_of(data::_whitespace_chars,ns)) { |
511 | string::size_type s = rels.find_first_of(data::_whitespace_chars,ns); | 511 | string::size_type s = rels.find_first_of(data::_whitespace_chars,ns); |
diff --git a/lib/message.cc b/lib/message.cc index 524946a..c1f8088 100644 --- a/lib/message.cc +++ b/lib/message.cc | |||
@@ -153,17 +153,17 @@ namespace opkele { | |||
153 | string basic_openid_message::allocate_ns(const string& uri,const char *pfx) { | 153 | string basic_openid_message::allocate_ns(const string& uri,const char *pfx) { |
154 | if(!has_field("ns")) | 154 | if(!has_field("ns")) |
155 | return pfx; | 155 | return pfx; |
156 | if(has_ns(uri)) | 156 | if(has_ns(uri)) |
157 | throw bad_input(OPKELE_CP_ "OpenID message already contains namespace"); | 157 | throw bad_input(OPKELE_CP_ "OpenID message already contains namespace"); |
158 | string rv = pfx; | 158 | string rv = pfx; |
159 | if(has_field("ns."+rv)) { | 159 | if(has_field("ns."+rv)) { |
160 | string::reference c=rv[rv.length()]; | 160 | string::reference c=rv[rv.length()]; |
161 | for(c='a';c<='z' && has_field("ns."+rv);++c); | 161 | for(c='a';c<='z' && has_field("ns."+rv);++c) ; |
162 | if(c=='z') | 162 | if(c=='z') |
163 | throw exception(OPKELE_CP_ "Failed to allocate namespace"); | 163 | throw exception(OPKELE_CP_ "Failed to allocate namespace"); |
164 | } | 164 | } |
165 | set_field("ns."+rv,uri); | 165 | set_field("ns."+rv,uri); |
166 | return rv; | 166 | return rv; |
167 | } | 167 | } |
168 | 168 | ||
169 | bool openid_message_t::has_field(const string& n) const { | 169 | bool openid_message_t::has_field(const string& n) const { |
diff --git a/lib/prequeue_rp.cc b/lib/prequeue_rp.cc index e499d08..886efae 100644 --- a/lib/prequeue_rp.cc +++ b/lib/prequeue_rp.cc | |||
@@ -37,19 +37,19 @@ namespace opkele { | |||
37 | } | 37 | } |
38 | return *this; | 38 | return *this; |
39 | } | 39 | } |
40 | 40 | ||
41 | OP_verifier& operator++() { return *this; } | 41 | OP_verifier& operator++() { return *this; } |
42 | OP_verifier& operator++(int) { return *this; } | 42 | OP_verifier& operator++(int) { return *this; } |
43 | }; | 43 | }; |
44 | 44 | ||
45 | void prequeue_RP::verify_OP(const string& OP,const string& claimed_id,const string& id) const { | 45 | void prequeue_RP::verify_OP(const string& OP,const string& _claimed_id,const string& id) const { |
46 | try { | 46 | try { |
47 | discover(OP_verifier(OP,id),claimed_id); | 47 | discover(OP_verifier(OP,id),_claimed_id); |
48 | throw id_res_unauthorized(OPKELE_CP_ | 48 | throw id_res_unauthorized(OPKELE_CP_ |
49 | "OP is not authorized to make an assertion regarding the identity"); | 49 | "OP is not authorized to make an assertion regarding the identity"); |
50 | }catch(__OP_verifier_good_input& ovgi) { | 50 | }catch(__OP_verifier_good_input& ovgi) { |
51 | } | 51 | } |
52 | } | 52 | } |
53 | 53 | ||
54 | class endpoint_queuer : public iterator<output_iterator_tag,openid_endpoint_t,void> { | 54 | class endpoint_queuer : public iterator<output_iterator_tag,openid_endpoint_t,void> { |
55 | public: | 55 | public: |
diff --git a/lib/secret.cc b/lib/secret.cc index d538890..3f1e39c 100644 --- a/lib/secret.cc +++ b/lib/secret.cc | |||
@@ -5,17 +5,17 @@ | |||
5 | #include <opkele/util.h> | 5 | #include <opkele/util.h> |
6 | 6 | ||
7 | namespace opkele { | 7 | namespace opkele { |
8 | using namespace std; | 8 | using namespace std; |
9 | 9 | ||
10 | template<class __a1,class __a2,class __r> | 10 | template<class __a1,class __a2,class __r> |
11 | struct bitwise_xor : public binary_function<__a1,__a2,__r> { | 11 | struct bitwise_xor : public binary_function<__a1,__a2,__r> { |
12 | __r operator() (const __a1& a1,const __a2& a2) const { | 12 | __r operator() (const __a1& a1,const __a2& a2) const { |
13 | return a1^a2; | 13 | return (__r)(a1^a2); |
14 | } | 14 | } |
15 | }; | 15 | }; |
16 | 16 | ||
17 | void secret_t::enxor_to_base64(const unsigned char *key_d,string& rv) const { | 17 | void secret_t::enxor_to_base64(const unsigned char *key_d,string& rv) const { |
18 | vector<unsigned char> tmp; | 18 | vector<unsigned char> tmp; |
19 | transform( | 19 | transform( |
20 | begin(), end(), | 20 | begin(), end(), |
21 | key_d, | 21 | key_d, |
diff --git a/lib/util.cc b/lib/util.cc index b702291..d979502 100644 --- a/lib/util.cc +++ b/lib/util.cc | |||
@@ -206,17 +206,17 @@ namespace opkele { | |||
206 | if(i==ie) | 206 | if(i==ie) |
207 | throw failed_conversion(OPKELE_CP_ "trailing percent in the url-encoded string"); | 207 | throw failed_conversion(OPKELE_CP_ "trailing percent in the url-encoded string"); |
208 | tmp[0] = *(i++); | 208 | tmp[0] = *(i++); |
209 | if(i==ie) | 209 | if(i==ie) |
210 | throw failed_conversion(OPKELE_CP_ "not enough hexadecimals after the percent sign in url-encoded string"); | 210 | throw failed_conversion(OPKELE_CP_ "not enough hexadecimals after the percent sign in url-encoded string"); |
211 | tmp[1] = *i; | 211 | tmp[1] = *i; |
212 | if(!(isxdigit(tmp[0]) && isxdigit(tmp[1]))) | 212 | if(!(isxdigit(tmp[0]) && isxdigit(tmp[1]))) |
213 | throw failed_conversion(OPKELE_CP_ "non-hex follows percent in url-encoded string"); | 213 | throw failed_conversion(OPKELE_CP_ "non-hex follows percent in url-encoded string"); |
214 | *(ii++) = strtol(tmp,0,16); | 214 | *(ii++) = (char)strtol(tmp,0,16); |
215 | break; | 215 | break; |
216 | default: | 216 | default: |
217 | *(ii++) = *i; break; | 217 | *(ii++) = *i; break; |
218 | } | 218 | } |
219 | } | 219 | } |
220 | return rv; | 220 | return rv; |
221 | } | 221 | } |
222 | 222 | ||
@@ -343,20 +343,20 @@ namespace opkele { | |||
343 | if((n+1)>=ul) | 343 | if((n+1)>=ul) |
344 | throw bad_input(OPKELE_CP_ "Unexpected end of URI encountered while parsing percent-encoded character"); | 344 | throw bad_input(OPKELE_CP_ "Unexpected end of URI encountered while parsing percent-encoded character"); |
345 | tmp[0] = uri[n++]; | 345 | tmp[0] = uri[n++]; |
346 | tmp[1] = uri[n++]; | 346 | tmp[1] = uri[n++]; |
347 | if(!( isxdigit(tmp[0]) && isxdigit(tmp[1]) )) | 347 | if(!( isxdigit(tmp[0]) && isxdigit(tmp[1]) )) |
348 | throw bad_input(OPKELE_CP_ "Invalid percent-encoded character in URI being normalized"); | 348 | throw bad_input(OPKELE_CP_ "Invalid percent-encoded character in URI being normalized"); |
349 | int cc = strtol(tmp,0,16); | 349 | int cc = strtol(tmp,0,16); |
350 | if( isalpha(cc) || isdigit(cc) || strchr("._~-",cc) ) | 350 | if( isalpha(cc) || isdigit(cc) || strchr("._~-",cc) ) |
351 | pseg += cc; | 351 | pseg += (char)cc; |
352 | else{ | 352 | else{ |
353 | pseg += '%'; | 353 | pseg += '%'; |
354 | pseg += toupper(tmp[0]); pseg += toupper(tmp[1]); | 354 | pseg += (char)toupper(tmp[0]); pseg += (char)toupper(tmp[1]); |
355 | } | 355 | } |
356 | }else if(qf) { | 356 | }else if(qf) { |
357 | rv += pseg; rv += c; | 357 | rv += pseg; rv += c; |
358 | pseg.clear(); | 358 | pseg.clear(); |
359 | }else if(n>=ul || strchr("?/#",c)) { | 359 | }else if(n>=ul || strchr("?/#",c)) { |
360 | if(pseg.empty() || pseg==".") { | 360 | if(pseg.empty() || pseg==".") { |
361 | }else if(pseg=="..") { | 361 | }else if(pseg=="..") { |
362 | if(psegs.size()>1) { | 362 | if(psegs.size()>1) { |