diff options
-rw-r--r-- | auth_mellon_cache.c | 20 | ||||
-rw-r--r-- | auth_mellon_handler.c | 9 |
2 files changed, 26 insertions, 3 deletions
diff --git a/auth_mellon_cache.c b/auth_mellon_cache.c index e1593dd..749a817 100644 --- a/auth_mellon_cache.c +++ b/auth_mellon_cache.c @@ -38,6 +38,8 @@ am_cache_entry_t *am_cache_lock(server_rec *s, const char *key) am_mod_cfg_rec *mod_cfg; am_cache_entry_t *table; int i; + int rv; + char buffer[512]; /* Check if we have a valid session key. We abort if we don't. */ @@ -50,7 +52,13 @@ am_cache_entry_t *am_cache_lock(server_rec *s, const char *key) /* Lock the table. */ - apr_global_mutex_lock(mod_cfg->lock); + if((rv = apr_global_mutex_lock(mod_cfg->lock)) != APR_SUCCESS) { + ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, + "apr_global_mutex_lock() failed [%d]: %s", + rv, apr_strerror(rv, buffer, sizeof(buffer))); + return NULL; + } + table = apr_shm_baseaddr_get(mod_cfg->cache); @@ -95,6 +103,8 @@ am_cache_entry_t *am_cache_new(server_rec *s, const char *key) apr_time_t current_time; int i; apr_time_t age; + int rv; + char buffer[512]; /* Check if we have a valid session key. We abort if we don't. */ if(key == NULL || strlen(key) != AM_SESSION_ID_LENGTH) { @@ -115,7 +125,13 @@ am_cache_entry_t *am_cache_new(server_rec *s, const char *key) /* Lock the table. */ - apr_global_mutex_lock(mod_cfg->lock); + if((rv = apr_global_mutex_lock(mod_cfg->lock)) != APR_SUCCESS) { + ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, + "apr_global_mutex_lock() failed [%d]: %s", + rv, apr_strerror(rv, buffer, sizeof(buffer))); + return NULL; + } + table = apr_shm_baseaddr_get(mod_cfg->cache); /* Get current time. If we find a entry with expires <= the current diff --git a/auth_mellon_handler.c b/auth_mellon_handler.c index 3c1f578..4323de3 100644 --- a/auth_mellon_handler.c +++ b/auth_mellon_handler.c @@ -1304,9 +1304,16 @@ static int am_auth_new_ticket(request_rec *r) LassoSamlp2AuthnRequest *request; gint ret; char *redirect_to; + am_cache_entry_t *session; /* Create session. */ - am_release_request_session(r, am_new_request_session(r)); + session = am_new_request_session(r); + if(session == NULL) { + ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL, + "am_new_request_session() failed"); + return HTTP_INTERNAL_SERVER_ERROR; + } + am_release_request_session(r, session); server = am_get_lasso_server(r); |