summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Borean <jborean93@gmail.com>2022-04-14 03:32:09 +1000
committerGitHub <noreply@github.com>2022-04-13 12:32:09 -0500
commit8fb813918b7d53c88de210db6b9a7d4b4de960ea (patch)
treed4848e6f80a1ef1ea1e0998226c16e296d57a14c
parent874f4323ef1c6126abd2c446f313473491c524ba (diff)
downloadansible-8fb813918b7d53c88de210db6b9a7d4b4de960ea.tar.gz
SID - Use literal UPN value when attempting a user to SID lookup (#77334) (#77347)
(cherry picked from commit ff184b0815cdbf7dc222fd9d7b0cfaa93d5fe03c)
-rw-r--r--changelogs/fragments/ModuleUtils.SID-long-username.yml2
-rw-r--r--lib/ansible/module_utils/powershell/Ansible.ModuleUtils.SID.psm14
2 files changed, 2 insertions, 4 deletions
diff --git a/changelogs/fragments/ModuleUtils.SID-long-username.yml b/changelogs/fragments/ModuleUtils.SID-long-username.yml
new file mode 100644
index 0000000000..dbf02cee0e
--- /dev/null
+++ b/changelogs/fragments/ModuleUtils.SID-long-username.yml
@@ -0,0 +1,2 @@
+bugfixes:
+- Ansible.ModuleUtils.SID - Use user principal name as is for lookup in the ``Convert-ToSID`` function - https://github.com/ansible/ansible/issues/77316
diff --git a/lib/ansible/module_utils/powershell/Ansible.ModuleUtils.SID.psm1 b/lib/ansible/module_utils/powershell/Ansible.ModuleUtils.SID.psm1
index 38c02cc26a..a66c6423e6 100644
--- a/lib/ansible/module_utils/powershell/Ansible.ModuleUtils.SID.psm1
+++ b/lib/ansible/module_utils/powershell/Ansible.ModuleUtils.SID.psm1
@@ -44,10 +44,6 @@ Function Convert-ToSID {
$domain = $account_name_split[0]
}
$username = $account_name_split[1]
- } elseif ($account_name -like "*@*") {
- $account_name_split = $account_name -split "@"
- $domain = $account_name_split[1]
- $username = $account_name_split[0]
} else {
$domain = $null
$username = $account_name