# File lib/chef/win32/security/sid.rb, line 173 def self.AccountOperators SID.from_string_sid('S-1-5-32-548') end
# File lib/chef/win32/security/sid.rb, line 195 def self.Administrator SID.from_account("#{::ENV['COMPUTERNAME']}\\#{SID.admin_account_name}") end
# File lib/chef/win32/security/sid.rb, line 188 def self.Administrators SID.from_string_sid('S-1-5-32-544') end
# File lib/chef/win32/security/sid.rb, line 131 def self.Anonymous SID.from_string_sid('S-1-5-7') end
# File lib/chef/win32/security/sid.rb, line 143 def self.AuthenticatedUsers SID.from_string_sid('S-1-5-11') end
# File lib/chef/win32/security/sid.rb, line 182 def self.BackupOperators SID.from_string_sid('S-1-5-32-551') end
# File lib/chef/win32/security/sid.rb, line 122 def self.Batch SID.from_string_sid('S-1-5-3') end
# File lib/chef/win32/security/sid.rb, line 161 def self.BuiltinAdministrators SID.from_string_sid('S-1-5-32-544') end
# File lib/chef/win32/security/sid.rb, line 164 def self.BuiltinUsers SID.from_string_sid('S-1-5-32-545') end
# File lib/chef/win32/security/sid.rb, line 95 def self.Creator SID.from_string_sid('S-1-3') end
# File lib/chef/win32/security/sid.rb, line 101 def self.CreatorGroup SID.from_string_sid('S-1-3-1') end
# File lib/chef/win32/security/sid.rb, line 107 def self.CreatorGroupServer SID.from_string_sid('S-1-3-3') end
# File lib/chef/win32/security/sid.rb, line 98 def self.CreatorOwner SID.from_string_sid('S-1-3-0') end
# File lib/chef/win32/security/sid.rb, line 104 def self.CreatorOwnerServer SID.from_string_sid('S-1-3-2') end
# File lib/chef/win32/security/sid.rb, line 116 def self.Dialup SID.from_string_sid('S-1-5-1') end
# File lib/chef/win32/security/sid.rb, line 137 def self.EnterpriseDomainControllers SID.from_string_sid('S-1-5-9') end
# File lib/chef/win32/security/sid.rb, line 89 def self.Everyone SID.from_string_sid('S-1-1-0') end
# File lib/chef/win32/security/sid.rb, line 198 def self.Guest SID.from_account("#{::ENV['COMPUTERNAME']}\\Guest") end
# File lib/chef/win32/security/sid.rb, line 167 def self.Guests SID.from_string_sid('S-1-5-32-546') end
# File lib/chef/win32/security/sid.rb, line 125 def self.Interactive SID.from_string_sid('S-1-5-4') end
# File lib/chef/win32/security/sid.rb, line 92 def self.Local SID.from_string_sid('S-1-2') end
# File lib/chef/win32/security/sid.rb, line 152 def self.LocalSystem SID.from_string_sid('S-1-5-18') end
# File lib/chef/win32/security/sid.rb, line 119 def self.Network SID.from_string_sid('S-1-5-2') end
# File lib/chef/win32/security/sid.rb, line 83 def self.Nobody SID.from_string_sid('S-1-0-0') end
# File lib/chef/win32/security/sid.rb, line 110 def self.NonUnique SID.from_string_sid('S-1-4') end
# File lib/chef/win32/security/sid.rb, line 192 def self.None SID.from_account("#{::ENV['COMPUTERNAME']}\\None") end
# File lib/chef/win32/security/sid.rb, line 113 def self.Nt SID.from_string_sid('S-1-5') end
# File lib/chef/win32/security/sid.rb, line 155 def self.NtLocal SID.from_string_sid('S-1-5-19') end
# File lib/chef/win32/security/sid.rb, line 158 def self.NtNetwork SID.from_string_sid('S-1-5-20') end
Well-known SIDs
# File lib/chef/win32/security/sid.rb, line 80 def self.Null SID.from_string_sid('S-1-0') end
# File lib/chef/win32/security/sid.rb, line 170 def self.PowerUsers SID.from_string_sid('S-1-5-32-547') end
# File lib/chef/win32/security/sid.rb, line 140 def self.PrincipalSelf SID.from_string_sid('S-1-5-10') end
# File lib/chef/win32/security/sid.rb, line 179 def self.PrintOperators SID.from_string_sid('S-1-5-32-550') end
# File lib/chef/win32/security/sid.rb, line 134 def self.Proxy SID.from_string_sid('S-1-5-8') end
# File lib/chef/win32/security/sid.rb, line 185 def self.Replicators SID.from_string_sid('S-1-5-32-552') end
# File lib/chef/win32/security/sid.rb, line 146 def self.RestrictedCode SID.from_string_sid('S-1-5-12') end
# File lib/chef/win32/security/sid.rb, line 176 def self.ServerOperators SID.from_string_sid('S-1-5-32-549') end
# File lib/chef/win32/security/sid.rb, line 128 def self.Service SID.from_string_sid('S-1-5-6') end
# File lib/chef/win32/security/sid.rb, line 149 def self.TerminalServerUsers SID.from_string_sid('S-1-5-13') end
# File lib/chef/win32/security/sid.rb, line 86 def self.World SID.from_string_sid('S-1-1') end
# File lib/chef/win32/security/sid.rb, line 206 def self.admin_account_name @admin_account_name ||= begin admin_account_name = nil # Call NetUserEnum to enumerate the users without hitting network # http://msdn.microsoft.com/en-us/library/windows/desktop/aa370652(v=vs.85).aspx servername = nil # We are querying the local server level = 3 # We want USER_INFO_3 structure which contains the SID filter = FILTER_NORMAL_ACCOUNT # Only query the user accounts bufptr = FFI::MemoryPointer.new(:pointer) # Buffer which will receive the data prefmaxlen = MAX_PREFERRED_LENGTH # Let the system allocate the needed amount of memory entriesread = FFI::Buffer.new(:long).write_long(0) totalentries = FFI::Buffer.new(:long).write_long(0) resume_handle = FFI::Buffer.new(:long).write_long(0) status = ERROR_MORE_DATA while(status == ERROR_MORE_DATA) do status = NetUserEnum(servername, level, filter, bufptr, prefmaxlen, entriesread, totalentries, resume_handle) if (status == NERR_Success || status == ERROR_MORE_DATA) entriesread.read_long.times.collect do |i| user_info = USER_INFO_3.new(bufptr.read_pointer + i * USER_INFO_3.size) # Check if the account is the Administrator account # RID for the Administrator account is always 500 and it's privilage is set to USER_PRIV_ADMIN if user_info[:usri3_user_id] == 500 && user_info[:usri3_priv] == 2 # USER_PRIV_ADMIN (2) - Administrator admin_account_name = user_info[:usri3_name].read_wstring break end end # Free the memory allocated by the system NetApiBufferFree(bufptr.read_pointer) end end raise "Can not determine the administrator account name." if admin_account_name.nil? admin_account_name end end
# File lib/chef/win32/security/sid.rb, line 202 def self.current_user SID.from_account("#{::ENV['USERDOMAIN']}\\#{::ENV['USERNAME']}") end
# File lib/chef/win32/security/sid.rb, line 43 def self.from_account(name) domain, sid, use = Chef::ReservedNames::Win32::Security.lookup_account_name(name) sid end
# File lib/chef/win32/security/sid.rb, line 52 def ==(other) other != nil && Chef::ReservedNames::Win32::Security.equal_sid(self, other) end
# File lib/chef/win32/security/sid.rb, line 58 def account Chef::ReservedNames::Win32::Security.lookup_account_sid(self) end
# File lib/chef/win32/security/sid.rb, line 62 def account_name domain, name, use = account (domain != nil && domain.length > 0) ? "#{domain}\\#{name}" : name end
# File lib/chef/win32/security/sid.rb, line 67 def size Chef::ReservedNames::Win32::Security.get_length_sid(self) end
Generated with the Darkfish Rdoc Generator 2.