summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--NEWS.xml1
-rw-r--r--lib/params.cc3
2 files changed, 3 insertions, 1 deletions
diff --git a/NEWS.xml b/NEWS.xml
index d8b93f2..210cf13 100644
--- a/NEWS.xml
+++ b/NEWS.xml
@@ -1,11 +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="0.1" date="January 12th, 2007"> 3 <version version="0.1" date="January 12th, 2007">
4 <ni>OpenID simple registration extension implementation</ni> 4 <ni>OpenID simple registration extension implementation</ni>
5 <ni>OpenID extensions framework</ni> 5 <ni>OpenID extensions framework</ni>
6 <ni>Canonicalization bugfix</ni> 6 <ni>Canonicalization bugfix</ni>
7 <ni>Slightly improved interoperability with buggy implementations</ni>
7 </version> 8 </version>
8 <version version="0.0" date="July 25th, 2005"> 9 <version version="0.0" date="July 25th, 2005">
9 <ni>Initial release</ni> 10 <ni>Initial release</ni>
10 </version> 11 </version>
11</news> 12</news>
diff --git a/lib/params.cc b/lib/params.cc
index 03867d5..b181811 100644
--- a/lib/params.cc
+++ b/lib/params.cc
@@ -20,33 +20,34 @@ namespace opkele {
20 iterator i = find(n); 20 iterator i = find(n);
21 if(i==end()) 21 if(i==end())
22 throw failed_lookup(OPKELE_CP_ n+": no such parameter"); 22 throw failed_lookup(OPKELE_CP_ n+": no such parameter");
23 return i->second; 23 return i->second;
24 } 24 }
25 25
26 void params_t::parse_keyvalues(const string& kv) { 26 void params_t::parse_keyvalues(const string& kv) {
27 clear(); 27 clear();
28 string::size_type p = 0; 28 string::size_type p = 0;
29 while(true) { 29 while(true) {
30 string::size_type co = kv.find(':',p); 30 string::size_type co = kv.find(':',p);
31 if(co==string::npos) 31 if(co==string::npos)
32 break; 32 break;
33 string::size_type nl = kv.find('\n',co+1); 33 string::size_type nl = kv.find('\n',co+1);
34 if(nl==string::npos) 34 if(nl==string::npos)
35 throw bad_input(OPKELE_CP_ "malformed input"); 35 throw bad_input(OPKELE_CP_ "malformed input");
36 insert(value_type(kv.substr(p,co-p),kv.substr(co+1,nl-co-1))); 36 if(nl>co)
37 insert(value_type(kv.substr(p,co-p),kv.substr(co+1,nl-co-1)));
37 p = nl+1; 38 p = nl+1;
38 } 39 }
39 } 40 }
40 41
41 void params_t::sign(secret_t secret,string& sig,const string& slist,const char *prefix) const { 42 void params_t::sign(secret_t secret,string& sig,const string& slist,const char *prefix) const {
42 string kv; 43 string kv;
43 string::size_type p = 0; 44 string::size_type p = 0;
44 while(true) { 45 while(true) {
45 string::size_type co = slist.find(',',p); 46 string::size_type co = slist.find(',',p);
46 string f = (co==string::npos)?slist.substr(p):slist.substr(p,co-p); 47 string f = (co==string::npos)?slist.substr(p):slist.substr(p,co-p);
47 kv += f; 48 kv += f;
48 kv += ':'; 49 kv += ':';
49 if(prefix) f.insert(0,prefix); 50 if(prefix) f.insert(0,prefix);
50 kv += get_param(f); 51 kv += get_param(f);
51 kv += '\n'; 52 kv += '\n';
52 if(co==string::npos) 53 if(co==string::npos)