Fixed handling of optional TSPasswordCreds field.

This commit is contained in:
Armin Novak 2015-07-01 15:28:35 +02:00
parent 59e2801848
commit 8479c824fd

View File

@ -916,15 +916,31 @@ BOOL nla_read_ts_password_creds(rdpNla* nla, wStream* s)
return FALSE;
}
/* TSPasswordCreds (SEQUENCE) */
if (!ber_read_sequence_tag(s, &length) ||
/* TSPasswordCreds (SEQUENCE)
* Initialise to default values. */
nla->identity->Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE;
/* [0] domainName (OCTET STRING) */
!ber_read_contextual_tag(s, 0, &length, TRUE) ||
nla->identity->UserLength = (UINT32) 0;
nla->identity->User = NULL;
nla->identity->DomainLength = (UINT32) 0;
nla->identity->Domain = NULL;
nla->identity->Password = NULL;
nla->identity->PasswordLength = (UINT32) 0;
/* The sequence is empty, return early,
* TSPasswordCreds (SEQUENCE) is optional. */
if (!ber_read_sequence_tag(s, &length))
return TRUE;
/* [0] domainName (OCTET STRING) */
if (!ber_read_contextual_tag(s, 0, &length, TRUE) ||
!ber_read_octet_string_tag(s, &length))
{
return FALSE;
}
nla->identity->DomainLength = (UINT32) length;
if (nla->identity->DomainLength > 0)
{
@ -935,8 +951,6 @@ BOOL nla_read_ts_password_creds(rdpNla* nla, wStream* s)
Stream_Seek(s, nla->identity->DomainLength);
nla->identity->DomainLength /= 2;
}
else
nla->identity->Domain = NULL;
/* [1] userName (OCTET STRING) */
if (!ber_read_contextual_tag(s, 1, &length, TRUE) ||
@ -944,6 +958,7 @@ BOOL nla_read_ts_password_creds(rdpNla* nla, wStream* s)
{
return FALSE;
}
nla->identity->UserLength = (UINT32) length;
if (nla->identity->UserLength > 0)
{
@ -954,8 +969,6 @@ BOOL nla_read_ts_password_creds(rdpNla* nla, wStream* s)
Stream_Seek(s, nla->identity->UserLength);
nla->identity->UserLength /= 2;
}
else
nla->identity->User = NULL;
/* [2] password (OCTET STRING) */
if (!ber_read_contextual_tag(s, 2, &length, TRUE) ||
@ -963,6 +976,7 @@ BOOL nla_read_ts_password_creds(rdpNla* nla, wStream* s)
{
return FALSE;
}
nla->identity->PasswordLength = (UINT32) length;
if (nla->identity->PasswordLength > 0)
{
@ -973,10 +987,6 @@ BOOL nla_read_ts_password_creds(rdpNla* nla, wStream* s)
Stream_Seek(s, nla->identity->PasswordLength);
nla->identity->PasswordLength /= 2;
}
else
nla->identity->Password = NULL;
nla->identity->Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE;
return TRUE;
}