From e16d243bf9c36156a2775bec06d908e8715acc0f Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Tue, 20 May 2008 21:38:58 +0200 Subject: [PATCH] Report consecutive unparsable lines only once --- dowkd.in | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/dowkd.in b/dowkd.in index 4659036..a42220a 100644 --- a/dowkd.in +++ b/dowkd.in @@ -254,11 +254,10 @@ sub derive_ssh_auth_type ($) { sub from_ssh_auth_line ($$$) { my ($tmp, $name, $line) = @_; chomp $line; - return if $line =~ m/^\s*(#|$)/; { my $l = cleanup_ssh_auth_line $line; - $l or goto ERROR; + $l or return 0; $line = $l; } my $type = derive_ssh_auth_type $line; @@ -269,11 +268,10 @@ sub from_ssh_auth_line ($$$) { my ($length, $hash) = ssh_fprint_file "$tmp"; if ($length && $hash) { ssh_fprint_check "$name", $type, $length, $hash; - return; + return 1; } - ERROR: - warn "$name: warning: unparsable line\n"; + return 0; } sub from_ssh_auth_file ($) { @@ -285,8 +283,14 @@ sub from_ssh_auth_file ($) { } my $tmp = new File::Temp; + my $last_status = 1; while (my $line = <$auth>) { - from_ssh_auth_line $tmp, "$name:$.", $line; + next if $line =~ m/^\s*(#|$)/; + my $status = from_ssh_auth_line $tmp, "$name:$.", $line; + unless ($status) { + $last_status and warn "$name:$.: warning: unparsable line\n"; + } + $last_status = $status; } } @@ -408,7 +412,8 @@ sub from_ssh_host ($@) { for my $line (@lines) { next if $line =~ /^#/; my ($host, $data) = $line =~ /^(\S+) (.*)$/; - from_ssh_auth_line $tmp, $host, $data; + from_ssh_auth_line $tmp, $host, $data + or die "$host: warning: unparsable line\n"; } } -- 2.11.4.GIT