Skip site navigation (1)Skip section navigation (2)
Date:      31 Oct 1997 12:09:17 +0100
From:      Wolfram Schneider <wosch@cs.tu-berlin.de>
To:        Don Lewis <Don.Lewis@tsc.tdk.com>
Cc:        Wolfram Schneider <wosch@cs.tu-berlin.de>, Ollivier Robert <roberto@keltia.freenix.fr>, freebsd-fs@freebsd.org
Subject:   Re: disabled symlinks
Message-ID:  <p1ivhyeqjdu.fsf@panke.panke.de>
In-Reply-To: Don Lewis's message of Thu, 30 Oct 1997 17:11:23 -0800
References:  <199710310111.RAA02224@salsa.gv.tsc.tdk.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Don Lewis <Don.Lewis@tsc.tdk.com> writes:
> On Oct 31, 12:13am, Wolfram Schneider wrote:
> } Subject: Re: disabled symlinks
> } Index: sys/kern/vfs_syscalls.c
> } ===================================================================
> } RCS file: /usr/cvs/src/sys/kern/vfs_syscalls.c,v
> } retrieving revision 1.51.2.6
> } diff -u -r1.51.2.6 vfs_syscalls.c
> } --- vfs_syscalls.c	1997/10/23 18:04:55	1.51.2.6
> } +++ vfs_syscalls.c	1997/10/30 22:24:47
> } @@ -1326,8 +1328,10 @@
> }  		return (error);
> }  	vp = nd.ni_vp;
> }  	error = vn_stat(vp, &sb, p);
> } -	if (vp->v_type == VLNK)
> } +	if (vp->v_type == VLNK && 
> } +		(vp->v_mount->mnt_flag & MNT_NOSYMLINKFOLLOW) != 0)
                                                              ^^
 
> This test looks backwards to me (it changes the behavior if the
> new nosymlinkfollow option is not set).  I'm also not clear as
> to why the behaviour even depends on the option. 

It is a typo and should be
	(vp->v_mount->mnt_flag & MNT_NOSYMLINKFOLLOW) == 0)
Thanks for the hint!

vfs_syscalls.c rev 1.62
Symlinks do not have modes though, they are accessable to everything that
can read the directory (as before).  They are made to show this fact at
lstat time (they appear as mode 0777 always, since that's how the the
lookup routines in the kernel treat them).    

Now it will be (in function lstat and vn_stat)
if (symbolic link) {
	if (does not follow symlinks)
		change the mode to 0000 (l---------)
	else
		change the mode to 0777 (lrwxrwxrwx)
}


>  Also, shouldn't
> the same change be made to both lstat() and olstat()?

This is a cosmetic change. I don't think we should change
old system calls if it is not necessary. I doubt that anybody
use an old ls(1) command.

-- 
Wolfram Schneider   <wosch@apfel.de>   http://www.apfel.de/~wosch/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?p1ivhyeqjdu.fsf>