summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorThorsten Lockert <tholo@cvs.openbsd.org>1996-08-08 06:36:49 +0000
committerThorsten Lockert <tholo@cvs.openbsd.org>1996-08-08 06:36:49 +0000
commit8bbdba13ee2292814ea3886e24276e7fba0d6501 (patch)
tree05af789b1bf99150a6c012b007a2bcef86425864 /sbin
parent4d772254ed458ba0aa2aaf4046cb7c94035303bb (diff)
Make {,f}chown(2) behaviour POSIX.1 compliant with SUID / SGID files
Enable CTL_FS processing by sysctl(3) Add CTL_FS request to disable clearing SUID / SGID bit when a files owner or group is changed by root Make sysctl(8) understand CTL_FS requests
Diffstat (limited to 'sbin')
-rw-r--r--sbin/sysctl/sysctl.c41
1 files changed, 40 insertions, 1 deletions
diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c
index a5de0bd9ef8..c05b94f00bf 100644
--- a/sbin/sysctl/sysctl.c
+++ b/sbin/sysctl/sysctl.c
@@ -76,6 +76,7 @@ static char *rcsid = "$NetBSD: sysctl.c,v 1.9 1995/09/30 07:12:50 thorpej Exp $"
struct ctlname topname[] = CTL_NAMES;
struct ctlname kernname[] = CTL_KERN_NAMES;
struct ctlname vmname[] = CTL_VM_NAMES;
+struct ctlname fsname[] = CTL_FS_NAMES;
struct ctlname netname[] = CTL_NET_NAMES;
struct ctlname hwname[] = CTL_HW_NAMES;
struct ctlname username[] = CTL_USER_NAMES;
@@ -95,7 +96,7 @@ struct list secondlevel[] = {
{ 0, 0 }, /* CTL_UNSPEC */
{ kernname, KERN_MAXID }, /* CTL_KERN */
{ vmname, VM_MAXID }, /* CTL_VM */
- { 0, 0 }, /* CTL_FS */
+ { fsname, FS_MAXID }, /* CTL_FS */
{ netname, NET_MAXID }, /* CTL_NET */
{ 0, CTL_DEBUG_MAXID }, /* CTL_DEBUG */
{ hwname, HW_MAXID }, /* CTL_HW */
@@ -274,6 +275,12 @@ parse(string, flags)
fprintf(stderr,
"Use ps to view %s information\n", string);
return;
+ case KERN_NTPTIME:
+ if (flags == 0)
+ return;
+ fprintf(stderr,
+ "Use xntpd to view %s information\n", string);
+ return;
case KERN_CLOCKRATE:
special |= CLOCK;
break;
@@ -328,6 +335,11 @@ parse(string, flags)
break;
case CTL_FS:
+ len = sysctl_fs(string, &bufp, mib, flags, &type);
+ if (len >= 0)
+ break;
+ return;
+
case CTL_USER:
case CTL_DDB:
break;
@@ -484,6 +496,33 @@ debuginit()
}
}
+struct ctlname posixname[] = CTL_FS_POSIX_NAMES;
+struct list fslist = { posixname, FS_POSIX_MAXID };
+
+/*
+ * handle file system requests
+ */
+sysctl_fs(string, bufpp, mib, flags, typep)
+ char *string;
+ char **bufpp;
+ int mib[];
+ int flags;
+ int *typep;
+{
+ struct list *lp;
+ int indx;
+
+ if (*bufpp == NULL) {
+ listall(string, &fslist);
+ return (-1);
+ }
+ if ((indx = findname(string, "third", bufpp, &fslist)) == -1)
+ return (-1);
+ mib[2] = indx;
+ *typep = fslist.list[indx].ctl_type;
+ return (3);
+}
+
struct ctlname inetname[] = CTL_IPPROTO_NAMES;
struct ctlname ipname[] = IPCTL_NAMES;
struct ctlname icmpname[] = ICMPCTL_NAMES;