libfreerdp-rail: rename UNICODE_STRING to RAIL_UNICODE_STRING to avoid conflict
This commit is contained in:
parent
34fc918da1
commit
1aa0512490
@ -60,7 +60,7 @@ static const char* const RAIL_ORDER_TYPE_STRINGS[] =
|
||||
"Execute Result"
|
||||
};
|
||||
|
||||
void rail_string_to_unicode_string(rdpRailOrder* rail_order, char* string, UNICODE_STRING* unicode_string)
|
||||
void rail_string_to_unicode_string(rdpRailOrder* rail_order, char* string, RAIL_UNICODE_STRING* unicode_string)
|
||||
{
|
||||
char* buffer;
|
||||
size_t length = 0;
|
||||
|
@ -54,7 +54,7 @@
|
||||
#define RAIL_GET_APPID_REQ_ORDER_LENGTH 4 /* fixed */
|
||||
#define RAIL_LANGBAR_INFO_ORDER_LENGTH 4 /* fixed */
|
||||
|
||||
void rail_string_to_unicode_string(rdpRailOrder* rail_order, char* string, UNICODE_STRING* unicode_string);
|
||||
void rail_string_to_unicode_string(rdpRailOrder* rail_order, char* string, RAIL_UNICODE_STRING* unicode_string);
|
||||
|
||||
void rail_read_handshake_order(STREAM* s, RAIL_HANDSHAKE_ORDER* handshake);
|
||||
void rail_read_server_exec_result_order(STREAM* s, RAIL_EXEC_RESULT_ORDER* exec_result);
|
||||
|
@ -30,6 +30,7 @@ FREERDP_API int der_skip_octet_string(int length);
|
||||
FREERDP_API int der_skip_sequence_tag(int length);
|
||||
FREERDP_API int der_write_sequence_tag(STREAM* s, int length);
|
||||
FREERDP_API int der_skip_contextual_tag(int length);
|
||||
FREERDP_API int der_write_contextual_tag(STREAM* s, uint8 tag, int length, boolean pc);
|
||||
FREERDP_API void der_write_octet_string(STREAM* s, uint8* oct_str, int length);
|
||||
|
||||
#endif /* FREERDP_CRYPTO_DER_H */
|
||||
|
@ -150,18 +150,18 @@ enum SPI_MASK
|
||||
#define TF_SFT_NOEXTRAICONSONMINIMIZED 0x00000400
|
||||
#define TF_SFT_DESKBAND 0x00000800
|
||||
|
||||
struct _UNICODE_STRING
|
||||
struct _RAIL_UNICODE_STRING
|
||||
{
|
||||
uint16 length;
|
||||
uint8* string;
|
||||
};
|
||||
typedef struct _UNICODE_STRING UNICODE_STRING;
|
||||
typedef struct _RAIL_UNICODE_STRING RAIL_UNICODE_STRING;
|
||||
|
||||
struct _HIGH_CONTRAST
|
||||
{
|
||||
uint32 flags;
|
||||
uint32 colorSchemeLength;
|
||||
UNICODE_STRING colorScheme;
|
||||
RAIL_UNICODE_STRING colorScheme;
|
||||
};
|
||||
typedef struct _HIGH_CONTRAST HIGH_CONTRAST;
|
||||
|
||||
@ -182,9 +182,9 @@ typedef struct _RAIL_CLIENT_STATUS_ORDER RAIL_CLIENT_STATUS_ORDER;
|
||||
struct _RAIL_EXEC_ORDER
|
||||
{
|
||||
uint16 flags;
|
||||
UNICODE_STRING exeOrFile;
|
||||
UNICODE_STRING workingDir;
|
||||
UNICODE_STRING arguments;
|
||||
RAIL_UNICODE_STRING exeOrFile;
|
||||
RAIL_UNICODE_STRING workingDir;
|
||||
RAIL_UNICODE_STRING arguments;
|
||||
};
|
||||
typedef struct _RAIL_EXEC_ORDER RAIL_EXEC_ORDER;
|
||||
|
||||
@ -193,7 +193,7 @@ struct _RAIL_EXEC_RESULT_ORDER
|
||||
uint16 flags;
|
||||
uint16 execResult;
|
||||
uint32 rawResult;
|
||||
UNICODE_STRING exeOrFile;
|
||||
RAIL_UNICODE_STRING exeOrFile;
|
||||
};
|
||||
typedef struct _RAIL_EXEC_RESULT_ORDER RAIL_EXEC_RESULT_ORDER;
|
||||
|
||||
@ -287,7 +287,7 @@ typedef struct _RAIL_GET_APPID_REQ_ORDER RAIL_GET_APPID_REQ_ORDER;
|
||||
struct _RAIL_GET_APPID_RESP_ORDER
|
||||
{
|
||||
uint32 windowId;
|
||||
UNICODE_STRING applicationId;
|
||||
RAIL_UNICODE_STRING applicationId;
|
||||
uint8 applicationIdBuffer[512];
|
||||
};
|
||||
typedef struct _RAIL_GET_APPID_RESP_ORDER RAIL_GET_APPID_RESP_ORDER;
|
||||
|
@ -46,7 +46,7 @@ struct rdp_window
|
||||
uint32 style;
|
||||
uint32 extendedStyle;
|
||||
uint8 showState;
|
||||
UNICODE_STRING titleInfo;
|
||||
RAIL_UNICODE_STRING titleInfo;
|
||||
uint32 clientOffsetX;
|
||||
uint32 clientOffsetY;
|
||||
uint32 clientAreaWidth;
|
||||
|
@ -25,11 +25,11 @@
|
||||
#include <freerdp/utils/rect.h>
|
||||
#include <freerdp/utils/stream.h>
|
||||
|
||||
FREERDP_API void rail_unicode_string_alloc(UNICODE_STRING* unicode_string, uint16 cbString);
|
||||
FREERDP_API void rail_unicode_string_free(UNICODE_STRING* unicode_string);
|
||||
FREERDP_API void rail_read_unicode_string(STREAM* s, UNICODE_STRING* unicode_string);
|
||||
FREERDP_API void rail_write_unicode_string(STREAM* s, UNICODE_STRING* unicode_string);
|
||||
FREERDP_API void rail_write_unicode_string_value(STREAM* s, UNICODE_STRING* unicode_string);
|
||||
FREERDP_API void rail_unicode_string_alloc(RAIL_UNICODE_STRING* unicode_string, uint16 cbString);
|
||||
FREERDP_API void rail_unicode_string_free(RAIL_UNICODE_STRING* unicode_string);
|
||||
FREERDP_API void rail_read_unicode_string(STREAM* s, RAIL_UNICODE_STRING* unicode_string);
|
||||
FREERDP_API void rail_write_unicode_string(STREAM* s, RAIL_UNICODE_STRING* unicode_string);
|
||||
FREERDP_API void rail_write_unicode_string_value(STREAM* s, RAIL_UNICODE_STRING* unicode_string);
|
||||
FREERDP_API void* rail_clone_order(uint32 event_type, void* order);
|
||||
FREERDP_API void rail_free_cloned_order(uint32 event_type, void* order);
|
||||
|
||||
|
@ -155,8 +155,8 @@ struct _NOTIFY_ICON_INFOTIP
|
||||
{
|
||||
uint32 timeout;
|
||||
uint32 flags;
|
||||
UNICODE_STRING text;
|
||||
UNICODE_STRING title;
|
||||
RAIL_UNICODE_STRING text;
|
||||
RAIL_UNICODE_STRING title;
|
||||
};
|
||||
typedef struct _NOTIFY_ICON_INFOTIP NOTIFY_ICON_INFOTIP;
|
||||
|
||||
@ -166,7 +166,7 @@ struct _WINDOW_STATE_ORDER
|
||||
uint32 style;
|
||||
uint32 extendedStyle;
|
||||
uint32 showState;
|
||||
UNICODE_STRING titleInfo;
|
||||
RAIL_UNICODE_STRING titleInfo;
|
||||
uint32 clientOffsetX;
|
||||
uint32 clientOffsetY;
|
||||
uint32 clientAreaWidth;
|
||||
@ -203,7 +203,7 @@ typedef struct _WINDOW_CACHED_ICON_ORDER WINDOW_CACHED_ICON_ORDER;
|
||||
struct _NOTIFY_ICON_STATE_ORDER
|
||||
{
|
||||
uint32 version;
|
||||
UNICODE_STRING toolTip;
|
||||
RAIL_UNICODE_STRING toolTip;
|
||||
NOTIFY_ICON_INFOTIP infoTip;
|
||||
uint32 state;
|
||||
ICON_INFO icon;
|
||||
|
34
include/winpr/security.h
Normal file
34
include/winpr/security.h
Normal file
@ -0,0 +1,34 @@
|
||||
/**
|
||||
* WinPR: Windows Portable Runtime
|
||||
* Security Definitions
|
||||
*
|
||||
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef WINPR_SECURITY_H
|
||||
#define WINPR_SECURITY_H
|
||||
|
||||
#include <winpr/winpr.h>
|
||||
#include <winpr/wtypes.h>
|
||||
|
||||
typedef struct _LSA_UNICODE_STRING
|
||||
{
|
||||
USHORT Length;
|
||||
USHORT MaximumLength;
|
||||
PWSTR Buffer;
|
||||
} LSA_UNICODE_STRING, *PLSA_UNICODE_STRING, UNICODE_STRING, *PUNICODE_STRING;
|
||||
|
||||
#endif /* WINPR_SECURITY_H */
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <winpr/winpr.h>
|
||||
#include <winpr/wtypes.h>
|
||||
#include <winpr/windows.h>
|
||||
#include <winpr/security.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
|
@ -60,6 +60,11 @@ int der_get_content_length(int length)
|
||||
return length - 2;
|
||||
}
|
||||
|
||||
int der_skip_contextual_tag(int length)
|
||||
{
|
||||
return _der_skip_length(length) + 1;
|
||||
}
|
||||
|
||||
int der_write_contextual_tag(STREAM* s, uint8 tag, int length, boolean pc)
|
||||
{
|
||||
stream_write_uint8(s, (ER_CLASS_CTXT | ER_PC(pc)) | (ER_TAG_MASK & tag));
|
||||
@ -94,7 +99,3 @@ int der_write_sequence_tag(STREAM* s, int length)
|
||||
return der_write_length(s, length) + 1;
|
||||
}
|
||||
|
||||
int der_skip_contextual_tag(int length)
|
||||
{
|
||||
return _der_skip_length(length) + 1;
|
||||
}
|
||||
|
@ -311,7 +311,7 @@ int credssp_client_authenticate(rdpCredssp* credssp)
|
||||
return -1;
|
||||
|
||||
#ifdef WITH_DEBUG_CREDSSP
|
||||
printf("Receiving Authentication Token (%d)\n", credssp->negoToken.cbBuffer);
|
||||
printf("Receiving Authentication Token (%d)\n", (int) credssp->negoToken.cbBuffer);
|
||||
winpr_HexDump(credssp->negoToken.pvBuffer, credssp->negoToken.cbBuffer);
|
||||
#endif
|
||||
|
||||
@ -655,7 +655,7 @@ SECURITY_STATUS credssp_decrypt_public_key_echo(rdpCredssp* credssp)
|
||||
|
||||
if (credssp->PublicKey.cbBuffer + credssp->ContextSizes.cbMaxSignature != credssp->pubKeyAuth.cbBuffer)
|
||||
{
|
||||
printf("credssp_decrypt_public_key_echo: unexpected pubKeyAuth buffer size:%d\n", credssp->pubKeyAuth.cbBuffer);
|
||||
printf("unexpected pubKeyAuth buffer size:%d\n", (int) credssp->pubKeyAuth.cbBuffer);
|
||||
return SEC_E_INVALID_TOKEN;
|
||||
}
|
||||
|
||||
|
@ -23,13 +23,13 @@
|
||||
#include <freerdp/utils/rail.h>
|
||||
#include <freerdp/rail.h>
|
||||
|
||||
void rail_unicode_string_alloc(UNICODE_STRING* unicode_string, uint16 cbString)
|
||||
void rail_unicode_string_alloc(RAIL_UNICODE_STRING* unicode_string, uint16 cbString)
|
||||
{
|
||||
unicode_string->length = cbString;
|
||||
unicode_string->string = xzalloc(cbString);
|
||||
}
|
||||
|
||||
void rail_unicode_string_free(UNICODE_STRING* unicode_string)
|
||||
void rail_unicode_string_free(RAIL_UNICODE_STRING* unicode_string)
|
||||
{
|
||||
unicode_string->length = 0;
|
||||
|
||||
@ -37,7 +37,7 @@ void rail_unicode_string_free(UNICODE_STRING* unicode_string)
|
||||
xfree(unicode_string->string);
|
||||
}
|
||||
|
||||
void rail_read_unicode_string(STREAM* s, UNICODE_STRING* unicode_string)
|
||||
void rail_read_unicode_string(STREAM* s, RAIL_UNICODE_STRING* unicode_string)
|
||||
{
|
||||
stream_read_uint16(s, unicode_string->length); /* cbString (2 bytes) */
|
||||
|
||||
@ -49,14 +49,14 @@ void rail_read_unicode_string(STREAM* s, UNICODE_STRING* unicode_string)
|
||||
stream_read(s, unicode_string->string, unicode_string->length);
|
||||
}
|
||||
|
||||
void rail_write_unicode_string(STREAM* s, UNICODE_STRING* unicode_string)
|
||||
void rail_write_unicode_string(STREAM* s, RAIL_UNICODE_STRING* unicode_string)
|
||||
{
|
||||
stream_check_size(s, 2 + unicode_string->length);
|
||||
stream_write_uint16(s, unicode_string->length); /* cbString (2 bytes) */
|
||||
stream_write(s, unicode_string->string, unicode_string->length); /* string */
|
||||
}
|
||||
|
||||
void rail_write_unicode_string_value(STREAM* s, UNICODE_STRING* unicode_string)
|
||||
void rail_write_unicode_string_value(STREAM* s, RAIL_UNICODE_STRING* unicode_string)
|
||||
{
|
||||
if (unicode_string->length > 0)
|
||||
{
|
||||
|
@ -61,6 +61,7 @@ set_target_properties(winpr-sspi PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVE
|
||||
|
||||
if (NOT WIN32)
|
||||
target_link_libraries(winpr-sspi winpr-crt)
|
||||
target_link_libraries(winpr-sspi winpr-sysinfo)
|
||||
endif()
|
||||
|
||||
target_link_libraries(winpr-sspi winpr-utils)
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/sspi.h>
|
||||
#include <winpr/print.h>
|
||||
#include <winpr/sysinfo.h>
|
||||
|
||||
#include "ntlm.h"
|
||||
#include "../sspi.h"
|
||||
@ -37,18 +38,42 @@ char* NTLM_PACKAGE_NAME = "NTLM";
|
||||
|
||||
void ntlm_SetContextWorkstation(NTLM_CONTEXT* context, char* Workstation)
|
||||
{
|
||||
DWORD nSize = 0;
|
||||
|
||||
if (!Workstation)
|
||||
{
|
||||
GetComputerNameExA(ComputerNameNetBIOS, NULL, &nSize);
|
||||
Workstation = malloc(nSize);
|
||||
GetComputerNameExA(ComputerNameNetBIOS, Workstation, &nSize);
|
||||
}
|
||||
|
||||
context->WorkstationLength = strlen(Workstation) * 2;
|
||||
context->Workstation = (UINT16*) malloc(context->WorkstationLength);
|
||||
MultiByteToWideChar(CP_ACP, 0, Workstation, strlen(Workstation),
|
||||
(LPWSTR) context->Workstation, context->WorkstationLength / 2);
|
||||
|
||||
if (nSize > 0)
|
||||
free(Workstation);
|
||||
}
|
||||
|
||||
void ntlm_SetContextTargetName(NTLM_CONTEXT* context, char* TargetName)
|
||||
{
|
||||
DWORD nSize = 0;
|
||||
|
||||
if (!TargetName)
|
||||
{
|
||||
GetComputerNameExA(ComputerNameDnsHostname, NULL, &nSize);
|
||||
TargetName = malloc(nSize);
|
||||
GetComputerNameExA(ComputerNameDnsHostname, TargetName, &nSize);
|
||||
}
|
||||
|
||||
context->TargetName.cbBuffer = strlen(TargetName) * 2;
|
||||
context->TargetName.pvBuffer = (void*) malloc(context->TargetName.cbBuffer);
|
||||
MultiByteToWideChar(CP_ACP, 0, TargetName, strlen(TargetName),
|
||||
(LPWSTR) context->TargetName.pvBuffer, context->TargetName.cbBuffer / 2);
|
||||
|
||||
if (nSize > 0)
|
||||
free(TargetName);
|
||||
}
|
||||
|
||||
NTLM_CONTEXT* ntlm_ContextNew()
|
||||
@ -236,7 +261,7 @@ SECURITY_STATUS SEC_ENTRY ntlm_AcceptSecurityContext(PCredHandle phCredential, P
|
||||
credentials = (CREDENTIALS*) sspi_SecureHandleGetLowerPointer(phCredential);
|
||||
sspi_CopyAuthIdentity(&context->identity, &credentials->identity);
|
||||
|
||||
ntlm_SetContextTargetName(context, "FreeRDP");
|
||||
ntlm_SetContextTargetName(context, NULL);
|
||||
|
||||
sspi_SecureHandleSetLowerPointer(phNewContext, context);
|
||||
sspi_SecureHandleSetUpperPointer(phNewContext, (void*) NTLM_PACKAGE_NAME);
|
||||
@ -348,7 +373,7 @@ SECURITY_STATUS SEC_ENTRY ntlm_InitializeSecurityContextA(PCredHandle phCredenti
|
||||
credentials = (CREDENTIALS*) sspi_SecureHandleGetLowerPointer(phCredential);
|
||||
|
||||
sspi_CopyAuthIdentity(&context->identity, &credentials->identity);
|
||||
ntlm_SetContextWorkstation(context, "WORKSTATION");
|
||||
ntlm_SetContextWorkstation(context, NULL);
|
||||
|
||||
sspi_SecureHandleSetLowerPointer(phNewContext, context);
|
||||
sspi_SecureHandleSetUpperPointer(phNewContext, (void*) NTLM_PACKAGE_NAME);
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/print.h>
|
||||
#include <winpr/stream.h>
|
||||
#include <winpr/sysinfo.h>
|
||||
|
||||
#include "ntlm_compute.h"
|
||||
|
||||
@ -118,11 +119,15 @@ static const char* const NTLM_NEGOTIATE_STRINGS[] =
|
||||
|
||||
void ntlm_output_version(PStream s)
|
||||
{
|
||||
/* Version Info for Windows 7 SP1 */
|
||||
OSVERSIONINFOA osVersionInfo;
|
||||
|
||||
StreamWrite_UINT8(s, WINDOWS_MAJOR_VERSION_6); /* ProductMajorVersion (1 byte) */
|
||||
StreamWrite_UINT8(s, WINDOWS_MINOR_VERSION_1); /* ProductMinorVersion (1 byte) */
|
||||
StreamWrite_UINT16(s, 7601); /* ProductBuild (2 bytes) */
|
||||
osVersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);
|
||||
|
||||
GetVersionExA(&osVersionInfo);
|
||||
|
||||
StreamWrite_UINT8(s, osVersionInfo.dwMajorVersion); /* ProductMajorVersion (1 byte) */
|
||||
StreamWrite_UINT8(s, osVersionInfo.dwMinorVersion); /* ProductMinorVersion (1 byte) */
|
||||
StreamWrite_UINT16(s, osVersionInfo.dwBuildNumber); /* ProductBuild (2 bytes) */
|
||||
StreamZero(s, 3); /* Reserved (3 bytes) */
|
||||
StreamWrite_UINT8(s, NTLMSSP_REVISION_W2K3); /* NTLMRevisionCurrent (1 byte) */
|
||||
}
|
||||
|
@ -63,11 +63,17 @@
|
||||
|
||||
#ifndef _WIN32
|
||||
|
||||
#include <unistd.h>
|
||||
#include <winpr/crt.h>
|
||||
#include <sys/unistd.h>
|
||||
|
||||
BOOL GetComputerNameExA(COMPUTER_NAME_FORMAT NameType, LPSTR lpBuffer, LPDWORD nSize)
|
||||
{
|
||||
char hostname[256];
|
||||
int hostname_length;
|
||||
|
||||
gethostname(hostname, sizeof(hostname));
|
||||
hostname_length = strlen(hostname);
|
||||
|
||||
switch (NameType)
|
||||
{
|
||||
case ComputerNameNetBIOS:
|
||||
@ -79,8 +85,16 @@ BOOL GetComputerNameExA(COMPUTER_NAME_FORMAT NameType, LPSTR lpBuffer, LPDWORD n
|
||||
case ComputerNamePhysicalDnsDomain:
|
||||
case ComputerNamePhysicalDnsFullyQualified:
|
||||
|
||||
if (gethostname(lpBuffer, *nSize) < 0)
|
||||
if (*nSize <= hostname_length)
|
||||
{
|
||||
*nSize = hostname_length + 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!lpBuffer)
|
||||
return 0;
|
||||
|
||||
CopyMemory(lpBuffer, hostname, hostname_length + 1);
|
||||
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user