summaryrefslogtreecommitdiff
path: root/bin/ssh-list-authorized-keys
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2014-12-20 02:09:31 -0500
committerLuke Shumaker <lukeshu@sbcglobal.net>2014-12-20 02:09:31 -0500
commit81bc051de0b7b195cff6b26c04e1f898bb6c3613 (patch)
tree4d83de57efaa852636c3d81fb8e3e87d3f069e41 /bin/ssh-list-authorized-keys
parent86371934d0c6869a2b65bd68e203b24dccab908e (diff)
ssh-list-authorized-keys: buffer the output to avoid EPIPE
Diffstat (limited to 'bin/ssh-list-authorized-keys')
-rwxr-xr-xbin/ssh-list-authorized-keys5
1 files changed, 4 insertions, 1 deletions
diff --git a/bin/ssh-list-authorized-keys b/bin/ssh-list-authorized-keys
index bb153e1..6a03c8d 100755
--- a/bin/ssh-list-authorized-keys
+++ b/bin/ssh-list-authorized-keys
@@ -18,10 +18,13 @@ end
users = all_users.find_all{|u| usernames.include?(u["username"]) or not ((u["groups"]||[]) & groupnames).empty?}
+# Buffer the output to avoid EPIPE when the reader hangs up early
+output=""
users.each do |user|
if user["ssh_keys"]
user["ssh_keys"].each do |addr,key|
- puts "#{key} #{user["fullname"]} (#{user["username"]}) <#{addr}>"
+ output+="#{key} #{user["fullname"]} (#{user["username"]}) <#{addr}>\n"
end
end
end
+print output