From 62d5b3de2f558192dd0080a6ed64c00bb3ebbef1 Mon Sep 17 00:00:00 2001 From: Tollef Fog Heen Date: Mon, 29 Jul 2013 11:16:56 +0200 Subject: [PATCH] Fix up GROUP_PATTERN support so it allows multiple access items on a line --- pws | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pws b/pws index 1d222cb..7be90b4 100755 --- a/pws +++ b/pws @@ -32,6 +32,7 @@ Thread.abort_on_exception = true GNUPG = "/usr/bin/gpg" GROUP_PATTERN = "@[a-zA-Z0-9-]+" +USER_PATTERN = "[a-zA-Z0-9:-]+" $program_name = File.basename($0, '.*') $editor = ENV['EDITOR'] @@ -289,7 +290,7 @@ class GroupConfig lno = lno+1 next if line =~ /^$/ next if line =~ /^#/ - if (m = /^([a-zA-Z0-9:-]+)\s*=\s*([0-9A-Fa-f]{40})\s*$/.match line) + if (m = /^(#{USER_PATTERN})\s*=\s*([0-9A-Fa-f]{40})\s*$/.match line) user = m[1] fpr = m[2] if @users.has_key?(user) @@ -414,7 +415,7 @@ class EncryptedFile if /^#/.match line next end - m = /^access: "?(#{GROUP_PATTERN})"?/.match line + m = /^access: "?((?:(?:#{GROUP_PATTERN}|#{USER_PATTERN}),?\s*)+)"?/.match line return [] unless m return m[1].strip.split(/[\t ,]+/) end -- 2.39.5