summaryrefslogtreecommitdiff
path: root/lib/Vyatta
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2010-03-15 10:43:58 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2010-03-15 10:43:58 -0700
commitfa0e2d31d5964c7d7bb0f8d34b568d065cf38890 (patch)
treeb49eb257176b7dc9a0a9a282504518f34ec98662 /lib/Vyatta
parent87c0562ee477ebc37248c00cdcfe93ecfcf31102 (diff)
downloadvyatta-cfg-quagga-fa0e2d31d5964c7d7bb0f8d34b568d065cf38890.tar.gz
vyatta-cfg-quagga-fa0e2d31d5964c7d7bb0f8d34b568d065cf38890.zip
Better version of forcing user logout
Use warning and hup signal to force user to log out.
Diffstat (limited to 'lib/Vyatta')
-rwxr-xr-xlib/Vyatta/Login/User.pm8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Vyatta/Login/User.pm b/lib/Vyatta/Login/User.pm
index edba13ac..afc3cf53 100755
--- a/lib/Vyatta/Login/User.pm
+++ b/lib/Vyatta/Login/User.pm
@@ -109,7 +109,13 @@ sub _delete_user {
} elsif ( getlogin() eq $user ) {
die "Attempting to delete current user: $user\n";
} else {
- system("userdel -f $user") == 0
+ if (`who | grep "^$user"` ne '') {
+ warn "$user is logged in, forcing logout\n";
+ system("pkill -HUP -u $user");
+ }
+ system("pkill -9 -u $user");
+
+ system("userdel $user") == 0
or die "userdel of $user failed: $?\n";
}
}