httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <dgau...@arctic.org>
Subject Re: WWW Form Bug Report: "Missing "authuser" (%u) field in common log format if status code is 401" on Solaris 2.x
Date Sat, 04 Jan 1997 01:42:33 GMT
Common Log Format sucks for this reason, and others.  I've never
understood why it doesn't have a standard record delimiter.  For
hotwired's logs I write with | as the delimiter, and all fields have
appropriate things %-escaped so that one layer of %-unescaping returns
exactly the original strings.  It's so bloody nice to be able to use cut,
join, sort, and so on right from the unix prompt. 

Dean

On Fri, 3 Jan 1997, Rodent of Unusual Size wrote:

> >Submitter: wikne@lynx.uio.no
> >
> >Symptoms:
> >--
> >The "authuser" field is blank in common log format
> >if authorization is applied, and the remote user
> >specifies a password, but leaves UID blank.
> >NCSA inserts a "-" here, same as Apache does if
> >_both_ password and UID are left blank when a
> >protected document is requested.
> >Somewhere in the documentation it is mentioned
> >that the %u field of customized logging "may be
> >bogus" in case of a 401 error. I assume this may
> >refer to a situation where a user enters some
> >rubbish for a UID. But I see no reason why the
> >two above mentioned cases, both with _blank_ UID,
> >should be treated differently when applying common
> >log format.
> >This behaviour is annoying to me, as the missing
> >"-" causes some logfile analyzing programs to
> >go bananas....
> 
>     Here are two patches (mod_log_config.c and mod_rewrite.c) to address the
>     case of a null (as opposed to missing) connection->user field.  Rather
>     than emitting the empty string (which was what the userID *is*, but causes
>     the problem reported), or "-" (which is clearly wrong, since there *is* an
>     userID), it emits an empty quoted string ("\"\"").  This at least
>     maintains the place in the log entry, and indicates that an empty userID
>     was supplied.
> 
>     This actually raises an interesting question: should the remote user field
>     *always* be quoted in logfiles if it's not null?  What about userIDs that
>     contain spaces, or other pathological cases?  Unfortunately, doing so
>     would probably break existing user-tracking based upon ruser entries in
>     the logs, since ruser FOO would suddenly be listed as "FOO"..
> 
>     #ken    :-)}
> 
> ===================================================================
> RCS file: RCS/mod_log_config.c,v
> retrieving revision 1.1
> diff -c3 -r1.1 mod_log_config.c
> *** 1.1	1997/01/03 12:08:25
> --- mod_log_config.c	1997/01/03 12:53:54
> ***************
> *** 242,250 ****
>   char *log_remote_logname(request_rec *r, char *a)
>   {return (char *)get_remote_logname(r);}
>   
> ! char *log_remote_user (request_rec *r, char *a)
> ! { return r->connection->user; }
>   
>   char *log_request_line (request_rec *r, char *a)
>   { return r->the_request; }
>   
> --- 242,258 ----
>   char *log_remote_logname(request_rec *r, char *a)
>   {return (char *)get_remote_logname(r);}
>   
> ! char *log_remote_user (request_rec *r, char *a) { 
> !     char *rvalue = r->connection->user;
>   
> +     if (rvalue == NULL) {
> +         rvalue = "-";
> +     } else if (strlen (rvalue) == 0) {
> +         rvalue = "\"\"";
> +     }
> +     return rvalue;
> + }
> + 
>   char *log_request_line (request_rec *r, char *a)
>   { return r->the_request; }
>   
> ===================================================================
> RCS file: RCS/mod_rewrite.c,v
> retrieving revision 1.2
> diff -c3 -r1.2 mod_rewrite.c
> *** 1.2	1996/12/31 13:49:19
> --- mod_rewrite.c	1997/01/03 12:31:19
> ***************
> *** 2177,2182 ****
> --- 2177,2183 ----
>       static char str3[HUGE_STRING_LEN];
>       static char type[20];
>       static char redir[20];
> +     char *ruser;
>       va_list ap;
>       int i;
>       request_rec *req;
> ***************
> *** 2195,2203 ****
>       if (level > conf->rewriteloglevel)
>           return;
>   
>       str1 = pstrcat(r->pool, get_remote_host(connect, r->server->module_config,
REMOTE_NAME), " ",
>                               (connect->remote_logname != NULL ? connect->remote_logname
: "-"), " ",
> !                             (connect->user != NULL ? connect->user : "-"),
>                               NULL);
>       vsprintf(str2, text, ap);
>   
> --- 2196,2211 ----
>       if (level > conf->rewriteloglevel)
>           return;
>   
> +     if (connect->user == NULL) {
> +         ruser = "-";
> +     } else if (strlen (connect->user) != 0) {
> +         ruser = connect->user;
> +     } else {
> +         ruser = "\"\"";
> +     };
>       str1 = pstrcat(r->pool, get_remote_host(connect, r->server->module_config,
REMOTE_NAME), " ",
>                               (connect->remote_logname != NULL ? connect->remote_logname
: "-"), " ",
> !                             ruser,
>                               NULL);
>       vsprintf(str2, text, ap);
>   
> 


Mime
View raw message