diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-09-11 14:41:01 -0700 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-09-11 16:12:55 -0700 |
commit | c9a6443de6e652d2540a4374c2cd18384d6f9bdf (patch) | |
tree | 74e35ea8d283e88c47800ac1720318a2eb821b94 /lib/Vyatta | |
parent | b5dce47b6404fc162bfda1abed9b1eb54d05c9a4 (diff) | |
download | vyatta-cfg-system-c9a6443de6e652d2540a4374c2cd18384d6f9bdf.tar.gz vyatta-cfg-system-c9a6443de6e652d2540a4374c2cd18384d6f9bdf.zip |
If configuration is wrong just skip user don't die
If configuration for one user is wrong (missing passwd, level, etc)
go on and complete for rest of users.
Diffstat (limited to 'lib/Vyatta')
-rwxr-xr-x | lib/Vyatta/Login/User.pm | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/lib/Vyatta/Login/User.pm b/lib/Vyatta/Login/User.pm index b0954e06..e38b7f6e 100755 --- a/lib/Vyatta/Login/User.pm +++ b/lib/Vyatta/Login/User.pm @@ -74,12 +74,18 @@ sub update { } elsif ( $users{$user} eq 'added' || $users{$user} eq 'changed' ) { $uconfig->setLevel("system login user $user"); - my $pwd = - $uconfig->returnValue('authentication encrypted-password'); - $pwd or die "Encrypted password not in configuration for $user"; + my $pwd = $uconfig->returnValue('authentication encrypted-password'); + + unless ($pwd) { + warn "Encrypted password not in configuration for $user"; + next; + } my $level = $uconfig->returnValue('level'); - $level or die "Level not defined for $user"; + unless ($level) { + warn "Level not defined for $user"; + next; + } # map level to group membership my @new_groups = @{ $level_map{$level} }; @@ -91,10 +97,8 @@ sub update { my $home = $uconfig->returnValue('home-directory'); # Read existing settings - my ( - undef, $opwd, $uid, $gid, undef, - $comment, undef, $dir, $shell, undef - ) = getpwnam($user); + my (undef, $opwd, $uid, $gid, undef, $comment, + undef, $dir, $shell, undef) = getpwnam($user); my $old_groups = $membership->{$user}; @@ -105,23 +109,18 @@ sub update { # not found in existing passwd, must be new if ( !defined $uid ) { - # make new user using vyatta shell # and make home directory (-m) # and with default group of 100 (users) $cmd = 'useradd -s /bin/vbash -m -N'; - } - elsif ($opwd eq $pwd - && ( !$fname || $fname eq $comment ) - && ( !$home || $home eq $dir ) - && $og_str eq $ng_str) - { - + } elsif ($opwd eq $pwd + && ( !$fname || $fname eq $comment ) + && ( !$home || $home eq $dir ) + && $og_str eq $ng_str) { # If no part of password or group file changed # then there is nothing to do here. next; - } - else { + } else { $cmd = "usermod"; } |