diff options
author | Daouda Lo <daouda@mandriva.com> | 2005-03-08 13:05:48 +0000 |
---|---|---|
committer | Daouda Lo <daouda@mandriva.com> | 2005-03-08 13:05:48 +0000 |
commit | e9e3d7afc45de1853f9e100179a3019b15b7f7f0 (patch) | |
tree | c428830ab787c6aa16ea88c5110c2f02c19488a1 | |
parent | 4732f75b2ccaa17d7e8d47d53a31bde61981619b (diff) | |
download | userdrake-e9e3d7afc45de1853f9e100179a3019b15b7f7f0.tar userdrake-e9e3d7afc45de1853f9e100179a3019b15b7f7f0.tar.gz userdrake-e9e3d7afc45de1853f9e100179a3019b15b7f7f0.tar.bz2 userdrake-e9e3d7afc45de1853f9e100179a3019b15b7f7f0.tar.xz userdrake-e9e3d7afc45de1853f9e100179a3019b15b7f7f0.zip |
- wrap an eval around sensitive home deletion
- home deletion option grayed when deletion might be dangerous
-rwxr-xr-x | userdrake | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -514,10 +514,11 @@ sub Delete { #$removehome and $ctx->Clean($userEnt); # New version my $w = NewWindow(N("Delete files or not?"), 1); + my $hd = $userEnt->HomeDir($GetValue); gtkadd($w, gtkpack_(Gtk2::VBox->new(0, 2), 0, Gtk2::Label->new(N("Deleting user %s\n Also perform the following actions\n", $username)), - 0, $checkhome = Gtk2::CheckButton->new(N("Delete Home Directory: %s", $userEnt->HomeDir($GetValue))), + 0, $checkhome = Gtk2::CheckButton->new(N("Delete Home Directory: %s", $hd)), 0, $checkspool = Gtk2::CheckButton->new(N("Delete Mailbox :/var/spool/mail/%s", $username)), 0, Gtk2::HSeparator->new, 0, gtkpack(create_hbox('edge'), @@ -537,14 +538,21 @@ sub Delete { $ctx->GroupDel($groupEnt); } } - $checkhome->get_active and $ctx->CleanHome($userEnt); - $checkspool->get_active and $ctx->CleanSpool($userEnt); + if ($checkhome->get_active) { + eval { $ctx->CleanHome($userEnt) }; + $@ and RaiseError($@); + } + if ($checkspool->get_active) { + eval { $ctx->CleanSpool($userEnt) }; + $@ and RaiseError($@); + } Refresh($sysfilter, $stringsearch); } !$error and $w->destroy; $error = 0 }); } ([ N("Cancel"), 1 ], [ N("Delete"), 0 ])), ) ); + if ($hd !~ m!(?:/home|/var/spool)!) { $checkhome->set_sensitive(0); $checkspool->set_sensitive(0); } $w->show_all; #$w->main; } elsif ($page == 1) { @@ -570,7 +578,7 @@ sub Delete { } if (!$error) { log::explanations(N("Removing group: %s", $groupname)); - $ctx->GroupDel($groupEnt); Refresh($sysfilter, $stringsearch) } + eval { $ctx->GroupDel($groupEnt) }; Refresh($sysfilter, $stringsearch) } } !$error and $wg->destroy; $error = 0 }); } ([ N("Cancel"), 1 ], [ N("Delete"), 0 ])), |