diff -Nur httpd-2.2.2-old/modules/loggers/config.m4 httpd-2.2.2-new/modules/loggers/config.m4 --- httpd-2.2.2-old/modules/loggers/config.m4 2004-11-21 20:50:36.000000000 +0200 +++ httpd-2.2.2-new/modules/loggers/config.m4 2008-05-19 15:06:08.000000000 +0300 @@ -14,4 +14,6 @@ APACHE_MODULE(logio, input and output logging, , , most) +APACHE_MODULE(loguid, child uid and gid logging, , , most) + APACHE_MODPATH_FINISH diff -Nur httpd-2.2.2-old/modules/loggers/mod_loguid.c httpd-2.2.2-new/modules/loggers/mod_loguid.c --- httpd-2.2.2-old/modules/loggers/mod_loguid.c 1970-01-01 03:00:00.000000000 +0300 +++ httpd-2.2.2-new/modules/loggers/mod_loguid.c 2008-05-19 15:31:43.000000000 +0300 @@ -0,0 +1,91 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Based on mod_logio written by Bojan Smojver + * Modified by Taavi Sannik : + * + * The argument to LogFormat and CustomLog is a string, which can include + * literal characters copied into the log files, and '%' directives as + * follows: + * + * %...S: Child's user id + * %...G: Child's group id + * + */ + +#include "apr_strings.h" +#include "apr_lib.h" +#include "apr_hash.h" +#include "apr_optional.h" + +#define APR_WANT_STRFUNC +#include "apr_want.h" + +#include "ap_config.h" +#include "mod_log_config.h" +#include "httpd.h" +#include "http_core.h" +#include "http_config.h" +#include "http_connection.h" +#include "http_protocol.h" +#include "unistd.h" + +module AP_MODULE_DECLARE_DATA loguid_module; + +/* + * Format items... + */ + +static const char *log_uid(request_rec *r, char *a) +{ + return apr_itoa(r->pool, geteuid()); +} + +static const char *log_gid(request_rec *r, char *a) +{ + return apr_itoa(r->pool, getegid()); +} + +static int loguid_pre_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp) +{ + static APR_OPTIONAL_FN_TYPE(ap_register_log_handler) *log_pfn_register; + + log_pfn_register = APR_RETRIEVE_OPTIONAL_FN(ap_register_log_handler); + + if (log_pfn_register) { + log_pfn_register(p, "S", log_uid, 0); + log_pfn_register(p, "G", log_gid, 0); + } + + return OK; +} + +static void register_hooks(apr_pool_t *p) +{ + ap_hook_pre_config(loguid_pre_config, NULL, NULL, APR_HOOK_REALLY_FIRST); +} + +module AP_MODULE_DECLARE_DATA loguid_module = +{ + STANDARD20_MODULE_STUFF, + NULL, /* create per-dir config */ + NULL, /* merge per-dir config */ + NULL, /* server config */ + NULL, /* merge server config */ + NULL, /* command apr_table_t */ + register_hooks /* register hooks */ +};