use freebsd file permission checks for solaris

This commit is contained in:
Christoph Hartmann 2016-01-28 14:22:30 +01:00
parent 2fd6aea357
commit a5f526b368

View file

@ -110,7 +110,7 @@ module Inspec::Resources
def check_file_permission_by_user(user, flag) def check_file_permission_by_user(user, flag)
if linux? if linux?
perm_cmd = "su -s /bin/sh -c \"test -#{flag} #{path}\" #{user}" perm_cmd = "su -s /bin/sh -c \"test -#{flag} #{path}\" #{user}"
elsif family == 'freebsd' elsif family == 'freebsd' || solaris?
perm_cmd = "sudo -u #{user} test -#{flag} #{path}" perm_cmd = "sudo -u #{user} test -#{flag} #{path}"
elsif family == 'aix' elsif family == 'aix'
perm_cmd = "su #{user} -c test -#{flag} #{path}" perm_cmd = "su #{user} -c test -#{flag} #{path}"
@ -140,6 +140,10 @@ module Inspec::Resources
inspec.os.linux? inspec.os.linux?
end end
def solaris?
inspec.os.solaris?
end
def family def family
inspec.os[:family] inspec.os[:family]
end end