www-apache-bugdb mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <dgau...@arctic.org>
Subject Re: mod_log-any/2366: DNS lookup in logs reports host, first number in dotted quads
Date Mon, 08 Jun 1998 06:20:01 GMT
The following reply was made to PR mod_log-any/2366; it has been noted by GNATS.

From: Dean Gaudet <dgaudet@arctic.org>
To: Glenn Fleishman <glenn@glenns.org>
Cc: apbugs@apache.org
Subject: Re: mod_log-any/2366: DNS lookup in logs reports host, first number in dotted quads
Date: Sun, 7 Jun 1998 23:15:22 -0700 (PDT)

 Ack.  Barf.  I'm sorry to make you go through so much work.  It turns out
 the problem is elsewhere completely... mod_usertrack was corrupting the
 hostname... which explains exactly the behaviour you saw -- when it
 generates a new cookie it corrupts the hostname.  Subsequent requests
 include the cookie, so the code doesn't corrupt the hostname. 
 
 Try this patch. 
 
 Dean
 
 Index: modules/standard/mod_usertrack.c
 ===================================================================
 RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_usertrack.c,v
 retrieving revision 1.34
 diff -u -r1.34 mod_usertrack.c
 --- mod_usertrack.c	1998/04/11 12:00:53	1.34
 +++ mod_usertrack.c	1998/06/08 06:08:56
 @@ -137,13 +137,9 @@
      /* 1024 == hardcoded constant */
      char cookiebuf[1024];
      char *new_cookie;
 -    char *dot;
      const char *rname = ap_get_remote_host(r->connection, r->per_dir_config,
  					REMOTE_NAME);
  
 -    if ((dot = strchr(rname, '.')))
 -        *dot = '\0';            /* First bit of hostname */
 -
  #if defined(NO_GETTIMEOFDAY) && !defined(NO_TIMES)
  /* We lack gettimeofday(), so we must use time() to obtain the epoch
     seconds, and then times() to obtain CPU clock ticks (milliseconds).
 @@ -151,7 +147,7 @@
  
      mpe_times = times(&mpe_tms);
  
 -    ap_snprintf(cookiebuf, sizeof(cookiebuf), "%s%d%ld%ld", rname, (int) getpid(),
 +    ap_snprintf(cookiebuf, sizeof(cookiebuf), "%s.%d%ld%ld", rname, (int) getpid(),
                  (long) r->request_time, (long) mpe_tms.tms_utime);
  #elif defined(WIN32)
      /*
 @@ -160,13 +156,13 @@
       * was started. It should be relatively unique.
       */
  
 -    ap_snprintf(cookiebuf, sizeof(cookiebuf), "%s%d%ld%ld", rname, (int) getpid(),
 +    ap_snprintf(cookiebuf, sizeof(cookiebuf), "%s.%d%ld%ld", rname, (int) getpid(),
                  (long) r->request_time, (long) GetTickCount());
  
  #else
      gettimeofday(&tv, &tz);
  
 -    ap_snprintf(cookiebuf, sizeof(cookiebuf), "%s%d%ld%d", rname, (int) getpid(),
 +    ap_snprintf(cookiebuf, sizeof(cookiebuf), "%s.%d%ld%d", rname, (int) getpid(),
                  (long) tv.tv_sec, (int) tv.tv_usec / 1000);
  #endif
  
 
 

Mime
View raw message