Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds support for system account lookup #478

Merged
merged 4 commits into from
Mar 27, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions contrib/win32/win32compat/pwd.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,13 @@ get_passwd(const wchar_t * user_utf16, PSID sid)
goto cleanup;
}

bagajjal marked this conversation as resolved.
Show resolved Hide resolved
/* If standard local user name, just use name without decoration */
if ((_wcsicmp(domain_name, computer_name) == 0) && (_wcsicmp(computer_name, user_name) != 0))
/* if standard local user name or system account, just use name without decoration */
const SID_IDENTIFIER_AUTHORITY nt_authority = SECURITY_NT_AUTHORITY;
bagajjal marked this conversation as resolved.
Show resolved Hide resolved
if (((_wcsicmp(domain_name, computer_name) == 0) && (_wcsicmp(computer_name, user_name) != 0)) ||
((memcmp(&nt_authority, GetSidIdentifierAuthority((PSID)binary_sid), sizeof(SID_IDENTIFIER_AUTHORITY)) == 0) &&
(((SID*)binary_sid)->SubAuthority[0] == SECURITY_LOCAL_SYSTEM_RID))) {
wcscpy_s(user_resolved, ARRAYSIZE(user_resolved), user_name);
}

/* put any other format in sam compatible format */
else
Expand Down