Skip to content

Commit

Permalink
Query gid to prevent errors with missing users with the same id (fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
cmusik committed Dec 20, 2024
1 parent f1a8166 commit 216f276
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/puppet/provider/firewall/firewall.rb
Original file line number Diff line number Diff line change
Expand Up @@ -376,9 +376,16 @@ def insync?(context, _name, property_name, is_hash, should_hash)
end

# If 'is' or 'should' contain anything other than digits or digit range,
# we assume that we have to do a lookup to convert to UID
is = Etc.getpwnam(is).uid unless is[%r{[0-9]+(-[0-9]+)?}] == is
should = Etc.getpwnam(should).uid unless should[%r{[0-9]+(-[0-9]+)?}] == should
# we assume that we have to do a lookup to convert to UID or GID
if property_name == :uid
is = Etc.getpwnam(is).uid unless is[%r{[0-9]+(-[0-9]+)?}] == is
should = Etc.getpwnam(should).uid unless should[%r{[0-9]+(-[0-9]+)?}] == should
end

if property_name == :gid
is = Etc.getgrnam(is).gid unless is[%r{[0-9]+(-[0-9]+)?}] == is
should = Etc.getgrnam(should).gid unless should[%r{[0-9]+(-[0-9]+)?}] == should
end

"#{is_negate}#{is}" == "#{should_negate}#{should}"
when :mac_source, :jump
Expand Down

0 comments on commit 216f276

Please sign in to comment.