summaryrefslogtreecommitdiffabout
path: root/lib
authorMichael Krelin <hacker@klever.net>2007-01-11 22:35:24 (UTC)
committer Michael Krelin <hacker@klever.net>2007-01-11 22:35:24 (UTC)
commitf6011d4bdd5a78414fba54c0985817fa8d4283e6 (patch) (side-by-side diff)
tree116e607667c0b83cec1362a6529dcd92ab74afb6 /lib
parentfc17a506a6647bae8fda0a9943a021a2103f6427 (diff)
downloadlibopkele-f6011d4bdd5a78414fba54c0985817fa8d4283e6.zip
libopkele-f6011d4bdd5a78414fba54c0985817fa8d4283e6.tar.gz
libopkele-f6011d4bdd5a78414fba54c0985817fa8d4283e6.tar.bz2
a fix
Diffstat (limited to 'lib') (more/less context) (show whitespace changes)
-rw-r--r--lib/consumer.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/consumer.cc b/lib/consumer.cc
index 10c2fa0..b215aa8 100644
--- a/lib/consumer.cc
+++ b/lib/consumer.cc
@@ -161,49 +161,49 @@ namespace opkele {
if(pin.has_param("openid.user_setup_url"))
throw id_res_setup(OPKELE_CP_ "assertion failed, setup url provided",pin.get_param("openid.user_setup_url"));
string server,delegate;
retrieve_links(identity.empty()?pin.get_param("openid.identity"):canonicalize(identity),server,delegate);
params_t ps;
try {
assoc_t assoc = retrieve_assoc(server,pin.get_param("openid.assoc_handle"));
const string& sigenc = pin.get_param("openid.sig");
mimetic::Base64::Decoder b;
vector<unsigned char> sig;
mimetic::decode(
sigenc.begin(),sigenc.end(), b,
back_insert_iterator<vector<unsigned char> >(sig) );
const string& slist = pin.get_param("openid.signed");
string kv;
string::size_type p = 0;
while(true) {
string::size_type co = slist.find(',',p);
string f = (co==string::npos)?slist.substr(p):slist.substr(p,co-p);
kv += f;
kv += ':';
f.insert(0,"openid.");
kv += pin.get_param(f);
kv += '\n';
- if(ext) ps[f.substr(sizeof("openid."))] = pin.get_param(f);
+ if(ext) ps[f.substr(sizeof("openid.")-1)] = pin.get_param(f);
if(co==string::npos)
break;
p = co+1;
}
secret_t secret = assoc->secret();
unsigned int md_len = 0;
unsigned char *md = HMAC(
EVP_sha1(),
&(secret.front()),secret.size(),
(const unsigned char *)kv.data(),kv.length(),
0,&md_len);
if(sig.size()!=md_len || memcmp(&(sig.front()),md,md_len))
throw id_res_mismatch(OPKELE_CP_ "signature mismatch");
}catch(failed_lookup& e) { /* XXX: more specific? */
const string& slist = pin.get_param("openid.signed");
string::size_type pp = 0;
params_t p;
while(true) {
string::size_type co = slist.find(',',pp);
string f = "openid.";
f += (co==string::npos)?slist.substr(pp):slist.substr(pp,co-pp);
p[f] = pin.get_param(f);
if(co==string::npos)
break;