libwinpr-sspi: improve native SSPI build

This commit is contained in:
Marc-André Moreau
2012-06-06 19:20:05 -04:00
parent 5ed9796e96
commit e588bb2bf0
4 changed files with 17 additions and 3 deletions

View File

@@ -1020,6 +1020,9 @@ void credssp_send(rdpCredssp* credssp)
ber_write_octet_string(s, credssp->pubKeyAuth.pvBuffer, length);
}
printf("Sending Token (%d)\n", stream_get_length(s));
freerdp_hexdump(s->data, stream_get_length(s));
tls_write(credssp->tls, s->data, stream_get_length(s));
stream_free(s);
}
@@ -1039,13 +1042,17 @@ int credssp_recv(rdpCredssp* credssp)
s = stream_new(2048);
status = tls_read(credssp->tls, s->data, stream_get_left(s));
s->size = status;
if (status < 0)
{
stream_free(s) ;
stream_free(s);
return -1;
}
printf("Receiving Token (%d)\n", s->size);
freerdp_hexdump(s->data, s->size);
/* TSRequest */
ber_read_sequence_tag(s, &length);
ber_read_contextual_tag(s, 0, &length, true);

View File

@@ -62,8 +62,10 @@ NTLM_CONTEXT* ntlm_ContextNew()
{
context->ntlm_v2 = 0;
context->NegotiateFlags = 0;
context->SendVersionInfo = 1;
context->LmCompatibilityLevel = 3;
context->state = NTLM_STATE_INITIAL;
context->SuppressExtendedProtection = 1;
context->av_pairs = (AV_PAIRS*) malloc(sizeof(AV_PAIRS));
ZeroMemory(context->av_pairs, sizeof(AV_PAIRS));
}

View File

@@ -89,6 +89,7 @@ struct _NTLM_CONTEXT
NTLM_STATE state;
int SendSeqNum;
int RecvSeqNum;
int SendVersionInfo;
BOOL confidentiality;
RC4_KEY SendRc4Seal;
RC4_KEY RecvRc4Seal;
@@ -101,6 +102,7 @@ struct _NTLM_CONTEXT
UINT16* Workstation;
UINT32 WorkstationLength;
int LmCompatibilityLevel;
int SuppressExtendedProtection;
SEC_WINNT_AUTH_IDENTITY identity;
SecBuffer NegotiateMessage;
SecBuffer ChallengeMessage;

View File

@@ -118,11 +118,11 @@ static const char* const NTLM_NEGOTIATE_STRINGS[] =
void ntlm_output_version(PStream s)
{
/* The following version information was observed with Windows 7 */
/* Version Info for Windows 7 SP1 */
StreamWrite_UINT8(s, WINDOWS_MAJOR_VERSION_6); /* ProductMajorVersion (1 byte) */
StreamWrite_UINT8(s, WINDOWS_MINOR_VERSION_1); /* ProductMinorVersion (1 byte) */
StreamWrite_UINT16(s, 7600); /* ProductBuild (2 bytes) */
StreamWrite_UINT16(s, 7601); /* ProductBuild (2 bytes) */
StreamZero(s, 3); /* Reserved (3 bytes) */
StreamWrite_UINT8(s, NTLMSSP_REVISION_W2K3); /* NTLMRevisionCurrent (1 byte) */
}
@@ -263,6 +263,9 @@ SECURITY_STATUS ntlm_write_NegotiateMessage(NTLM_CONTEXT* context, PSecBuffer bu
if (context->confidentiality)
NegotiateFlags |= NTLMSSP_NEGOTIATE_SEAL;
if (context->SendVersionInfo)
NegotiateFlags |= NTLMSSP_NEGOTIATE_VERSION;
context->NegotiateFlags = NegotiateFlags;
StreamWrite_UINT32(s, NegotiateFlags); /* NegotiateFlags (4 bytes) */