Skip to content

Commit 0c32d16

Browse files
committed
Pass just the pool to mag_error
This way this error reporting function can be used also when a request_rec is not available, like i the configuration phase. Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Robbie Harwood <rharwood@redhat.com> Reviewed-by: Isaac Boukris <iboukris@gmail.com>
1 parent c9e3ec5 commit 0c32d16

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

src/environ.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ static bool mag_get_name_attr(request_rec *req,
2828
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, req,
2929
"gss_get_name_attribute() failed on %.*s%s",
3030
(int)attr->name.length, (char *)attr->name.value,
31-
mag_error(req, "", maj, min));
31+
mag_error(req->pool, "", maj, min));
3232
return false;
3333
}
3434

@@ -209,7 +209,7 @@ void mag_get_name_attributes(request_rec *req, struct mag_config *cfg,
209209

210210
maj = gss_inquire_name(&min, name, NULL, NULL, &attrs);
211211
if (GSS_ERROR(maj)) {
212-
error = mag_error(req, "gss_inquire_name() failed", maj, min);
212+
error = mag_error(req->pool, "gss_inquire_name() failed", maj, min);
213213
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, req, "%s", error);
214214
apr_table_set(mc->env, "GSS_NAME_ATTR_ERROR", error);
215215
return;

src/mod_auth_gssapi.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ module AP_MODULE_DECLARE_DATA auth_gssapi_module;
2828

2929
APLOG_USE_MODULE(auth_gssapi);
3030

31-
static char *mag_status(request_rec *req, int type, uint32_t err)
31+
static char *mag_status(apr_pool_t *pool, int type, uint32_t err)
3232
{
3333
uint32_t maj_ret, min_ret;
3434
gss_buffer_desc text;
@@ -47,25 +47,25 @@ static char *mag_status(request_rec *req, int type, uint32_t err)
4747

4848
len = text.length;
4949
if (msg_ret) {
50-
msg_ret = apr_psprintf(req->pool, "%s, %*s",
50+
msg_ret = apr_psprintf(pool, "%s, %*s",
5151
msg_ret, len, (char *)text.value);
5252
} else {
53-
msg_ret = apr_psprintf(req->pool, "%*s", len, (char *)text.value);
53+
msg_ret = apr_psprintf(pool, "%*s", len, (char *)text.value);
5454
}
5555
gss_release_buffer(&min_ret, &text);
5656
} while (msg_ctx != 0);
5757

5858
return msg_ret;
5959
}
6060

61-
char *mag_error(request_rec *req, const char *msg, uint32_t maj, uint32_t min)
61+
char *mag_error(apr_pool_t *pool, const char *msg, uint32_t maj, uint32_t min)
6262
{
6363
char *msg_maj;
6464
char *msg_min;
6565

66-
msg_maj = mag_status(req, GSS_C_GSS_CODE, maj);
67-
msg_min = mag_status(req, GSS_C_MECH_CODE, min);
68-
return apr_psprintf(req->pool, "%s: [%s (%s)]", msg, msg_maj, msg_min);
66+
msg_maj = mag_status(pool, GSS_C_GSS_CODE, maj);
67+
msg_min = mag_status(pool, GSS_C_MECH_CODE, min);
68+
return apr_psprintf(pool, "%s: [%s (%s)]", msg, msg_maj, msg_min);
6969
}
7070

7171
enum mag_err_code {
@@ -98,7 +98,7 @@ static void mag_post_error(request_rec *req, struct mag_config *cfg,
9898
const char *text = NULL;
9999

100100
if (maj)
101-
text = mag_error(req, msg, maj, min);
101+
text = mag_error(req->pool, msg, maj, min);
102102

103103
if (cfg->enverrs)
104104
mag_publish_error(req, maj, min, text ? text : msg, mag_err_text(err));
@@ -288,7 +288,7 @@ static void mag_store_deleg_creds(request_rec *req, const char *ccname,
288288
GSS_C_NULL_OID, 1, 1, &store, NULL, NULL);
289289
if (GSS_ERROR(maj)) {
290290
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, req, "%s",
291-
mag_error(req, "failed to store delegated creds",
291+
mag_error(req->pool, "failed to store delegated creds",
292292
maj, min));
293293
}
294294
}
@@ -598,7 +598,7 @@ static bool mag_auth_basic(request_rec *req,
598598
if (maj != GSS_S_COMPLETE) {
599599
ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, req,
600600
"Failed to restore per-thread ccache, %s",
601-
mag_error(req, "gss_krb5_ccache_name() "
601+
mag_error(req->pool, "gss_krb5_ccache_name() "
602602
"failed", maj, min));
603603
}
604604
}

src/mod_auth_gssapi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,4 +136,4 @@ struct mag_conn {
136136

137137
struct mag_conn *mag_new_conn_ctx(apr_pool_t *pool);
138138
const char *mag_str_auth_type(int auth_type);
139-
char *mag_error(request_rec *req, const char *msg, uint32_t maj, uint32_t min);
139+
char *mag_error(apr_pool_t *pool, const char *msg, uint32_t maj, uint32_t min);

0 commit comments

Comments
 (0)