httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chuck Murcko <ch...@telebase.com>
Subject Re: access_log
Date Sun, 05 May 1996 10:44:10 GMT
There was a patch posted by Brian to mod_cookies.c which fixed this.
I'm not sure if this is committed yet; I hope to have a working
SOCKSified bastion host here at home today so I can check.

Aram Mirzadeh liltingly intones:
> 
> 
> Has anyone had any problems with their access_file & hostnames ? 
> 
> I'm getting some strange results: 
> 
> ...trunc'ed hostname examples
> 
Brian's patch follows:

D'oh!  from mod_cookies.c:

void make_cookie(request_rec *r)
{
    struct timeval tv;
    char new_cookie[100];       /* blurgh */
    char *dot;
    const char *rname = get_remote_host(r->connection, r->per_dir_config,
                                  REMOTE_NAME);
    struct timezone tz = { 0 , 0 };

    if ((dot = strchr(rname,'.'))) *dot='\0';   /* First bit of hostname */
    gettimeofday(&tv, &tz);
    sprintf(new_cookie,"%s%s%d%ld%d; path=/",
        COOKIE_NAME, rname,
        (int)getpid(),
        (long)tv.tv_sec, (int)tv.tv_usec/1000 );

    table_set(r->headers_out,"Set-Cookie",new_cookie);
    return;
}


get_remote_host returns a pointer directly into the conn structure, 
so the strchr truncates it.  Eeek. 

Should it be fixed by having the subroutine do a pstrdup, 
or should get_remote_host return a copy of the string instead?  I think 
the former, something might depend on the behavior of the latter....

        Brian

chuck
Chuck Murcko	N2K Inc.	Wayne PA	chuck@telebase.com
And now, on a lighter note:
Whenever anyone says, "theoretically", they really mean, "not really".
		-- Dave Parnas

Mime
View raw message