summaryrefslogtreecommitdiff
path: root/lib/Vyatta/Login
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2010-02-18 21:35:30 -0800
committerStephen Hemminger <stephen.hemminger@vyatta.com>2010-02-19 12:15:14 -0800
commit19d3c520ba13678e0388052340f1639ce02d0679 (patch)
tree2b8a9d1a0ae7c9cef5d7e46c5dc0829dac8d03e4 /lib/Vyatta/Login
parent014158a2e55f7fb829e75cb5c8236299de91dfe0 (diff)
downloadvyatta-cfg-system-19d3c520ba13678e0388052340f1639ce02d0679.tar.gz
vyatta-cfg-system-19d3c520ba13678e0388052340f1639ce02d0679.zip
Handle empty set of public keys
Bug 5362 If no keys configured; still make an empty .ssh/authorized_keys file. This handles case of keys being deleted from configuration and gives notice to user that file will be overwritten.
Diffstat (limited to 'lib/Vyatta/Login')
-rwxr-xr-xlib/Vyatta/Login/User.pm6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/Vyatta/Login/User.pm b/lib/Vyatta/Login/User.pm
index e08a65b9..e4909b9a 100755
--- a/lib/Vyatta/Login/User.pm
+++ b/lib/Vyatta/Login/User.pm
@@ -64,9 +64,6 @@ sub _authorized_keys {
my $config = new Vyatta::Config;
$config->setLevel("system login user $user authentication public-keys");
- my @keys = $config->listNodes();
- return unless @keys;
-
# ($name,$passwd,$uid,$gid,$quota,$comment,$gcos,$dir,$shell,$expire)
# = getpw*
my ( undef, undef, $uid, $gid, undef, undef, undef, $home ) =
@@ -87,7 +84,8 @@ sub _authorized_keys {
print {$auth} "# Automatically generated by Vyatta configuration\n";
print {$auth} "# Do not edit, all changes will be lost\n";
- foreach my $name (@keys) {
+
+ foreach my $name ($config->listNodes()) {
my $options = $config->returnValue("$name options");
my $type = $config->returnValue("$name type");
my $key = $config->returnValue("$name key");