Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Aug 1995 18:25:45 +0200 (MET DST)
From:      J Wunsch <j@uriah.heep.sax.de>
To:        current@freebsd.org
Subject:   Re: Recent mount patches..
Message-ID:  <199508231625.SAA17655@uriah.heep.sax.de>
In-Reply-To: <6525.809182915@time.cdrom.com> from "Jordan K. Hubbard" at Aug 23, 95 06:01:55 am

next in thread | previous in thread | raw e-mail | index | archive | help
As Jordan K. Hubbard wrote:
> 
> You'll need to rebuild all your mount_foo execs due to the change in
> mount.h.  Just FYI.

Ick.  This should have been discussed before.

> I decided to take the patch because I myself am tired of the system
> refusing to come up just because I don't have a CD in the drive, yet
> it's silly to have to type the whole mount command spec in as the
> only alternative.

See my other reply.

And, btw, /usr/local/bin/do-mount:

#!/usr/bin/suidperl
#

$ENV{'PATH'} = "/sbin:/usr/sbin:/bin:/usr/bin";

$cmd = "mount";

while($_ = $ARGV[0], /^-/) {
    shift;
    $verb=1, next if /^-v/ || /^-verbose/;
    $cmd = "umount", next if /^-u/ || /^-umount/;
    last if /^--/;
    &usage;
}

&usage unless $#ARGV == 0;

if($ARGV[0] eq "od") {
    $type = "ufs"; $src = "/dev/od0a"; $dst = "/od";
} elsif($ARGV[0] eq "cd") {
    $type = "cd9660"; $src = "/dev/cd0a"; $dst = "/cd";
} elsif ($ARGV[0] eq "dos") {
    $type = "msdosfs";  $src = "/dev/fd0";  $dst = "/dos";
} elsif ($ARGV[0] =~ "^fd[0-9][.0-9]*") {
    $type = "msdosfs";  $src = "/dev/$ARGV[0]"; $dst = "/dos";
} else {
    &usage;
}

print "gonna $cmd $src " . ($cmd eq "mount"? "to": "from")
    . " $dst, type $type\n" if $verb;

if($cmd eq "mount") {exec "/sbin/mount", "-t", $type, $src, $dst;}
else {exec "/sbin/umount", $dst;}

sub usage {
    die "usage: do-mount [-v[erbose]] [-u[mount]] cd|dos|fd*\n";
}


Make it setuid root and simply say ``do-mount cd'' or ``do-mount -u
cd''.  Don't need to be root.  (Yeah, i know, it has security holes.
The drives should be mounted noexec,nosuid.)

-- 
cheers, J"org

joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/
Never trust an operating system you don't have sources for. ;-)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199508231625.SAA17655>