From 2f2f7b9db41057787628d0b1afdb61d421934ce8 Mon Sep 17 00:00:00 2001 From: An-Cheng Huang Date: Mon, 5 Oct 2009 19:19:23 -0700 Subject: add override mechanism for protected users --- lib/Vyatta/Login/User.pm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lib') diff --git a/lib/Vyatta/Login/User.pm b/lib/Vyatta/Login/User.pm index a94b8d08..f5e8337f 100755 --- a/lib/Vyatta/Login/User.pm +++ b/lib/Vyatta/Login/User.pm @@ -60,14 +60,28 @@ sub get_groups { return \%group_map; } +# protected users override file +my $protected_override = '/opt/vyatta/etc/protected-users'; + # make list of vyatta users (ie. users of vbash) sub _vyatta_users { my @vusers; + my %protected_override = (); + my $pfd; + if (open($pfd, '<', "$protected_override")) { + while (<$pfd>) { + next if (!defined($_)); + chomp; + $protected_override{$_} = 1; + } + close($pfd); + } setpwent(); # ($name,$passwd,$uid,$gid,$quota,$comment,$gcos,$dir,$shell,$expire) # = getpw* while ( my ($name, undef, undef, undef, undef, undef, undef, undef, $shell) = getpwent() ) { + next if (defined($protected_override{$name})); push @vusers, $name if ($shell eq '/bin/vbash'); } endpwent(); -- cgit v1.2.3