On Sat, 21 Apr 2001, Oliver Fromme wrote:
> Paul Herman <[EMAIL PROTECTED]> wrote:
> > On Sat, 21 Apr 2001, Oliver Fromme wrote:
> > > I'm wondering why /bin/df is set-gid to the operator group
> > > by default.
> >
> > It's to df filesystems that aren't mounted. Try "df /dev/ad0s1a" (or
> > whatever) as user nobody with chmod 555 /bin/df.
>
> Ah, thanks for clueing me. :-)
> I didn't know that unprivileged users are supposed to be
> allowed to use df on non-mounted filesystems.
>
> I think I'll keep it at mode 555 on my machines.
This brings up a slightly related question: Now that "cooked" block
devices have been abolished, wouldn't it be a good idea to get rid of
the quick mount(2)/umount(2) of /tmp/df.XXXXXX to stat the file
system? Something like the following patch.
Not that it should ever get called anyway...
-Paul.
Index: df.c
===================================================================
RCS file: /home/ncvs/src/bin/df/df.c,v
retrieving revision 1.23.2.1
diff -u -r1.23.2.1 df.c
--- df.c 2000/06/13 03:19:40 1.23.2.1
+++ df.c 2001/04/21 18:02:18
@@ -208,40 +208,6 @@
} else if ((stbuf.st_mode & S_IFMT) == S_IFCHR) {
rv = ufs_df(*argv, maxwidth) || rv;
continue;
- } else if ((stbuf.st_mode & S_IFMT) == S_IFBLK) {
- if ((mntpt = getmntpt(*argv)) == 0) {
- mdev.fspec = *argv;
- mntpath = strdup("/tmp/df.XXXXXX");
- if (mntpath == NULL) {
- warn("strdup failed");
- rv = 1;
- continue;
- }
- mntpt = mkdtemp(mntpath);
- if (mntpt == NULL) {
- warn("mkdtemp(\"%s\") failed", mntpath);
- rv = 1;
- free(mntpath);
- continue;
- }
- if (mount("ufs", mntpt, MNT_RDONLY,
- &mdev) != 0) {
- rv = ufs_df(*argv, maxwidth) || rv;
- (void)rmdir(mntpt);
- free(mntpath);
- continue;
- } else if (statfs(mntpt, &statfsbuf) == 0) {
- statfsbuf.f_mntonname[0] = '\0';
- prtstat(&statfsbuf, maxwidth);
- } else {
- warn("%s", *argv);
- rv = 1;
- }
- (void)unmount(mntpt, 0);
- (void)rmdir(mntpt);
- free(mntpath);
- continue;
- }
} else
mntpt = *argv;
/*
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message