diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2014-12-20 02:09:31 -0500 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2014-12-20 02:09:31 -0500 |
commit | 81bc051de0b7b195cff6b26c04e1f898bb6c3613 (patch) | |
tree | 4d83de57efaa852636c3d81fb8e3e87d3f069e41 /bin | |
parent | 86371934d0c6869a2b65bd68e203b24dccab908e (diff) |
ssh-list-authorized-keys: buffer the output to avoid EPIPE
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/ssh-list-authorized-keys | 5 |
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 |