From: Tollef Fog Heen Date: Mon, 29 Jul 2013 09:16:56 +0000 (+0200) Subject: Fix up GROUP_PATTERN support so it allows multiple access items on a line X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=62d5b3de2f558192dd0080a6ed64c00bb3ebbef1;p=pwstore Fix up GROUP_PATTERN support so it allows multiple access items on a line --- 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