From ecde9a6dae867f60cb32859bd15793d4de273b10 Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Fri, 2 Feb 2001 18:35:29 +0000 Subject: [PATCH] Only superuser can create symlinks. Give symlinks mode 755 by default to avoid triggering alert eyes. (the mode isn't use on symlinks) --- sys/fs/devfs/devfs_vnops.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c index 4337bd27c9ab..1f41b51d60e3 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;