Index: modules/generators/mod_status.c =================================================================== --- modules/generators/mod_status.c (revision 1771119) +++ modules/generators/mod_status.c (working copy) @@ -89,6 +89,10 @@ static int server_limit, thread_limit, threads_per_child, max_servers, is_async; +typedef struct { + int privacy_mode; +} status_config; + /* Implement 'ap_run_status_hook'. */ APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ap, STATUS, int, status_hook, (request_rec *r, int flags), @@ -674,6 +678,10 @@ } if (ap_extended_status && !short_report) { + status_config *config = (status_config *) ap_get_module_config(r->per_dir_config, + &status_module); + if (config->privacy_mode) + ap_rputs("\nClient IP removed due to privacy mode set.\n\n", r); if (no_table_report) ap_rputs("

Server Details

\n\n", r); else @@ -687,7 +695,6 @@ "ConnChildSlot" "ClientProtocolVHost" "Request\n\n", r); - for (i = 0; i < server_limit; ++i) { for (j = 0; j < thread_limit; ++j) { ap_copy_scoreboard_worker(ws_record, i, j); @@ -800,9 +807,10 @@ ap_rputs(")\n", r); ap_rprintf(r, " %s {%s} (%s) [%s]
\n\n", + config->privacy_mode ? "" + : ap_escape_html(r->pool, + ws_record->client), ap_escape_html(r->pool, - ws_record->client), - ap_escape_html(r->pool, ap_escape_logitem(r->pool, ws_record->request)), ap_escape_html(r->pool, @@ -887,9 +895,10 @@ ap_rprintf(r, "%s%s%s" "%s\n\n", + config->privacy_mode ? "" + : ap_escape_html(r->pool, + ws_record->client), ap_escape_html(r->pool, - ws_record->client), - ap_escape_html(r->pool, ws_record->protocol), ap_escape_html(r->pool, ws_record->vhost), @@ -992,6 +1001,34 @@ } #endif +const char *privacy_mode_set_enabled(cmd_parms *cmd, void *cfg, const char *arg) +{ + status_config *config = (status_config *) cfg; + if(!strcasecmp(arg, "on")) + config->privacy_mode = 1; + else + config->privacy_mode = 0; + return NULL; +} + +void *create_dir_conf(apr_pool_t *pool, char *dummy) +{ + status_config *cfg = apr_pcalloc(pool, sizeof(status_config)); + if (cfg) { + cfg->privacy_mode = 0; + } + return cfg; +} + +void *merge_dir_conf(apr_pool_t *pool, void *BASE, void *ADD) +{ + status_config *add = (status_config *) ADD; + status_config *base = (status_config *) BASE; + status_config *conf = (status_config *) create_dir_conf(pool, NULL); + conf->privacy_mode = add->privacy_mode; + return add; +} + static void register_hooks(apr_pool_t *p) { ap_hook_handler(status_handler, NULL, NULL, APR_HOOK_MIDDLE); @@ -1002,13 +1039,20 @@ #endif } +static const command_rec status_directives[] = +{ + AP_INIT_TAKE1("PrivacyStatus", privacy_mode_set_enabled, NULL, RSRC_CONF|ACCESS_CONF, + "Enable or disable Privacy Mode for mod-status"), + { NULL } +}; + AP_DECLARE_MODULE(status) = { STANDARD20_MODULE_STUFF, - NULL, /* dir config creater */ - NULL, /* dir merger --- default is to override */ + create_dir_conf, /* dir config creater */ + merge_dir_conf, /* dir merger --- default is to override */ NULL, /* server config */ NULL, /* merge server config */ - NULL, /* command table */ + status_directives, /* command table */ register_hooks /* register_hooks */ };