From 5858ecb56e3ad3e8ae9fe30edc51ccaa0de83a86 Mon Sep 17 00:00:00 2001 From: Sitaram Chamarty Date: Tue, 8 Nov 2011 11:23:25 +0530 Subject: [PATCH] puppet wants to send in keys with comment lines --- src/gitolite.pm | 1 + src/sshkeys-lint | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gitolite.pm b/src/gitolite.pm index d67cd13..fcbda13 100644 --- a/src/gitolite.pm +++ b/src/gitolite.pm @@ -1077,6 +1077,7 @@ sub setup_authkeys local $/ = undef; local @ARGV = ($pubkey); $pubkey_content = <>; + $pubkey_content =~ s/^\s*#.*\n//gm; } $pubkey_content =~ s/\s*$/\n/; # don't trust files with multiple lines (i.e., something after a newline) diff --git a/src/sshkeys-lint b/src/sshkeys-lint index 5e6d9a8..3d9de51 100755 --- a/src/sshkeys-lint +++ b/src/sshkeys-lint @@ -38,7 +38,7 @@ print "\n"; my @pubkeys = sort glob("*.pub"); die "no *.pub files here\n" unless @pubkeys; for my $pub (@pubkeys) { - my @lines = filelines($pub); + my @lines = grep { ! /^\s*#/ } filelines($pub); die "$pub has more than one line\n" if @lines > 1; die "$pub does not start with ssh-rsa or ssh-dss\n" unless $lines[0] =~ /^(?:ssh-rsa|ssh-dss) (\S+)/; my $key = $1;