diff options
-rw-r--r-- | bin/common.rb | 8 | ||||
-rwxr-xr-x | bin/pgp-list-keyids | 2 | ||||
-rwxr-xr-x | bin/postfix-generate-virtual-map | 2 | ||||
-rwxr-xr-x | bin/ssh-list-authorized-keys | 2 | ||||
-rwxr-xr-x | bin/uid-map | 4 |
5 files changed, 11 insertions, 7 deletions
diff --git a/bin/common.rb b/bin/common.rb index a5840ec..4380340 100644 --- a/bin/common.rb +++ b/bin/common.rb @@ -12,5 +12,11 @@ def load_user_yaml(filename) end def load_all_users - Dir.glob("#{cfg["yamldir"]}/*.yml").map{|filename|load_user_yaml(filename)} + users = {} + Dir.glob("#{cfg["yamldir"]}/*.yml").map{|filename| + uid = File.basename(filename).sub(/^([0-9]*)\.yml$/, "\\1").to_i + user = load_user_yaml(filename) + users[uid] = user + } + return users end diff --git a/bin/pgp-list-keyids b/bin/pgp-list-keyids index f6b71fe..9682b1a 100755 --- a/bin/pgp-list-keyids +++ b/bin/pgp-list-keyids @@ -3,7 +3,7 @@ load "#{File.dirname(__FILE__)}/common.rb" -load_all_users.each do |user| +load_all_users.each do |uid,user| if user["groups"] if user["groups"].include?("keyring-trusted") puts "trusted/#{user["username"]} #{user["pgp_keyid"]}" diff --git a/bin/postfix-generate-virtual-map b/bin/postfix-generate-virtual-map index f323d6b..d5c2d21 100755 --- a/bin/postfix-generate-virtual-map +++ b/bin/postfix-generate-virtual-map @@ -3,7 +3,7 @@ load "#{File.dirname(__FILE__)}/common.rb" -users = load_all_users.find_all{|u|u["groups"].include?("email")} +users = load_all_users.values.find_all{|u|u["groups"].include?("email")} users.each do |user| if user["email"] and user["email"].length > 0 diff --git a/bin/ssh-list-authorized-keys b/bin/ssh-list-authorized-keys index 5e178e1..5fb1ea1 100755 --- a/bin/ssh-list-authorized-keys +++ b/bin/ssh-list-authorized-keys @@ -3,7 +3,7 @@ load "#{File.dirname(__FILE__)}/common.rb" -all_users = load_all_users +all_users = load_all_users.values groupnames = ARGV & cfg["ssh_pseudo_users"] usernames = ARGV & all_users.map{|u|u["username"]} diff --git a/bin/uid-map b/bin/uid-map index 26765fa..10c3fac 100755 --- a/bin/uid-map +++ b/bin/uid-map @@ -3,8 +3,6 @@ load "#{File.dirname(__FILE__)}/common.rb" -users = Dir.glob("#{cfg["yamldir"]}/*.yml").each do |filename| - uid = File.basename(filename).sub(/^([0-9]*)\.yml$/, "\\1").to_i - user = load_user_yaml(filename) +load_all_users.each do |uid,user| puts "#{uid}:#{user["username"]}" end |