You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by be...@apache.org on 2004/04/11 20:36:58 UTC

cvs commit: httpd-2.0/server gen_test_char.c

ben         2004/04/11 11:36:58

  Modified:    modules/loggers Tag: APACHE_2_0_BRANCH config.m4
               server   Tag: APACHE_2_0_BRANCH gen_test_char.c
  Added:       modules/loggers Tag: APACHE_2_0_BRANCH mod_log_forensic.c
  Log:
  Add mod_log_forensic.
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.5.2.1   +7 -0      httpd-2.0/modules/loggers/config.m4
  
  Index: config.m4
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/loggers/config.m4,v
  retrieving revision 1.5
  retrieving revision 1.5.2.1
  diff -u -r1.5 -r1.5.2.1
  --- config.m4	28 Sep 2002 04:18:35 -0000	1.5
  +++ config.m4	11 Apr 2004 18:36:58 -0000	1.5.2.1
  @@ -6,6 +6,13 @@
   	
   APACHE_MODULE(log_config, logging configuration, , , yes)
   
  +APACHE_MODULE(log_forensic, forensic logging)
  +
  +if test "x$enable_log_forensic" != "xno"; then
  +    # mod_log_forensic needs test_char.h
  +    APR_ADDTO(INCLUDES, [-I\$(top_builddir)/server])
  +fi   
  +
   APACHE_MODULE(logio, input and output logging, , , no)
   
   APACHE_MODPATH_FINISH
  
  
  
  No                   revision
  
  Index: config.m4
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/loggers/config.m4,v
  retrieving revision 1.5
  retrieving revision 1.5.2.1
  diff -u -r1.5 -r1.5.2.1
  --- config.m4	28 Sep 2002 04:18:35 -0000	1.5
  +++ config.m4	11 Apr 2004 18:36:58 -0000	1.5.2.1
  @@ -6,6 +6,13 @@
   	
   APACHE_MODULE(log_config, logging configuration, , , yes)
   
  +APACHE_MODULE(log_forensic, forensic logging)
  +
  +if test "x$enable_log_forensic" != "xno"; then
  +    # mod_log_forensic needs test_char.h
  +    APR_ADDTO(INCLUDES, [-I\$(top_builddir)/server])
  +fi   
  +
   APACHE_MODULE(logio, input and output logging, , , no)
   
   APACHE_MODPATH_FINISH
  
  
  
  No                   revision
  
  Index: config.m4
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/loggers/config.m4,v
  retrieving revision 1.5
  retrieving revision 1.5.2.1
  diff -u -r1.5 -r1.5.2.1
  --- config.m4	28 Sep 2002 04:18:35 -0000	1.5
  +++ config.m4	11 Apr 2004 18:36:58 -0000	1.5.2.1
  @@ -6,6 +6,13 @@
   	
   APACHE_MODULE(log_config, logging configuration, , , yes)
   
  +APACHE_MODULE(log_forensic, forensic logging)
  +
  +if test "x$enable_log_forensic" != "xno"; then
  +    # mod_log_forensic needs test_char.h
  +    APR_ADDTO(INCLUDES, [-I\$(top_builddir)/server])
  +fi   
  +
   APACHE_MODULE(logio, input and output logging, , , no)
   
   APACHE_MODPATH_FINISH
  
  
  
  1.18.2.1  +3 -4      httpd-2.0/modules/loggers/mod_log_forensic.c
  
  Index: mod_log_forensic.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/loggers/mod_log_forensic.c,v
  retrieving revision 1.18
  retrieving revision 1.18.2.1
  diff -u -r1.18 -r1.18.2.1
  --- mod_log_forensic.c	21 Feb 2004 17:09:20 -0000	1.18
  +++ mod_log_forensic.c	11 Apr 2004 18:36:58 -0000	1.18.2.1
  @@ -41,8 +41,6 @@
       apr_file_t *fd;
   } fcfg;
   
  -static apr_uint32_t next_id;
  -
   static void *make_forensic_log_scfg(apr_pool_t *p, server_rec *s)
   {
       fcfg *cfg = apr_pcalloc(p, sizeof *cfg);
  @@ -192,8 +190,9 @@
       if (!(id = apr_table_get(r->subprocess_env, "UNIQUE_ID"))) {
           /* we make the assumption that we can't go through all the PIDs in
              under 1 second */
  -        id = apr_psprintf(r->pool, "%x:%lx:%x", getpid(), time(NULL),
  -                          apr_atomic_inc32(&next_id));
  +        ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
  +                    "mod_log_forensic: mod_unique_id must also be active");
  +	return DECLINED;
       }
       ap_set_module_config(r->request_config, &log_forensic_module, (char *)id);
   
  
  
  
  No                   revision
  No                   revision
  1.14.2.6  +12 -1     httpd-2.0/server/gen_test_char.c
  
  Index: gen_test_char.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/gen_test_char.c,v
  retrieving revision 1.14.2.5
  retrieving revision 1.14.2.6
  diff -u -r1.14.2.5 -r1.14.2.6
  --- gen_test_char.c	9 Feb 2004 20:59:45 -0000	1.14.2.5
  +++ gen_test_char.c	11 Apr 2004 18:36:58 -0000	1.14.2.6
  @@ -31,6 +31,7 @@
   #define T_OS_ESCAPE_PATH      (0x04)
   #define T_HTTP_TOKEN_STOP     (0x08)
   #define T_ESCAPE_LOGITEM      (0x10)
  +#define T_ESCAPE_FORENSIC     (0x20)
   
   int main(int argc, char *argv[])
   {
  @@ -44,6 +45,7 @@
              "#define T_OS_ESCAPE_PATH       (%u)\n"
              "#define T_HTTP_TOKEN_STOP      (%u)\n"
              "#define T_ESCAPE_LOGITEM       (%u)\n"
  +           "#define T_ESCAPE_FORENSIC      (%u)\n"
              "\n"
              "static const unsigned char test_char_table[256] = {\n"
              "    0,",
  @@ -51,7 +53,8 @@
              T_ESCAPE_PATH_SEGMENT,
              T_OS_ESCAPE_PATH,
              T_HTTP_TOKEN_STOP,
  -           T_ESCAPE_LOGITEM);
  +           T_ESCAPE_LOGITEM,
  +	   T_ESCAPE_FORENSIC);
   
       /* we explicitly dealt with NUL above
        * in case some strchr() do bogosity with it */
  @@ -102,6 +105,14 @@
            */
           if (!apr_isprint(c) || c == '"' || c == '\\' || apr_iscntrl(c)) {
               flags |= T_ESCAPE_LOGITEM;
  +        }
  +
  +        /* For forensic logging, escape all control characters, top bit set,
  +         * :, | (used as delimiters) and % (used for escaping).
  +         */
  +        if (!apr_isprint(c) || c == ':' || c == '|' || c == '%'
  +            || apr_iscntrl(c) || !c) {
  +            flags |= T_ESCAPE_FORENSIC;
           }
   
           printf("%u%c", flags, (c < 255) ? ',' : ' ');