Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=emul32-tools/.git;a=commitdiff;h=98a5f79ffb1fd487dfa68b2d750ec5afffa3edb0

commit 98a5f79ffb1fd487dfa68b2d750ec5afffa3edb0
Author: VMiklos <[EMAIL PROTECTED]>
Date:   Sun Jul 22 01:53:05 2007 +0200

emul32: more secfixes
the previous version still allowed one to get a root shell in the chroot, this
one does not
ah and a bugfix: create the Common dir before the mount, not after

diff --git a/emul32 b/emul32
index 280e3a4..e214cb3 100644
--- a/emul32
+++ b/emul32
@@ -21,13 +21,18 @@
#

if [ "$1" = "--mount" ]; then
-       mount -o bind /home/$USER/Common /usr/lib/chroot32/home/$USER/Common
+       if [ ! -d /usr/lib/chroot32/home/$SUDO_USER/Common ]; then
+               mkdir -p /usr/lib/chroot32/home/$SUDO_USER/Common
+               chown -R $SUDO_USER:users /home/$SUDO_USER
+       fi
+       mount -o bind /home/$SUDO_USER/Common 
/usr/lib/chroot32/home/$SUDO_USER/Common
exit $?
elif [ "$1" = "--umount" ]; then
-       umount /home/$USER/Common
+       umount /home/$SUDO_USER/Common
exit $?
elif [ "$1" = "--linux32" ]; then
-       linux32 /usr/sbin/chroot /usr/lib/chroot32/
+       shift
+       echo "/bin/su - $SUDO_USER -c \"[EMAIL PROTECTED]"" |linux32 
/usr/sbin/chroot /usr/lib/chroot32/
exit $?
fi

@@ -58,8 +63,7 @@ if [ -d /home/$USER/Common ]; then
sudo $0 --mount
fi

-echo "if [ ! -d /home/$USER/Common ]; then mkdir -p /home/$USER/Common; chown 
-R $USER:users /home/$USER; fi; \
-/bin/su - $USER -c \"$cmd\"" |sudo $0 --linux32
+sudo $0 --linux32 $cmd

sudo $0 --umount
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to