summaryrefslogtreecommitdiffabout
path: root/lib
Side-by-side diff
Diffstat (limited to 'lib') (more/less context) (ignore whitespace changes)
-rw-r--r--lib/consumer.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/consumer.cc b/lib/consumer.cc
index 76b6ea7..f9212ea 100644
--- a/lib/consumer.cc
+++ b/lib/consumer.cc
@@ -121,25 +121,25 @@ namespace opkele {
string response;
CURLcode r;
(r=curl_misc_sets(curl))
|| (r=curl_easy_setopt(curl,CURLOPT_URL,server.c_str()))
|| (r=curl_easy_setopt(curl,CURLOPT_POST,1))
|| (r=curl_easy_setopt(curl,CURLOPT_POSTFIELDS,request.data()))
|| (r=curl_easy_setopt(curl,CURLOPT_POSTFIELDSIZE,request.length()))
|| (r=curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,_curl_tostring))
|| (r=curl_easy_setopt(curl,CURLOPT_WRITEDATA,&response))
;
if(r)
throw exception_curl(OPKELE_CP_ "failed to curl_easy_setopt()",r);
- if(r=curl_easy_perform(curl))
+ if( (r=curl_easy_perform(curl)) )
throw exception_curl(OPKELE_CP_ "failed to curl_easy_perform()",r);
params_t p; p.parse_keyvalues(response);
if(p.has_param("assoc_type") && p.get_param("assoc_type")!="HMAC-SHA1")
throw bad_input(OPKELE_CP_ "unsupported assoc_type");
string st;
if(p.has_param("session_type")) st = p.get_param("session_type");
if((!st.empty()) && st!="DH-SHA1")
throw bad_input(OPKELE_CP_ "unsupported session_type");
secret_t secret;
if(st.empty()) {
secret.from_base64(p.get_param("mac_key"));
}else{
@@ -281,25 +281,25 @@ namespace opkele {
string response;
CURLcode r;
(r=curl_misc_sets(curl))
|| (r=curl_easy_setopt(curl,CURLOPT_URL,server.c_str()))
|| (r=curl_easy_setopt(curl,CURLOPT_POST,1))
|| (r=curl_easy_setopt(curl,CURLOPT_POSTFIELDS,request.data()))
|| (r=curl_easy_setopt(curl,CURLOPT_POSTFIELDSIZE,request.length()))
|| (r=curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,_curl_tostring))
|| (r=curl_easy_setopt(curl,CURLOPT_WRITEDATA,&response))
;
if(r)
throw exception_curl(OPKELE_CP_ "failed to curl_easy_setopt()",r);
- if(r=curl_easy_perform(curl))
+ if( (r=curl_easy_perform(curl)) )
throw exception_curl(OPKELE_CP_ "failed to curl_easy_perform()",r);
params_t pp; pp.parse_keyvalues(response);
if(pp.has_param("invalidate_handle"))
invalidate_assoc(server,pp.get_param("invalidate_handle"));
if(pp.has_param("is_valid")) {
if(pp.get_param("is_valid")=="true")
return;
}else if(pp.has_param("lifetime")) {
if(util::string_to_long(pp.get_param("lifetime")))
return;
}
throw failed_check_authentication(OPKELE_CP_ "failed to verify response");