*BSD News Article 12954


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!munnari.oz.au!spool.mu.edu!howland.reston.ans.net!noc.near.net!uunet!ogicse!psgrain!percy!agora!rgrimes
From: rgrimes@agora.rain.com (Rodney Grimes)
Newsgroups: comp.os.386bsd.development
Subject: Re: A challenge to all true kernel hackers - conditional symlinks.
Message-ID: <C40vy4.2D0@agora.rain.com>
Date: 17 Mar 93 07:39:39 GMT
Article-I.D.: agora.C40vy4.2D0
References: <C3ow4H.FID@BitBlocks.com> <JKH.93Mar10215639@whisker.lotus.ie> <C3qzvC.2ps@bcstec.ca.boeing.com> <1993Mar17.000717.12690@fcom.cc.utah.edu>
Organization: Open Communications Forum
Lines: 81

terry@cs.weber.edu (A Wizard of Earth C) writes:

>In article <C3qzvC.2ps@bcstec.ca.boeing.com> dmp3592@bcstec.ca.boeing.com (Dean M. Phillips) writes:
>>In article <JKH.93Mar10215639@whisker.lotus.ie> jkh@whisker.lotus.ie (Jordan K. Hubbard) writes:
>>>The only problem with replacing open() is that you still need to deal
>>>with things like stat() and any other system call that deals with
>>>filenames (and follows links) directly.  Note that I wasn't talking about
>>>usurping the $, (, and ) characters in filenames altogether, only in
>>>symbolic links.  I don't think that this would be any great hardship.
>>>
>>I could create an ambiguity:  How do you create a soft link to a real file
>>named $(LANG) for example?  Of course I have to admit that I have never
>>seen a real file with a name of that form.

>The $(LANG) is part of the symbolic link *target*, not part of the name
>of the symbolic link itself.

>This resolves the "name space pollution" problem everybody is going on
>about without any hassles with any other type of file within the file
>system.  If necessary, a "variant link creation" syntax (like "ln -v")
>can be defined.  I vote against this, and for pollution of the symbolic
>link target name space, to ensure cross-fs compatability.  Otherwise,
>it would require additional flagging of the inode type, and really
>require a modification below the VFS layer to implement.

>The other fact, that the name space is only polluted for names beginning
>with "$(" means that collisoin is unlikely anyway, so the pollution is
>not disenfranchising "$", "(", and ")" as filename characters, but is
>instead diasallowing "$(" file names only.

Not quite the whole story, if I remeber correctly from my apollo days,
if a variant link portion ie NAME in $(NAME) does not corresponde
to a valid environment variable it is left untranslated.  So in
fact you can have a link foo -> $(BAR) that well get to file $(BAR)
as long as no environment variabled named BAR is defined.

I well again make the point, would some one dig up the apollo manuals
and get the details on the way that all of this workes under aegis,
I think most of what is being touched on here was clearly and
consisely layed out by apollo way back when.

>It's a simple, simple hack that introduces many security issues unless
>things like access are forces to always follow symbolic links to determin
>permissions rather than looking at the link inode itself.

>As for the "orphan issue" of symlinking to a non-existant file, that
>problem already exists.  It is perfectly acceptable to symlink to a
>non existant file with "invariant" sym links.  Try:

>	mkdir tmp
>	cd tmp
>	ln -s foo fee
>	cat foo
>	cat fee
>	cat > fee
>	This is a test.
>	^D
>	cat foo
>	rm foo fee
>	cd ..
>	rmdir tmp

>to demonstrate this.


>					Terry Lambert
>					terry@icarus.weber.edu
>					terry_lambert@novell.com
>---
>Any opinions in this posting are my own and not those of my present
>or previous employers.
>-- 
>-------------------------------------------------------------------------------
>                                        "I have an 8 user poetic license" - me
> Get the 386bsd FAQ from agate.berkeley.edu:/pub/386BSD/386bsd-0.1/unofficial
>-------------------------------------------------------------------------------
-- 
Rod Grimes						rgrimes@agora.rain.com
Accurate Automation Company          All opinions belong to me and my company!
Get your free copy of  386bsd  from  agate.berkeley.edu:/pub/386BSD  via  ftp!
An out of work contractor... You need unix work done.... Send me your project!