From b0a513624f1dbb09da5c7462c3516a9c7e227ac5 Mon Sep 17 00:00:00 2001 From: peter Date: Mon, 6 Apr 1998 18:25:21 +0000 Subject: Rather than let users get fd's to symlink files, make O_NOFOLLOW cause an error if it gets a link (like it does if it gets a socket). The implications of letting users try and do file operations on symlinks themselves were too worrying. --- sys/kern/vfs_vnops.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sys/kern/vfs_vnops.c') diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 40a2112..b243967 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_vnops.c 8.2 (Berkeley) 1/21/94 - * $Id: vfs_vnops.c,v 1.50 1998/02/25 05:58:47 bde Exp $ + * $Id: vfs_vnops.c,v 1.51 1998/04/06 17:38:42 peter Exp $ */ #include @@ -83,7 +83,7 @@ vn_open(ndp, fmode, cmode) if (fmode & O_CREAT) { ndp->ni_cnd.cn_nameiop = CREATE; ndp->ni_cnd.cn_flags = LOCKPARENT | LOCKLEAF; - if ((fmode & O_EXCL) == 0) + if ((fmode & O_EXCL) == 0 && (fmode & O_NOFOLLOW) == 0) ndp->ni_cnd.cn_flags |= FOLLOW; error = namei(ndp); if (error) @@ -125,7 +125,7 @@ vn_open(ndp, fmode, cmode) return (error); vp = ndp->ni_vp; } - if (vp->v_type == VSOCK) { + if (vp->v_type == VSOCK || vp->v_type == VLNK) { error = EOPNOTSUPP; goto bad; } -- cgit v1.1