summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2001-02-02 18:35:29 +0000
committerphk <phk@FreeBSD.org>2001-02-02 18:35:29 +0000
commit766147079e4ff2bb1db546b8a4a0fc99e025556e (patch)
treeaea11064b1df1b97833aaf4b36401564b92c440b
parentcf672606b6f0292c4771a47b48846f6b60a78311 (diff)
downloadFreeBSD-src-766147079e4ff2bb1db546b8a4a0fc99e025556e.zip
FreeBSD-src-766147079e4ff2bb1db546b8a4a0fc99e025556e.tar.gz
Only superuser can create symlinks.
Give symlinks mode 755 by default to avoid triggering alert eyes. (the mode isn't use on symlinks)
-rw-r--r--sys/fs/devfs/devfs_vnops.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c
index 4337bd2..1f41b51 100644
--- a/sys/fs/devfs/devfs_vnops.c
+++ b/sys/fs/devfs/devfs_vnops.c
@@ -631,17 +631,20 @@ devfs_symlink(ap)
char *a_target;
} */ *ap;
{
- int i;
+ int i, error;
struct devfs_dirent *dd;
struct devfs_dirent *de;
struct devfs_mount *dmp;
+ error = suser(ap->a_cnp->cn_proc);
+ if (error)
+ return(error);
dmp = VFSTODEVFS(ap->a_dvp->v_mount);
dd = ap->a_dvp->v_data;
de = devfs_newdirent(ap->a_cnp->cn_nameptr, ap->a_cnp->cn_namelen);
de->de_uid = 0;
de->de_gid = 0;
- de->de_mode = 0642;
+ de->de_mode = 0755;
de->de_inode = dmp->dm_inode++;
de->de_dirent->d_type = DT_LNK;
i = strlen(ap->a_target) + 1;
OpenPOWER on IntegriCloud