Do not set password to identity if pth is used.
@@ -262,21 +262,7 @@ static int nla_client_init(rdpNla* nla)
}
else
{
- if (sspi_SetAuthIdentity(nla->identity, settings->Username, settings->Domain,
- settings->Password) < 0)
- return -1;
- }
- }
-
-#ifndef _WIN32
- {
- SEC_WINNT_AUTH_IDENTITY* identity = nla->identity;
-
- if (!identity)
- {
- WLog_ERR(TAG, "NLA identity=%p", (void*) identity);
- return -1;
- }
+ BOOL usePassword = TRUE;
if (settings->RestrictedAdminModeRequired)
{
@@ -284,19 +270,29 @@ static int nla_client_init(rdpNla* nla)
{
if (strlen(settings->PasswordHash) == 32)
{
- free(identity->Password);
- identity->PasswordLength = ConvertToUnicode(CP_UTF8, 0,
- settings->PasswordHash, -1, &identity->Password, 0) - 1;
+ if (sspi_SetAuthIdentity(nla->identity, settings->Username, settings->Domain,
+ settings->PasswordHash) < 0)
+ return -1;
+
/**
- * Multiply password hash length by 64 to obtain a length exceeding
- * the maximum (256) and use it this for hash identification in WinPR.
+ * Increase password hash length by LB_PASSWORD_MAX_LENGTH to obtain a length exceeding
+ * the maximum (LB_PASSWORD_MAX_LENGTH) and use it this for hash identification in WinPR.
*/
- identity->PasswordLength += LB_PASSWORD_MAX_LENGTH;
+ nla->identity->PasswordLength += LB_PASSWORD_MAX_LENGTH;
+ usePassword = FALSE;
}
}
}
+
+ if (usePassword)
+ {
+ if (sspi_SetAuthIdentity(nla->identity, settings->Username, settings->Domain,
+ settings->Password) < 0)
+ return -1;
+ }
+ }
}
-#endif
+
tls = nla->transport->tls;
if (!tls)
