lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lynx-dev Improper ~/ expansion in file://


From: Ryan Hung
Subject: Re: lynx-dev Improper ~/ expansion in file://
Date: Thu, 19 Nov 1998 15:25:20 -0800 (PST)

On Thu, 19 Nov 1998, Klaus Weide wrote:

> I see the same in 2.8.1rel.2. 

Yeah, I guess I should have said >=2.8.1.

> There are actually at least two problems.  Only in combination do
> they prevent changing file permissions from working:
> 
>  1) the additional slash in the URL
>  2) The functions in LYLocal.c do the wrong thing with the strings
>     they get.  In this case permit_location() gets passed
>     "//home/username", which it passed to HTfullURL_toFile, which
>     is a macro to a call of HTnameOfFile_WWW() [in HTFile.c].
>     HTfullURL_toFile() is inappropriate here.  It treats the
>     string as a relative URL (so that "home" is seen as the host
>     part of an URL) which it isn't. It also tries to URL-unescape
>     the string which is also inappropriate: See what happens
>     for a file named "%backup%~".
> 
>     Earlier versions of LYLocal.c didn't do all this.  For example
>     permit_location() worked for filepaths with duplicate slashes
>     (which are just ignored under Unix) and for filenames with "%".
> 
> I suggest reverting LYLocal.c back to a previous version that is
> better behaved, or changing the new macros and functions there to
> something appropriate.

Hmm, I'll see if that works.  Any idea why adding a few lines to LYUtils.c
under LYTrimRelFromAbsPath() doesn't seem to do the trick:

Added at Line 4569:

    while (cp[1] == '/') {
        if (cp[2] == '/') {
        /*
         *  Skip over first "/" of a "//". - rhung
         */
        cp += 1;
        } else {
        /*  Finished. - rhung
         *
         */
        break;
        }
    }

After all, the "if (url_type == FILE_URL_TYPE)" section in LYGetFile.c
seems to call LYTrimRelFromAbsPath().

> Note that permit_location() should always get a filename or file
> path as its srcpath argument, not a URL.  The code
> 
>          if (strncmp(srcpath, "file://localhost", 16) == 0)
>             srcpath += 16;
>  
> which appears in previous versions may have been misleading because
> if makes one think otherwise.  But AFAIK that test would normally

Yeah, that's what %p in lynx.cfg should be doing, giving the path.  It's
just that it gives the wrong path, "/username" rather than
"/home/username".

                                                        Ryan.

_/  \__/  \__/  \__/  \__/  \__/  \__/  \__/address@hidden/  \__/  \__/
 \_Apoptosis=programmed cell death/  \__/  address@hidden/  \__
_/ --you can't live without it!/  \__/  \http://www.vcn.bc.ca/people/rhung
 \__/  \__/  \__/  \__/  \__/  \__/  \__/  \My words Copyright (C) 1998  \__

reply via email to

[Prev in Thread] Current Thread [Next in Thread]