You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Dean Gaudet <dg...@arctic.org> on 1998/02/03 07:38:04 UTC

directory_walk bug?

directory_walk looks like this:

    test_filename = pstrdup(r->pool, r->filename);

    if (!os_is_path_absolute(test_filename))
    {
	...
    }

    r->filename   = os_canonical_filename(r->pool, r->filename);
    no2slash(test_filename);
    num_dirs = count_dirs(test_filename);

    ...

I believe that there's a bug.  I think that test_filename is
probably supposed to be a copy of the r->filename after
the os_canonical_filename.  test_filename is what's actually
used to do all the comparisons later on.

It's only an issue on win32 presently...

Dean


Re: directory_walk bug?

Posted by Ben Laurie <be...@algroup.co.uk>.
Dean Gaudet wrote:
> 
> On Thu, 5 Feb 1998, Ben Laurie wrote:
> 
> > Dean Gaudet wrote:
> > >
> > > directory_walk looks like this:
> > >
> > >     test_filename = pstrdup(r->pool, r->filename);
> > >
> > >     if (!os_is_path_absolute(test_filename))
> > >     {
> > >         ...
> > >     }
> > >
> > >     r->filename   = os_canonical_filename(r->pool, r->filename);
> > >     no2slash(test_filename);
> > >     num_dirs = count_dirs(test_filename);
> > >
> > >     ...
> > >
> > > I believe that there's a bug.  I think that test_filename is
> > > probably supposed to be a copy of the r->filename after
> > > the os_canonical_filename.  test_filename is what's actually
> > > used to do all the comparisons later on.
> >
> > Hmmm... if only I could remember which way round it was before we move
> > the os_canonical_filename. However, I'm inclined to agree.
> 
> Well we definately don't want the os_canonical_filename before that if
> block, because that if block is for the proxy.  I just figure that
> it should be something like:
> 
>     if (!os_is_path_absolute(r->filename))
>     {
>         test_filename = pstrdup(r->pool, r->filename);
>         ...
>     }
> 
>     r->filename   = os_canonical_filename(r->pool, r->filename);
>     test_filename = pstrdup(r->pool, r->filename);
>     no2slash(test_filename);

Yeah, that's what I think, too.

Cheers,

Ben.

-- 
Ben Laurie            |Phone: +44 (181) 735 0686|Apache Group member
Freelance Consultant  |Fax:   +44 (181) 735 0689|http://www.apache.org
and Technical Director|Email: ben@algroup.co.uk |Apache-SSL author
A.L. Digital Ltd,     |http://www.algroup.co.uk/Apache-SSL
London, England.      |"Apache: TDG" http://www.ora.com/catalog/apache

Re: directory_walk bug?

Posted by Dean Gaudet <dg...@arctic.org>.

On Thu, 5 Feb 1998, Ben Laurie wrote:

> Dean Gaudet wrote:
> > 
> > directory_walk looks like this:
> > 
> >     test_filename = pstrdup(r->pool, r->filename);
> > 
> >     if (!os_is_path_absolute(test_filename))
> >     {
> >         ...
> >     }
> > 
> >     r->filename   = os_canonical_filename(r->pool, r->filename);
> >     no2slash(test_filename);
> >     num_dirs = count_dirs(test_filename);
> > 
> >     ...
> > 
> > I believe that there's a bug.  I think that test_filename is
> > probably supposed to be a copy of the r->filename after
> > the os_canonical_filename.  test_filename is what's actually
> > used to do all the comparisons later on.
> 
> Hmmm... if only I could remember which way round it was before we move
> the os_canonical_filename. However, I'm inclined to agree.

Well we definately don't want the os_canonical_filename before that if
block, because that if block is for the proxy.  I just figure that
it should be something like:

    if (!os_is_path_absolute(r->filename))
    {
	test_filename = pstrdup(r->pool, r->filename);
	...
    }

    r->filename   = os_canonical_filename(r->pool, r->filename);
    test_filename = pstrdup(r->pool, r->filename);
    no2slash(test_filename);
    ...

Dean


Re: directory_walk bug?

Posted by Ben Laurie <be...@algroup.co.uk>.
Dean Gaudet wrote:
> 
> directory_walk looks like this:
> 
>     test_filename = pstrdup(r->pool, r->filename);
> 
>     if (!os_is_path_absolute(test_filename))
>     {
>         ...
>     }
> 
>     r->filename   = os_canonical_filename(r->pool, r->filename);
>     no2slash(test_filename);
>     num_dirs = count_dirs(test_filename);
> 
>     ...
> 
> I believe that there's a bug.  I think that test_filename is
> probably supposed to be a copy of the r->filename after
> the os_canonical_filename.  test_filename is what's actually
> used to do all the comparisons later on.

Hmmm... if only I could remember which way round it was before we move
the os_canonical_filename. However, I'm inclined to agree.

Cheers,

Ben.

-- 
Ben Laurie            |Phone: +44 (181) 735 0686|Apache Group member
Freelance Consultant  |Fax:   +44 (181) 735 0689|http://www.apache.org
and Technical Director|Email: ben@algroup.co.uk |Apache-SSL author
A.L. Digital Ltd,     |http://www.algroup.co.uk/Apache-SSL
London, England.      |"Apache: TDG" http://www.ora.com/catalog/apache

Re: directory_walk bug?

Posted by Ben Laurie <be...@algroup.co.uk>.
Dean Gaudet wrote:
> 
> directory_walk looks like this:
> 
>     test_filename = pstrdup(r->pool, r->filename);
> 
>     if (!os_is_path_absolute(test_filename))
>     {
>         ...
>     }
> 
>     r->filename   = os_canonical_filename(r->pool, r->filename);
>     no2slash(test_filename);
>     num_dirs = count_dirs(test_filename);
> 
>     ...
> 
> I believe that there's a bug.  I think that test_filename is
> probably supposed to be a copy of the r->filename after
> the os_canonical_filename.  test_filename is what's actually
> used to do all the comparisons later on.
> 
> It's only an issue on win32 presently...

This needs fixing before 1.3b4, too.

Cheers,

Ben.

-- 
Ben Laurie            |Phone: +44 (181) 735 0686|Apache Group member
Freelance Consultant  |Fax:   +44 (181) 735 0689|http://www.apache.org
and Technical Director|Email: ben@algroup.co.uk |Apache-SSL author
A.L. Digital Ltd,     |http://www.algroup.co.uk/Apache-SSL
London, England.      |"Apache: TDG" http://www.ora.com/catalog/apache