Skip to content

Commit 1bcdbf4

Browse files
committed
Fix in passwd to include domain prefix in user name
1 parent 49da240 commit 1bcdbf4

File tree

1 file changed

+3
-3
lines changed
  • contrib/win32/win32compat

1 file changed

+3
-3
lines changed

contrib/win32/win32compat/pwd.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ initialize_pw() {
5353

5454
void
5555
reset_pw() {
56+
initialize_pw();
5657
if (pw.pw_name)
5758
free(pw.pw_name);
5859
if (pw.pw_dir)
@@ -72,8 +73,7 @@ get_passwd(const char *user_utf8, LPWSTR user_sid) {
7273

7374
errno = 0;
7475

75-
if (initialize_pw() != 0)
76-
goto done;
76+
reset_pw();
7777

7878
if ((user_utf16 = utf8_to_utf16(user_utf8) ) == NULL) {
7979
errno = ENOMEM;
@@ -111,7 +111,7 @@ get_passwd(const char *user_utf8, LPWSTR user_sid) {
111111
RegQueryValueExW(reg_key, L"ProfileImagePath", 0, NULL, (LPBYTE)profile_home, &tmp_len) != 0)
112112
GetWindowsDirectoryW(profile_home, MAX_PATH);
113113

114-
if ((uname_utf8 = utf16_to_utf8(uname_utf16)) == NULL ||
114+
if ((uname_utf8 = _strdup(user_utf8)) == NULL ||
115115
(pw_home_utf8 = utf16_to_utf8(profile_home)) == NULL) {
116116
errno = ENOMEM;
117117
goto done;

0 commit comments

Comments
 (0)