From 9203a7a6e593c63e8913bbfcf47f95e8eff58b2b Mon Sep 17 00:00:00 2001 From: Jan Pazdziora Date: Wed, 23 Nov 2016 08:52:18 +0100 Subject: Prefer ap_log_rerror for messages related to a particular request. --- mod_intercept_form_submit.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/mod_intercept_form_submit.c b/mod_intercept_form_submit.c index bc6ca38..f2905e4 100644 --- a/mod_intercept_form_submit.c +++ b/mod_intercept_form_submit.c @@ -172,7 +172,7 @@ static authn_status pam_authenticate_in_realms(request_rec * r, const char * pam #define _REDACTED_STRING "[REDACTED]" static void intercept_form_redact_password(ap_filter_t * f, ifs_config * config) { request_rec * r = f->r; - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "will redact password (value of %s) in the POST data", config->password_name); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "will redact password (value of %s) in the POST data", config->password_name); ifs_filter_ctx_t * ctx = f->ctx; apr_bucket * b = ctx->password_fragment_start_bucket; int fragment_start_bucket_offset = ctx->password_fragment_start_bucket_offset; @@ -226,7 +226,7 @@ static void intercept_form_redact_password(ap_filter_t * f, ifs_config * config) apr_off_t content_length; apr_status_t status = apr_strtoff(&content_length, orig_content_length, &end, 10); if (status != APR_SUCCESS || *end || end == orig_content_length || content_length < 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, "Failed to parse the original Content-Length value %s, cannot update it after redacting password, clearing", orig_content_length); + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "Failed to parse the original Content-Length value %s, cannot update it after redacting password, clearing", orig_content_length); apr_table_unset(r->headers_in, "Content-Length"); } else { apr_table_setn(r->headers_in, "Content-Length", apr_psprintf(r->pool, "%ld", content_length - password_remove_length + new_password_data_length)); @@ -247,10 +247,10 @@ static int intercept_form_submit_process_buffer(ap_filter_t * f, ifs_config * co *login_value = intercept_form_submit_process_keyval(r->pool, config->login_name, buffer, sep - buffer, sep + 1, buffer_length - (sep - buffer) - 1); if (*login_value) { - ap_log_error(APLOG_MARK, APLOG_INFO, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, "mod_intercept_form_submit: login found in POST: %s=%s", config->login_name, *login_value); if (config->login_blacklist && apr_hash_get(config->login_blacklist, *login_value, APR_HASH_KEY_STRING)) { - ap_log_error(APLOG_MARK, APLOG_INFO, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, "mod_intercept_form_submit: login %s in blacklist, stopping", *login_value); if (config->clear_blacklisted > 0) { apr_table_unset(r->subprocess_env, _REMOTE_USER_ENV_NAME); @@ -267,7 +267,7 @@ static int intercept_form_submit_process_buffer(ap_filter_t * f, ifs_config * co *password_value = intercept_form_submit_process_keyval(r->pool, config->password_name, buffer, sep - buffer, sep + 1, buffer_length - (sep - buffer) - 1); if (*password_value) { - ap_log_error(APLOG_MARK, APLOG_INFO, 0, r->server, + ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, "mod_intercept_form_submit: password found in POST: %s=" _REDACTED_STRING, config->password_name); if (*login_value) { run_auth = 1; @@ -279,7 +279,7 @@ static int intercept_form_submit_process_buffer(ap_filter_t * f, ifs_config * co } if (run_auth) { if (! pam_authenticate_with_login_password_fn) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, "mod_intercept_form_submit: pam_authenticate_with_login_password not found; perhaps mod_authnz_pam is not loaded"); + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "mod_intercept_form_submit: pam_authenticate_with_login_password not found; perhaps mod_authnz_pam is not loaded"); return 0; } (*out_status) = pam_authenticate_in_realms(r, config->pam_service, *login_value, *password_value, config->realms, 3); @@ -339,7 +339,7 @@ static apr_status_t intercept_form_submit_filter_prefetch(request_rec * r, ifs_c if (fragment) intercept_form_submit_process_buffer(f, config, &login_value, &password_value, fragment, fragment_length, fragment_start_bucket, fragment_start_bucket_offset, &out_status); - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "hit EOS"); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "hit EOS"); fetch_more = 0; break; } @@ -407,18 +407,18 @@ static apr_status_t intercept_form_submit_filter_prefetch(request_rec * r, ifs_c #define _INTERCEPT_CONTENT_TYPE "application/x-www-form-urlencoded" static apr_status_t intercept_form_submit_init(request_rec * r) { - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "intercept_form_submit_init invoked"); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "intercept_form_submit_init invoked"); if (r->method_number != M_POST) { - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "skipping, no POST request"); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "skipping, no POST request"); return DECLINED; } ifs_config * config = ap_get_module_config(r->per_dir_config, &intercept_form_submit_module); if (!(config && config->login_name && config->password_name && config->pam_service)) { - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "skipping, not configured"); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "skipping, not configured"); return DECLINED; } if (apr_table_get(r->subprocess_env, _REMOTE_USER_ENV_NAME)) { - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "skipping, " _REMOTE_USER_ENV_NAME " already set"); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "skipping, " _REMOTE_USER_ENV_NAME " already set"); return DECLINED; } const char * content_type = apr_table_get(r->headers_in, "Content-Type"); @@ -431,10 +431,10 @@ static apr_status_t intercept_form_submit_init(request_rec * r) { apr_collapse_spaces(content_type_pure, content_type_pure); if (!apr_strnatcasecmp(content_type_pure, _INTERCEPT_CONTENT_TYPE)) { ap_filter_t * the_filter = ap_add_input_filter("intercept_form_submit_filter", NULL, r, r->connection); - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "inserted filter intercept_form_submit_filter, starting intercept_form_submit_filter_prefetch"); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "inserted filter intercept_form_submit_filter, starting intercept_form_submit_filter_prefetch"); apr_status_t status = intercept_form_submit_filter_prefetch(r, config, the_filter); if (status == OK && config->success_to_get >= 0) { - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "intercept_form_submit_filter_prefetch returned OK, turning the method to GET"); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "intercept_form_submit_filter_prefetch returned OK, turning the method to GET"); r->status_line = NULL; r->method = "GET"; r->method_number = M_GET; @@ -443,7 +443,7 @@ static apr_status_t intercept_form_submit_init(request_rec * r) { return DECLINED; } } - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "skipping, no " _INTERCEPT_CONTENT_TYPE); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "skipping, no " _INTERCEPT_CONTENT_TYPE); return DECLINED; } -- cgit