summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--auth_mellon.h7
-rw-r--r--auth_mellon_config.c7
-rw-r--r--auth_mellon_handler.c10
3 files changed, 23 insertions, 1 deletions
diff --git a/auth_mellon.h b/auth_mellon.h
index f99cf6f..192cff0 100644
--- a/auth_mellon.h
+++ b/auth_mellon.h
@@ -276,6 +276,13 @@ typedef struct am_envattr_conf_t {
extern const command_rec auth_mellon_commands[];
+typedef struct am_error_map_t {
+ int lasso_error;
+ int http_error;
+} am_error_map_t;
+
+extern const am_error_map_t auth_mellon_errormap[];
+
/* When using a value from a directory configuration structure, a special value is used
* to state "inherit" from parent, when reading a value and the value is still inherit from, it
* means that no value has ever been set for this directive, in this case, we use the default
diff --git a/auth_mellon_config.c b/auth_mellon_config.c
index 855330a..9b406e8 100644
--- a/auth_mellon_config.c
+++ b/auth_mellon_config.c
@@ -1205,6 +1205,13 @@ const command_rec auth_mellon_commands[] = {
{NULL}
};
+const am_error_map_t auth_mellon_errormap[] = {
+ { LASSO_PROFILE_ERROR_STATUS_NOT_SUCCESS, HTTP_UNAUTHORIZED },
+#ifdef LASSO_PROFILE_ERROR_REQUEST_DENIED
+ { LASSO_PROFILE_ERROR_REQUEST_DENIED, HTTP_UNAUTHORIZED },
+#endif
+ { 0, 0 }
+};
/* Release a lasso_server object associated with this configuration.
*
diff --git a/auth_mellon_handler.c b/auth_mellon_handler.c
index 1d42fd7..e5c82a6 100644
--- a/auth_mellon_handler.c
+++ b/auth_mellon_handler.c
@@ -1974,6 +1974,7 @@ static int am_handle_post_reply(request_rec *r)
LassoServer *server;
LassoLogin *login;
char *relay_state;
+ int i, err;
/* Make sure that this is a POST request. */
if(r->method_number != M_POST) {
@@ -2040,7 +2041,14 @@ static int am_handle_post_reply(request_rec *r)
" Lasso error: [%i] %s", rc, lasso_strerror(rc));
lasso_login_destroy(login);
- return HTTP_BAD_REQUEST;
+ err = HTTP_BAD_REQUEST;
+ for (i = 0; auth_mellon_errormap[i].lasso_error != 0; i++) {
+ if (auth_mellon_errormap[i].lasso_error == rc) {
+ err = auth_mellon_errormap[i].http_error;
+ break;
+ }
+ }
+ return err;
}
/* Extract RelayState parameter. */