commit 2c2e19d96069f2d94d6c68f50e3ef2175a412cfb
Author: Olav Morken <olav.morken@uninett.no>
Date: Tue Aug 8 14:34:24 2017 +0200
Fix incorrect error check for many `lasso_*`-functions.
Several places in the code we assumed that Lasso error codes were
negative, however some of them are positive integers. This patch
ensures that we do direct check for a zero return code in all cases.
Fixes issue #128.
diff --git a/auth_mellon_handler.c b/auth_mellon_handler.c
index 70462a7..5661083 100644
--- a/auth_mellon_handler.c
+++ b/auth_mellon_handler.c
@@ -640,7 +640,7 @@ static void am_restore_lasso_profile_state(request_rec *r,
identity_dump = am_cache_get_lasso_identity(am_session);
if(identity_dump != NULL) {
rc = lasso_profile_set_identity_from_dump(profile, identity_dump);
- if(rc < 0) {
+ if(rc != 0) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
"Could not restore identity from dump."
" Lasso error: [%i] %s", rc, lasso_strerror(rc));
@@ -651,7 +651,7 @@ static void am_restore_lasso_profile_state(request_rec *r,
session_dump = am_cache_get_lasso_session(am_session);
if(session_dump != NULL) {
rc = lasso_profile_set_session_from_dump(profile, session_dump);
- if(rc < 0) {
+ if(rc != 0) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
"Could not restore session from dump."
" Lasso error: [%i] %s", rc, lasso_strerror(rc));
@@ -1842,7 +1842,7 @@ static int am_handle_reply_common(request_rec *r, LassoLogin *login,
}
rc = lasso_login_accept_sso(login);
- if(rc < 0) {
+ if(rc != 0) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
"Unable to accept SSO message."
" Lasso error: [%i] %s", rc, lasso_strerror(rc));
@@ -2157,7 +2157,7 @@ static int am_handle_artifact_reply(request_rec *r)
rc = lasso_login_init_request(login, r->args,
LASSO_HTTP_METHOD_ARTIFACT_GET);
- if(rc < 0) {
+ if(rc != 0) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
"Failed to handle login response."
" Lasso error: [%i] %s", rc, lasso_strerror(rc));
@@ -2181,7 +2181,7 @@ static int am_handle_artifact_reply(request_rec *r)
ap_unescape_url(saml_art);
rc = lasso_login_init_request(login, saml_art, LASSO_HTTP_METHOD_ARTIFACT_POST);
- if(rc < 0) {
+ if(rc != 0) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
"Failed to handle login response."
" Lasso error: [%i] %s", rc, lasso_strerror(rc));
@@ -2192,7 +2192,7 @@ static int am_handle_artifact_reply(request_rec *r)
/* Prepare SOAP request. */
rc = lasso_login_build_request_msg(login);
- if(rc < 0) {
+ if(rc != 0) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
"Failed to prepare SOAP message for HTTP-Artifact"
" resolution."