From cfa9689f9138865e493c5659b79c514d26f6ba0e Mon Sep 17 00:00:00 2001 From: freesource Date: Wed, 17 Oct 2001 05:44:54 +0000 Subject: [PATCH] This changes real uid id to effective uid id. --- BootRoot/Yard.pm | 4 ++-- gbootroot | 19 ++++++++++++++----- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/BootRoot/Yard.pm b/BootRoot/Yard.pm index 938ccbd..23a418e 100644 --- a/BootRoot/Yard.pm +++ b/BootRoot/Yard.pm @@ -1097,7 +1097,7 @@ sub copy_strip_file { ## non-root users will experience problems here so this is ## skipped. --freesource - if ( $< == 0 ) { + if ( $> == 0 ) { my($mode, $uid, $gid); (undef, undef, $mode, undef, $uid, $gid) = stat $from; my $from_base = basename($from); @@ -1589,7 +1589,7 @@ sub mount_device { $options = ""; } - if ( $< == 0 ) { + if ( $> == 0 ) { errmk(sys("mount $options -t ext2 $device $mount_point")); } else { diff --git a/gbootroot b/gbootroot index e115855..8267d0e 100755 --- a/gbootroot +++ b/gbootroot @@ -528,13 +528,22 @@ if ( $< == 0 ) { } else { - # Hopefully only one user at a time. - if (!-d "$tmp1/gboot_non_root") { - $tmp = "$tmp1/gboot_non_root" if err_custom_perl( - "mkdir $tmp1/gboot_non_root", + # The Administrator just needs to add a line like this to the fstab for + # each non-root user who wants to be able to create root_fs. + # Ofcourse the user is locked into the ext2 fs in this example + # + # /tmp/gboot_non_root_`id -u`/root_fs \ + # /tmp/gboot_non_root_`id -u`/loopback \ + # ext2 defaults,noauto,user,loop 0 0 + + my $user = $>; + + if (!-d "$tmp1/gboot_non_root_" . $user) { + $tmp = "$tmp1/gboot_non_root" . $user if err_custom_perl( + "mkdir $tmp1/gboot_non_root" . $user, "gBootRoot: ERROR: Could not make temporary directory") != 2; } - $tmp = "$tmp1/gboot_non_root"; + $tmp = "$tmp1/gboot_non_root" . $user; if (!-d "$tmp1/gbootroot_mnt$time") { $mnt = "$tmp1/gbootroot_mnt$time" if err_custom_perl(