[kde-solaris] KDE 3.1 and vold

Nick THOMPSON kde-solaris@mail.kde.org
Mon Mar 17 16:14:00 2003


--=-KGz9OoOo/GrvWfxcEcCi
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

We got so fed-up with vold (not KDE's integration with it) crashing
workstations and the like, that we opted to create a system which worked
a little more like Linux - allowing user mountable devices. We created a
couple of SUID perl scripts call 'mount' and 'umount' which checks a
file in /etc to see if users are allowed to mount a specific device...

(in /etc/usrfstab)
#
# User mountable disks
#
#device         mount           FS      mount
#to mount       point           type    options
/dev/sr0        /cdrom/cdrom0   hsfs    ro,nosuid
/dev/sr1        /cdrom/cdrom1   hsfs    ro,nosuid
/dev/fd0        /floppy/floppy0 pcfs    foldcase

...if they are, then it runs mount/umount as root to do this for you. It
seem to work quite well, but I'm not a security expert. Scripts are
attached. Of course root needs to be aware of them as they override the
normal mount process and are unable to mount anything that is not in
usrfstab.

Since this look fairly like the Linux solution, it integrates fine into
KDE as long as you make sure HAVE_VOLMGT is not defined in config.h

Nick.

On Sun, 2003-03-16 at 10:30, Torsten Kasch wrote:
> Hi Alan,
> 
> On Sat, Mar 15, 2003 at 11:54:50PM -0400, Alan Mizrahi wrote:
> > Is KDE 3.1 supposed to work with vold on solaris?
> 
> Yes. In fact, it's there since KDE 1.1.1.
> 
> > This are my experiences trying to use KDE 3.1 with vold:
> > 
> > I create a floppy device on the desktop (/dev/diskette). When I click it I 
> > hear my floppy drive working, but I get an error message: "Malformed URL 
> > http://file:"
> [...]
> 
> Try using /dev/diskette0 as the "Device:" entry.
> 
> [...]
> > The cdrom icon works using /dev/dsk/c0t2d0s2, but this device could be 
> > different on different machines, is there a standard cdrom device or a link 
> > to the default device? I tried with /vol/dev/aliases/cdrom0 and it didn't 
> > work.
> 
> Hmm, I'm the one to blame for the current libvolmgt integration, I'm afraid,
> so probably I should explain: the current implementation requires
> to set the physical path for the CDROM/ZIP/whatever device manually into
> the properties dialog.
> 
> I admit that it would be nice to have the drop-down menu in this dialog
> list all installed devices that are under vold's control (as configured in
> /etc/vold.conf). But since spare time seems to be always a tight resource,
> I've not yet managed to improve this... :-(
> 
> If anyone wants to have a look at this, check the code in kdelibs for
> portions protected by "#ifdef HAVE_VOLMGT", namely:
> 
> kdelibs/kio/kio/kmimetype.cpp
> kdelibs/kio/kio/global.cpp
> kdelibs/kioslave/file/file.cc
> 
> Any hints/tips/sugesstions are welcome...

--=-KGz9OoOo/GrvWfxcEcCi
Content-Disposition: attachment; filename=mount
Content-Type: text/plain; name=mount; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

#!/opt/perl/5.6.0/bin/perl
#
# 
use Getopt::Long;  
&GetOptions("F=s"=>\$F, "o=s"=>\$o, "r"=>\$r);
#print "$?\n";
open IN, "/etc/usrfstab";
$ENV{PATH}="";

$mounted=0;

if ($#ARGV < 0) {
    system('/sbin/mount');
    exit 0;
}

while (<IN>) {
    if ($_ =~ /^\#/) {
	# Ignore it cos its a comment line
    }
    else {
	chop;
	($dtom, $mp, $fst, $mo)=split;
	if (($ARGV[0] eq $dtom)|| ($ARGV[0] eq $mp)) {
	    system('/usr/5bin/mkdir' , '-p', $mp);
	    system('/sbin/mount', '-F', $fst , '-o', $mo, $dtom, $mp);
	    $mounted=1;
	}
    }
}
if ($mounted == 0) {
    print "mount: Cannot mount $ARGV[0]\n";
}


--=-KGz9OoOo/GrvWfxcEcCi
Content-Disposition: attachment; filename=umount
Content-Type: text/plain; name=umount; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

#!/opt/perl/5.6.0/bin/perl
#
# 
use Getopt::Long;  
&GetOptions("f"=>\$f); 
open IN, "/etc/usrfstab";
$ENV{PATH}="";

if ($#ARGV < 0) {
    system('/sbin/umount');
    exit 0;
}


$unmounted=0;

while (<IN>) {
    if ($_ =~ /^\#/) {
	# Ignore it cos its a comment line
    }
    else {
	chop;
	($dtom, $mp, $fst, $mo)=split;
	if ($ARGV[0] eq $mp) {
	    if ($f) {
		system('/sbin/umount', '-f', $mp);
	    }
	    else {
		system('/sbin/umount', $mp);
	    }
	    system('/usr/sbin/unlink', $mp);
	    $unmounted=1;
	}
	elsif ($ARGV[0] eq $dtom) {
	    print "Usage: umount <mount point>\n  You may have entered the device name\n";
	}
    }
}


if ($unmounted == 0) {
    print "umount: $ARGV[0] not unmounted\n";
}

--=-KGz9OoOo/GrvWfxcEcCi
Content-Disposition: attachment; filename=eject
Content-Type: text/plain; name=eject; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

#!/opt/perl/5.6.0/bin/perl
#
# 
use Getopt::Long;  
&GetOptions("f"=>\$f,); 
open IN, "/etc/usrfstab";
$ENV{PATH}="";

while (<IN>) {
    if ($_ =~ /^\#/) {
	# Ignore it cos its a comment line
    }
    else {
	chop;
	($dtom, $mp, $fst, $mo)=split;
	if ($ARGV[0] eq $dtom) {
	    if ($f) {
		system('/usr/5bin/eject', '-f', $dtom);
	    }
	    else {
		#$cmd="echo /usr/5bin/eject "+$dtom;
		#system('/usr/5bin/su', '-', 'root', '-c', 'echo /usr/5bin/eject /dev/sr0');
		system('/usr/5bin/eject', $dtom);
	    }
	    system('/usr/5bin/unlink', $mp);
	}
    }
}


--=-KGz9OoOo/GrvWfxcEcCi--