From 6c754d9d1c1fafa01e2ed5bcfb1ebe0934e5eb67 Mon Sep 17 00:00:00 2001 From: Jordan Borean Date: Thu, 4 Jan 2018 08:57:44 +1000 Subject: [PATCH] win_whoami: removed logon_sid from return results (#34425) --- lib/ansible/modules/windows/win_whoami.ps1 | 7 +----- lib/ansible/modules/windows/win_whoami.py | 25 ------------------- .../targets/win_whoami/tasks/main.yml | 13 ---------- 3 files changed, 1 insertion(+), 44 deletions(-) diff --git a/lib/ansible/modules/windows/win_whoami.ps1 b/lib/ansible/modules/windows/win_whoami.ps1 index 62e48a1a946..5f4e8cc553b 100644 --- a/lib/ansible/modules/windows/win_whoami.ps1 +++ b/lib/ansible/modules/windows/win_whoami.ps1 @@ -40,7 +40,6 @@ namespace Ansible // TOKEN_GROUPS public ArrayList Groups { get; internal set; } - public Sid LogonSid { get; internal set; } public ArrayList Rights { get; internal set; } // TOKEN_MANDATORY_LABEL @@ -570,7 +569,6 @@ namespace Ansible } // Get Current Process LogonSID, User Rights and Groups - Sid logonSid = null; ArrayList userRights = new ArrayList(); ArrayList userGroups = new ArrayList(); TOKEN_GROUPS groups; @@ -598,9 +596,7 @@ namespace Ansible } } // Do not include the Logon SID in the groups category - if (attributes.HasFlag(TokenGroupAttributes.SE_GROUP_LOGON_ID)) - logonSid = new Sid(sidAndAttribute.Sid); - else + if (!attributes.HasFlag(TokenGroupAttributes.SE_GROUP_LOGON_ID)) { Hashtable groupInfo = new Hashtable(); Sid group = new Sid(sidAndAttribute.Sid); @@ -645,7 +641,6 @@ namespace Ansible Marshal.FreeHGlobal(tokenStatsPtr); SessionInfo sessionInfo = GetSessionDataForLogonSession(tokenStats.AuthenticationId); - sessionInfo.LogonSid = logonSid; sessionInfo.Groups = userGroups; sessionInfo.Label = integritySid; sessionInfo.ImpersonationLevel = tokenStats.ImpersonationLevel; diff --git a/lib/ansible/modules/windows/win_whoami.py b/lib/ansible/modules/windows/win_whoami.py index 98b383b77cd..999b2b9a1bf 100644 --- a/lib/ansible/modules/windows/win_whoami.py +++ b/lib/ansible/modules/windows/win_whoami.py @@ -133,31 +133,6 @@ groups: "type": "Alias" } ] -logon_sid: - description: The logon SID details. - returned: success - type: complex - contains: - domain_name: - description: The domain name of the logon SID. - returned: success - type: str - sample: NT AUTHORITY - sid: - description: The SID in string form. - returned: success - type: str - sample: S-1-5-5-0-4163312 - account_name: - description: The account name of the logon SID. - returned: success - type: str - sample: LogonSessionId_0_4163312 - type: - description: The type of SID. - returned: success - type: str - sample: Logon account: description: The running account SID details. returned: success diff --git a/test/integration/targets/win_whoami/tasks/main.yml b/test/integration/targets/win_whoami/tasks/main.yml index 22603ac1803..f4351fca388 100644 --- a/test/integration/targets/win_whoami/tasks/main.yml +++ b/test/integration/targets/win_whoami/tasks/main.yml @@ -28,10 +28,6 @@ - win_whoami_result.login_time is defined - win_whoami_result.logon_id is defined - win_whoami_result.logon_server is defined - - win_whoami_result.logon_sid.account_name is defined - - win_whoami_result.logon_sid.domain_name is defined - - win_whoami_result.logon_sid.sid is defined - - win_whoami_result.logon_sid.type == 'Logon' - win_whoami_result.logon_type.startswith('Network') - win_whoami_result.privileges is defined - win_whoami_result.rights|count >= 1 @@ -71,7 +67,6 @@ - win_whoami_result.login_time is defined - win_whoami_result.logon_id is defined - win_whoami_result.logon_server is defined - - win_whoami_result.logon_sid == None - win_whoami_result.logon_type == 'System' - win_whoami_result.privileges is defined - win_whoami_result.rights|count >= 1 @@ -164,10 +159,6 @@ - win_whoami_result.login_time is defined - win_whoami_result.logon_id is defined - win_whoami_result.logon_server is defined - - win_whoami_result.logon_sid.account_name is defined - - win_whoami_result.logon_sid.domain_name is defined - - win_whoami_result.logon_sid.sid is defined - - win_whoami_result.logon_sid.type == 'Logon' - win_whoami_result.logon_type == "Interactive" - win_whoami_result.privileges is defined - '"SeInteractiveLogonRight" in win_whoami_result.rights' @@ -205,10 +196,6 @@ - win_whoami_result.login_time is defined - win_whoami_result.logon_id is defined - win_whoami_result.logon_server is defined - - win_whoami_result.logon_sid.account_name is defined - - win_whoami_result.logon_sid.domain_name is defined - - win_whoami_result.logon_sid.sid is defined - - win_whoami_result.logon_sid.type == 'Logon' - win_whoami_result.logon_type == "Interactive" - win_whoami_result.privileges is defined - win_whoami_result.rights == []