Removed use of strcpy.
This commit is contained in:
parent
9e3b48e0fb
commit
114abad767
@ -87,9 +87,8 @@ extern const STATIC_ADDIN_TABLE CLIENT_STATIC_ADDIN_TABLE[];
|
|||||||
FREERDP_ADDIN** freerdp_channels_list_client_static_addins(LPSTR pszName, LPSTR pszSubsystem,
|
FREERDP_ADDIN** freerdp_channels_list_client_static_addins(LPSTR pszName, LPSTR pszSubsystem,
|
||||||
LPSTR pszType, DWORD dwFlags)
|
LPSTR pszType, DWORD dwFlags)
|
||||||
{
|
{
|
||||||
int i, j;
|
size_t i, j;
|
||||||
DWORD nAddins;
|
DWORD nAddins;
|
||||||
FREERDP_ADDIN* pAddin = NULL;
|
|
||||||
FREERDP_ADDIN** ppAddins = NULL;
|
FREERDP_ADDIN** ppAddins = NULL;
|
||||||
STATIC_SUBSYSTEM_ENTRY* subsystems;
|
STATIC_SUBSYSTEM_ENTRY* subsystems;
|
||||||
nAddins = 0;
|
nAddins = 0;
|
||||||
@ -105,7 +104,7 @@ FREERDP_ADDIN** freerdp_channels_list_client_static_addins(LPSTR pszName, LPSTR
|
|||||||
|
|
||||||
for (i = 0; CLIENT_STATIC_ADDIN_TABLE[i].name != NULL; i++)
|
for (i = 0; CLIENT_STATIC_ADDIN_TABLE[i].name != NULL; i++)
|
||||||
{
|
{
|
||||||
pAddin = (FREERDP_ADDIN*) calloc(1, sizeof(FREERDP_ADDIN));
|
FREERDP_ADDIN* pAddin = (FREERDP_ADDIN*) calloc(1, sizeof(FREERDP_ADDIN));
|
||||||
|
|
||||||
if (!pAddin)
|
if (!pAddin)
|
||||||
{
|
{
|
||||||
@ -113,7 +112,7 @@ FREERDP_ADDIN** freerdp_channels_list_client_static_addins(LPSTR pszName, LPSTR
|
|||||||
goto error_out;
|
goto error_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(pAddin->cName, CLIENT_STATIC_ADDIN_TABLE[i].name);
|
sprintf_s(pAddin->cName, ARRAYSIZE(pAddin->cName), "%s", CLIENT_STATIC_ADDIN_TABLE[i].name);
|
||||||
pAddin->dwFlags = FREERDP_ADDIN_CLIENT;
|
pAddin->dwFlags = FREERDP_ADDIN_CLIENT;
|
||||||
pAddin->dwFlags |= FREERDP_ADDIN_STATIC;
|
pAddin->dwFlags |= FREERDP_ADDIN_STATIC;
|
||||||
pAddin->dwFlags |= FREERDP_ADDIN_NAME;
|
pAddin->dwFlags |= FREERDP_ADDIN_NAME;
|
||||||
@ -130,8 +129,8 @@ FREERDP_ADDIN** freerdp_channels_list_client_static_addins(LPSTR pszName, LPSTR
|
|||||||
goto error_out;
|
goto error_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(pAddin->cName, CLIENT_STATIC_ADDIN_TABLE[i].name);
|
sprintf_s(pAddin->cName, ARRAYSIZE(pAddin->cName), "%s", CLIENT_STATIC_ADDIN_TABLE[i].name);
|
||||||
strcpy(pAddin->cSubsystem, subsystems[j].name);
|
_snprintf(pAddin->cSubsystem, ARRAYSIZE(pAddin->cSubsystem), "%s", subsystems[j].name);
|
||||||
pAddin->dwFlags = FREERDP_ADDIN_CLIENT;
|
pAddin->dwFlags = FREERDP_ADDIN_CLIENT;
|
||||||
pAddin->dwFlags |= FREERDP_ADDIN_STATIC;
|
pAddin->dwFlags |= FREERDP_ADDIN_STATIC;
|
||||||
pAddin->dwFlags |= FREERDP_ADDIN_NAME;
|
pAddin->dwFlags |= FREERDP_ADDIN_NAME;
|
||||||
|
@ -1259,7 +1259,7 @@ BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS pEntryPoints, PVOID p
|
|||||||
CHANNEL_OPTION_ENCRYPT_RDP |
|
CHANNEL_OPTION_ENCRYPT_RDP |
|
||||||
CHANNEL_OPTION_COMPRESS_RDP |
|
CHANNEL_OPTION_COMPRESS_RDP |
|
||||||
CHANNEL_OPTION_SHOW_PROTOCOL;
|
CHANNEL_OPTION_SHOW_PROTOCOL;
|
||||||
strcpy(cliprdr->channelDef.name, "cliprdr");
|
sprintf_s(cliprdr->channelDef.name, ARRAYSIZE(cliprdr->channelDef.name), "cliprdr");
|
||||||
pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP_EX*) pEntryPoints;
|
pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP_EX*) pEntryPoints;
|
||||||
|
|
||||||
if ((pEntryPointsEx->cbSize >= sizeof(CHANNEL_ENTRY_POINTS_FREERDP_EX)) &&
|
if ((pEntryPointsEx->cbSize >= sizeof(CHANNEL_ENTRY_POINTS_FREERDP_EX)) &&
|
||||||
|
@ -1615,7 +1615,7 @@ BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS_EX pEntryPoints, PVOI
|
|||||||
CHANNEL_OPTION_INITIALIZED |
|
CHANNEL_OPTION_INITIALIZED |
|
||||||
CHANNEL_OPTION_ENCRYPT_RDP |
|
CHANNEL_OPTION_ENCRYPT_RDP |
|
||||||
CHANNEL_OPTION_COMPRESS_RDP;
|
CHANNEL_OPTION_COMPRESS_RDP;
|
||||||
strcpy(drdynvc->channelDef.name, "drdynvc");
|
sprintf_s(drdynvc->channelDef.name, ARRAYSIZE(drdynvc->channelDef.name), "drdynvc");
|
||||||
drdynvc->state = DRDYNVC_STATE_INITIAL;
|
drdynvc->state = DRDYNVC_STATE_INITIAL;
|
||||||
pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP_EX*) pEntryPoints;
|
pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP_EX*) pEntryPoints;
|
||||||
|
|
||||||
|
@ -1219,7 +1219,7 @@ BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS_EX pEntryPoints, PVOI
|
|||||||
CHANNEL_OPTION_ENCRYPT_RDP |
|
CHANNEL_OPTION_ENCRYPT_RDP |
|
||||||
CHANNEL_OPTION_COMPRESS_RDP |
|
CHANNEL_OPTION_COMPRESS_RDP |
|
||||||
CHANNEL_OPTION_SHOW_PROTOCOL;
|
CHANNEL_OPTION_SHOW_PROTOCOL;
|
||||||
strcpy(encomsp->channelDef.name, "encomsp");
|
sprintf_s(encomsp->channelDef.name, ARRAYSIZE(encomsp->channelDef.name), "encomsp");
|
||||||
pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP_EX*) pEntryPoints;
|
pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP_EX*) pEntryPoints;
|
||||||
|
|
||||||
if ((pEntryPointsEx->cbSize >= sizeof(CHANNEL_ENTRY_POINTS_FREERDP_EX)) &&
|
if ((pEntryPointsEx->cbSize >= sizeof(CHANNEL_ENTRY_POINTS_FREERDP_EX)) &&
|
||||||
|
@ -897,7 +897,7 @@ BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS pEntryPoints, PVOID p
|
|||||||
CHANNEL_OPTION_ENCRYPT_RDP |
|
CHANNEL_OPTION_ENCRYPT_RDP |
|
||||||
CHANNEL_OPTION_COMPRESS_RDP |
|
CHANNEL_OPTION_COMPRESS_RDP |
|
||||||
CHANNEL_OPTION_SHOW_PROTOCOL;
|
CHANNEL_OPTION_SHOW_PROTOCOL;
|
||||||
strcpy(rail->channelDef.name, "rail");
|
sprintf_s(rail->channelDef.name, ARRAYSIZE(rail->channelDef.name), "rail");
|
||||||
pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP_EX*) pEntryPoints;
|
pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP_EX*) pEntryPoints;
|
||||||
|
|
||||||
if ((pEntryPointsEx->cbSize >= sizeof(CHANNEL_ENTRY_POINTS_FREERDP_EX)) &&
|
if ((pEntryPointsEx->cbSize >= sizeof(CHANNEL_ENTRY_POINTS_FREERDP_EX)) &&
|
||||||
|
@ -1866,7 +1866,7 @@ BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS pEntryPoints, PVOID p
|
|||||||
CHANNEL_OPTION_INITIALIZED |
|
CHANNEL_OPTION_INITIALIZED |
|
||||||
CHANNEL_OPTION_ENCRYPT_RDP |
|
CHANNEL_OPTION_ENCRYPT_RDP |
|
||||||
CHANNEL_OPTION_COMPRESS_RDP;
|
CHANNEL_OPTION_COMPRESS_RDP;
|
||||||
strcpy(rdpdr->channelDef.name, "rdpdr");
|
sprintf_s(rdpdr->channelDef.name, ARRAYSIZE(rdpdr->channelDef.name), "rdpdr");
|
||||||
rdpdr->sequenceId = 0;
|
rdpdr->sequenceId = 0;
|
||||||
pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP_EX*) pEntryPoints;
|
pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP_EX*) pEntryPoints;
|
||||||
|
|
||||||
|
@ -1331,7 +1331,7 @@ BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS pEntryPoints, PVOID p
|
|||||||
rdpsnd->channelDef.options =
|
rdpsnd->channelDef.options =
|
||||||
CHANNEL_OPTION_INITIALIZED |
|
CHANNEL_OPTION_INITIALIZED |
|
||||||
CHANNEL_OPTION_ENCRYPT_RDP;
|
CHANNEL_OPTION_ENCRYPT_RDP;
|
||||||
strcpy(rdpsnd->channelDef.name, "rdpsnd");
|
sprintf_s(rdpsnd->channelDef.name, ARRAYSIZE(rdpsnd->channelDef.name), "rdpsnd");
|
||||||
pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP_EX*) pEntryPoints;
|
pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP_EX*) pEntryPoints;
|
||||||
|
|
||||||
if ((pEntryPointsEx->cbSize >= sizeof(CHANNEL_ENTRY_POINTS_FREERDP_EX)) &&
|
if ((pEntryPointsEx->cbSize >= sizeof(CHANNEL_ENTRY_POINTS_FREERDP_EX)) &&
|
||||||
|
@ -220,7 +220,7 @@ static UINT remdesk_prepare_ctl_header(REMDESK_CTL_HEADER* ctlHeader,
|
|||||||
UINT32 msgType, UINT32 msgSize)
|
UINT32 msgType, UINT32 msgSize)
|
||||||
{
|
{
|
||||||
ctlHeader->msgType = msgType;
|
ctlHeader->msgType = msgType;
|
||||||
strcpy(ctlHeader->ChannelName, REMDESK_CHANNEL_CTL_NAME);
|
sprintf_s(ctlHeader->ChannelName, ARRAYSIZE(ctlHeader->ChannelName), REMDESK_CHANNEL_CTL_NAME);
|
||||||
ctlHeader->DataLength = 4 + msgSize;
|
ctlHeader->DataLength = 4 + msgSize;
|
||||||
return CHANNEL_RC_OK;
|
return CHANNEL_RC_OK;
|
||||||
}
|
}
|
||||||
@ -1022,7 +1022,7 @@ BOOL VCAPITYPE VirtualChannelEntryEx(PCHANNEL_ENTRY_POINTS pEntryPoints, PVOID p
|
|||||||
CHANNEL_OPTION_ENCRYPT_RDP |
|
CHANNEL_OPTION_ENCRYPT_RDP |
|
||||||
CHANNEL_OPTION_COMPRESS_RDP |
|
CHANNEL_OPTION_COMPRESS_RDP |
|
||||||
CHANNEL_OPTION_SHOW_PROTOCOL;
|
CHANNEL_OPTION_SHOW_PROTOCOL;
|
||||||
strcpy(remdesk->channelDef.name, "remdesk");
|
sprintf_s(remdesk->channelDef.name, ARRAYSIZE(remdesk->channelDef.name), "remdesk");
|
||||||
remdesk->Version = 2;
|
remdesk->Version = 2;
|
||||||
pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP_EX*) pEntryPoints;
|
pEntryPointsEx = (CHANNEL_ENTRY_POINTS_FREERDP_EX*) pEntryPoints;
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ static UINT remdesk_prepare_ctl_header(REMDESK_CTL_HEADER* ctlHeader,
|
|||||||
UINT32 msgType, UINT32 msgSize)
|
UINT32 msgType, UINT32 msgSize)
|
||||||
{
|
{
|
||||||
ctlHeader->msgType = msgType;
|
ctlHeader->msgType = msgType;
|
||||||
strcpy(ctlHeader->ChannelName, REMDESK_CHANNEL_CTL_NAME);
|
sprintf_s(ctlHeader->ChannelName, ARRAYSIZE(ctlHeader->ChannelName), REMDESK_CHANNEL_CTL_NAME);
|
||||||
ctlHeader->DataLength = 4 + msgSize;
|
ctlHeader->DataLength = 4 + msgSize;
|
||||||
return CHANNEL_RC_OK;
|
return CHANNEL_RC_OK;
|
||||||
}
|
}
|
||||||
@ -592,7 +592,6 @@ static DWORD WINAPI remdesk_server_thread(LPVOID arg)
|
|||||||
RemdeskServerContext* context;
|
RemdeskServerContext* context;
|
||||||
UINT error;
|
UINT error;
|
||||||
context = (RemdeskServerContext*) arg;
|
context = (RemdeskServerContext*) arg;
|
||||||
|
|
||||||
buffer = NULL;
|
buffer = NULL;
|
||||||
BytesReturned = 0;
|
BytesReturned = 0;
|
||||||
ChannelEvent = NULL;
|
ChannelEvent = NULL;
|
||||||
@ -727,7 +726,7 @@ static UINT remdesk_server_start(RemdeskServerContext* context)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!(context->priv->Thread = CreateThread(NULL, 0,
|
if (!(context->priv->Thread = CreateThread(NULL, 0,
|
||||||
remdesk_server_thread, (void*) context, 0, NULL)))
|
remdesk_server_thread, (void*) context, 0, NULL)))
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "CreateThread failed!");
|
WLog_ERR(TAG, "CreateThread failed!");
|
||||||
CloseHandle(context->priv->StopEvent);
|
CloseHandle(context->priv->StopEvent);
|
||||||
@ -790,7 +789,7 @@ void remdesk_server_context_free(RemdeskServerContext* context)
|
|||||||
{
|
{
|
||||||
if (context->priv->ChannelHandle != INVALID_HANDLE_VALUE)
|
if (context->priv->ChannelHandle != INVALID_HANDLE_VALUE)
|
||||||
WTSVirtualChannelClose(context->priv->ChannelHandle);
|
WTSVirtualChannelClose(context->priv->ChannelHandle);
|
||||||
|
|
||||||
free(context->priv);
|
free(context->priv);
|
||||||
free(context);
|
free(context);
|
||||||
}
|
}
|
||||||
|
@ -661,8 +661,7 @@ static int udev_get_hub_handle(UDEVICE* pdev, UINT16 bus_number, UINT16 dev_numb
|
|||||||
}
|
}
|
||||||
while (p1 != NULL);
|
while (p1 != NULL);
|
||||||
|
|
||||||
memset(pdev->path, 0, 17);
|
_snprintf(pdev->path, ARRAYSIZE(pdev->path), "%s", p2);
|
||||||
strcpy(pdev->path, p2);
|
|
||||||
WLog_DBG(TAG, " DevPath: %s", pdev->path);
|
WLog_DBG(TAG, " DevPath: %s", pdev->path);
|
||||||
/* query parent hub info */
|
/* query parent hub info */
|
||||||
dev = udev_device_get_parent(dev);
|
dev = udev_device_get_parent(dev);
|
||||||
|
@ -484,7 +484,7 @@ static void urbdrc_udevman_register_devices(UDEVMAN* udevman, char* devices)
|
|||||||
dev_number = 0;
|
dev_number = 0;
|
||||||
idVendor = 0;
|
idVendor = 0;
|
||||||
idProduct = 0;
|
idProduct = 0;
|
||||||
strcpy(hardware_id, token);
|
_snprintf(hardware_id, ARRAYSIZE(hardware_id), "%s", token);
|
||||||
token = strtok(NULL, "#");
|
token = strtok(NULL, "#");
|
||||||
|
|
||||||
if (udevman->flags & UDEVMAN_FLAG_ADD_BY_VID_PID)
|
if (udevman->flags & UDEVMAN_FLAG_ADD_BY_VID_PID)
|
||||||
|
@ -59,9 +59,9 @@ static int func_hardware_id_format(IUDEVICE* pdev, char(*HardwareIds)[DEVICE_HAR
|
|||||||
idProduct = (UINT16)pdev->query_device_descriptor(pdev, ID_PRODUCT);
|
idProduct = (UINT16)pdev->query_device_descriptor(pdev, ID_PRODUCT);
|
||||||
bcdDevice = (UINT16)pdev->query_device_descriptor(pdev, BCD_DEVICE);
|
bcdDevice = (UINT16)pdev->query_device_descriptor(pdev, BCD_DEVICE);
|
||||||
sprintf_s(str, sizeof(str), "USB\\VID_%04"PRIX16"&PID_%04"PRIX16"", idVendor, idProduct);
|
sprintf_s(str, sizeof(str), "USB\\VID_%04"PRIX16"&PID_%04"PRIX16"", idVendor, idProduct);
|
||||||
strcpy(HardwareIds[1], str);
|
strncpy(HardwareIds[1], str, DEVICE_HARDWARE_ID_SIZE);
|
||||||
sprintf_s(str, sizeof(str), "%s&REV_%04"PRIX16"", HardwareIds[1], bcdDevice);
|
sprintf_s(str, sizeof(str), "%s&REV_%04"PRIX16"", HardwareIds[1], bcdDevice);
|
||||||
strcpy(HardwareIds[0], str);
|
strncpy(HardwareIds[0], str, DEVICE_HARDWARE_ID_SIZE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,20 +77,20 @@ static int func_compat_id_format(IUDEVICE* pdev,
|
|||||||
if (!(pdev->isCompositeDevice(pdev)))
|
if (!(pdev->isCompositeDevice(pdev)))
|
||||||
{
|
{
|
||||||
sprintf_s(str, sizeof(str), "USB\\Class_%02"PRIX8"", bDeviceClass);
|
sprintf_s(str, sizeof(str), "USB\\Class_%02"PRIX8"", bDeviceClass);
|
||||||
strcpy(CompatibilityIds[2], str);
|
strncpy(CompatibilityIds[2], str, DEVICE_COMPATIBILITY_ID_SIZE);
|
||||||
sprintf_s(str, sizeof(str), "%s&SubClass_%02"PRIX8"", CompatibilityIds[2], bDeviceSubClass);
|
sprintf_s(str, sizeof(str), "%s&SubClass_%02"PRIX8"", CompatibilityIds[2], bDeviceSubClass);
|
||||||
strcpy(CompatibilityIds[1], str);
|
strncpy(CompatibilityIds[1], str, DEVICE_COMPATIBILITY_ID_SIZE);
|
||||||
sprintf_s(str, sizeof(str), "%s&Prot_%02"PRIX8"", CompatibilityIds[1], bDeviceProtocol);
|
sprintf_s(str, sizeof(str), "%s&Prot_%02"PRIX8"", CompatibilityIds[1], bDeviceProtocol);
|
||||||
strcpy(CompatibilityIds[0], str);
|
strncpy(CompatibilityIds[0], str, DEVICE_COMPATIBILITY_ID_SIZE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf_s(str, sizeof(str), "USB\\DevClass_00");
|
sprintf_s(str, sizeof(str), "USB\\DevClass_00");
|
||||||
strcpy(CompatibilityIds[2], str);
|
strncpy(CompatibilityIds[2], str, DEVICE_COMPATIBILITY_ID_SIZE);
|
||||||
sprintf_s(str, sizeof(str), "%s&SubClass_00", CompatibilityIds[2]);
|
sprintf_s(str, sizeof(str), "%s&SubClass_00", CompatibilityIds[2]);
|
||||||
strcpy(CompatibilityIds[1], str);
|
strncpy(CompatibilityIds[1], str, DEVICE_COMPATIBILITY_ID_SIZE);
|
||||||
sprintf_s(str, sizeof(str), "%s&Prot_00", CompatibilityIds[1]);
|
sprintf_s(str, sizeof(str), "%s&Prot_00", CompatibilityIds[1]);
|
||||||
strcpy(CompatibilityIds[0], str);
|
strncpy(CompatibilityIds[0], str, DEVICE_COMPATIBILITY_ID_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -988,18 +988,34 @@ BOOL mac_authenticate(freerdp* instance, char** username, char** password,
|
|||||||
|
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
|
size_t ulen, plen, dlen;
|
||||||
const char* submittedUsername = [dialog.username cStringUsingEncoding:
|
const char* submittedUsername = [dialog.username cStringUsingEncoding:
|
||||||
NSUTF8StringEncoding];
|
NSUTF8StringEncoding];
|
||||||
*username = malloc((strlen(submittedUsername) + 1) * sizeof(char));
|
ulen = (strlen(submittedUsername) + 1) * sizeof(char);
|
||||||
strcpy(*username, submittedUsername);
|
*username = malloc(ulen);
|
||||||
|
|
||||||
|
if (!(*username))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
sprintf_s(*username, ulen, "%s", submittedUsername);
|
||||||
const char* submittedPassword = [dialog.password cStringUsingEncoding:
|
const char* submittedPassword = [dialog.password cStringUsingEncoding:
|
||||||
NSUTF8StringEncoding];
|
NSUTF8StringEncoding];
|
||||||
*password = malloc((strlen(submittedPassword) + 1) * sizeof(char));
|
plen = (strlen(submittedPassword) + 1) * sizeof(char);
|
||||||
strcpy(*password, submittedPassword);
|
*password = malloc(plen);
|
||||||
|
|
||||||
|
if (!(*password))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
sprintf_s(*password, plen, "%s", submittedPassword);
|
||||||
const char* submittedDomain = [dialog.domain cStringUsingEncoding:
|
const char* submittedDomain = [dialog.domain cStringUsingEncoding:
|
||||||
NSUTF8StringEncoding];
|
NSUTF8StringEncoding];
|
||||||
*domain = malloc((strlen(submittedDomain) + 1) * sizeof(char));
|
dlen = (strlen(submittedDomain) + 1) * sizeof(char);
|
||||||
strcpy(*domain, submittedDomain);
|
*domain = malloc(dlen);
|
||||||
|
|
||||||
|
if (!(*domain))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
sprintf_s(*domain, dlen, "%s", submittedDomain);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
|
@ -124,7 +124,7 @@ void mac_set_view_size(rdpContext* context, MRDPView* view);
|
|||||||
|
|
||||||
length = (int)([str length] + 1);
|
length = (int)([str length] + 1);
|
||||||
cptr = (char*) malloc(length);
|
cptr = (char*) malloc(length);
|
||||||
strcpy(cptr, [str UTF8String]);
|
sprintf_s(cptr, length, "%s", [str UTF8String]);
|
||||||
context->argv[i++] = cptr;
|
context->argv[i++] = cptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -359,7 +359,7 @@ static int xf_keyboard_execute_action_script(xfContext* xfc,
|
|||||||
BOOL match = FALSE;
|
BOOL match = FALSE;
|
||||||
char* keyCombination;
|
char* keyCombination;
|
||||||
char buffer[1024] = { 0 };
|
char buffer[1024] = { 0 };
|
||||||
char command[1024] = { 0 };
|
char command[2048] = { 0 };
|
||||||
char combination[1024] = { 0 };
|
char combination[1024] = { 0 };
|
||||||
|
|
||||||
if (!xfc->actionScriptExists)
|
if (!xfc->actionScriptExists)
|
||||||
|
@ -586,13 +586,13 @@ static char** freerdp_command_line_parse_comma_separated_values_ex(const char* n
|
|||||||
if (name)
|
if (name)
|
||||||
{
|
{
|
||||||
size_t len = strlen(name);
|
size_t len = strlen(name);
|
||||||
p = (char**) calloc(1UL + len, sizeof(char*));
|
p = (char**) calloc(2UL + len, sizeof(char*));
|
||||||
|
|
||||||
if (p)
|
if (p)
|
||||||
{
|
{
|
||||||
char* dst = (char*)&p[1];
|
char* dst = (char*)&p[1];
|
||||||
p[0] = dst;
|
p[0] = dst;
|
||||||
strncpy(dst, name, len);
|
sprintf_s(dst, len, "%s", name);
|
||||||
*count = 1;
|
*count = 1;
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
#include <winpr/crt.h>
|
#include <winpr/crt.h>
|
||||||
#include <winpr/path.h>
|
#include <winpr/path.h>
|
||||||
|
#include <winpr/string.h>
|
||||||
#include <winpr/library.h>
|
#include <winpr/library.h>
|
||||||
|
|
||||||
#include <freerdp/addin.h>
|
#include <freerdp/addin.h>
|
||||||
|
@ -690,7 +690,7 @@ static char* freerdp_tcp_address_to_string(const struct sockaddr_storage* addr,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case AF_UNIX:
|
case AF_UNIX:
|
||||||
strcpy(ipAddress, "127.0.0.1");
|
sprintf_s(ipAddress, ARRAYSIZE(ipAddress), "127.0.0.1");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include <winpr/crt.h>
|
#include <winpr/crt.h>
|
||||||
|
#include <winpr/string.h>
|
||||||
#include <winpr/sspi.h>
|
#include <winpr/sspi.h>
|
||||||
#include <winpr/ssl.h>
|
#include <winpr/ssl.h>
|
||||||
|
|
||||||
@ -622,9 +623,9 @@ static SecPkgContext_Bindings* tls_get_channel_bindings(X509* cert)
|
|||||||
ChannelBindings->dwApplicationDataOffset = sizeof(SEC_CHANNEL_BINDINGS);
|
ChannelBindings->dwApplicationDataOffset = sizeof(SEC_CHANNEL_BINDINGS);
|
||||||
ChannelBindingToken = &((BYTE*)
|
ChannelBindingToken = &((BYTE*)
|
||||||
ChannelBindings)[ChannelBindings->dwApplicationDataOffset];
|
ChannelBindings)[ChannelBindings->dwApplicationDataOffset];
|
||||||
strcpy((char*) ChannelBindingToken, TLS_SERVER_END_POINT);
|
sprintf_s((char*) ChannelBindingToken,
|
||||||
CopyMemory(&ChannelBindingToken[PrefixLength], CertificateHash,
|
ContextBindings->BindingsLength - ChannelBindings->dwApplicationDataOffset, "%s%s",
|
||||||
CertificateHashLength);
|
TLS_SERVER_END_POINT, CertificateHash);
|
||||||
return ContextBindings;
|
return ContextBindings;
|
||||||
out_free:
|
out_free:
|
||||||
free(ContextBindings);
|
free(ContextBindings);
|
||||||
|
@ -603,15 +603,13 @@ rdtkFont* rdtk_font_new(rdtkEngine* engine, const char* path, const char* file)
|
|||||||
if (!fontImageFile)
|
if (!fontImageFile)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
strcpy(fontImageFile, fontBaseFile);
|
sprintf_s(fontImageFile, length + 8, "%s.png", fontBaseFile);
|
||||||
strcpy(&fontImageFile[length], ".png");
|
|
||||||
fontDescriptorFile = (char*) malloc(length + 8);
|
fontDescriptorFile = (char*) malloc(length + 8);
|
||||||
|
|
||||||
if (!fontDescriptorFile)
|
if (!fontDescriptorFile)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
strcpy(fontDescriptorFile, fontBaseFile);
|
sprintf_s(fontDescriptorFile, length + 8, "%s.xml", fontBaseFile);
|
||||||
strcpy(&fontDescriptorFile[length], ".xml");
|
|
||||||
|
|
||||||
if (!PathFileExistsA(fontImageFile))
|
if (!PathFileExistsA(fontImageFile))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/epoll.h>
|
#include <sys/epoll.h>
|
||||||
|
|
||||||
@ -56,6 +57,7 @@ static int set_cloexec_or_close(int fd)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
flags = fcntl(fd, F_GETFD);
|
flags = fcntl(fd, F_GETFD);
|
||||||
|
|
||||||
if (flags == -1)
|
if (flags == -1)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
@ -63,7 +65,6 @@ static int set_cloexec_or_close(int fd)
|
|||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
return fd;
|
return fd;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
close(fd);
|
close(fd);
|
||||||
return -1;
|
return -1;
|
||||||
@ -72,10 +73,11 @@ err:
|
|||||||
int uwac_os_socket_cloexec(int domain, int type, int protocol)
|
int uwac_os_socket_cloexec(int domain, int type, int protocol)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
fd = socket(domain, type | SOCK_CLOEXEC, protocol);
|
fd = socket(domain, type | SOCK_CLOEXEC, protocol);
|
||||||
|
|
||||||
if (fd >= 0)
|
if (fd >= 0)
|
||||||
return fd;
|
return fd;
|
||||||
|
|
||||||
if (errno != EINVAL)
|
if (errno != EINVAL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -86,10 +88,11 @@ int uwac_os_socket_cloexec(int domain, int type, int protocol)
|
|||||||
int uwac_os_dupfd_cloexec(int fd, long minfd)
|
int uwac_os_dupfd_cloexec(int fd, long minfd)
|
||||||
{
|
{
|
||||||
int newfd;
|
int newfd;
|
||||||
|
|
||||||
newfd = fcntl(fd, F_DUPFD_CLOEXEC, minfd);
|
newfd = fcntl(fd, F_DUPFD_CLOEXEC, minfd);
|
||||||
|
|
||||||
if (newfd >= 0)
|
if (newfd >= 0)
|
||||||
return newfd;
|
return newfd;
|
||||||
|
|
||||||
if (errno != EINVAL)
|
if (errno != EINVAL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -97,15 +100,15 @@ int uwac_os_dupfd_cloexec(int fd, long minfd)
|
|||||||
return set_cloexec_or_close(newfd);
|
return set_cloexec_or_close(newfd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t recvmsg_cloexec_fallback(int sockfd, struct msghdr *msg, int flags)
|
static ssize_t recvmsg_cloexec_fallback(int sockfd, struct msghdr* msg, int flags)
|
||||||
{
|
{
|
||||||
ssize_t len;
|
ssize_t len;
|
||||||
struct cmsghdr *cmsg;
|
struct cmsghdr* cmsg;
|
||||||
unsigned char *data;
|
unsigned char* data;
|
||||||
int *fd;
|
int* fd;
|
||||||
int *end;
|
int* end;
|
||||||
|
|
||||||
len = recvmsg(sockfd, msg, flags);
|
len = recvmsg(sockfd, msg, flags);
|
||||||
|
|
||||||
if (len == -1)
|
if (len == -1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -113,27 +116,31 @@ static ssize_t recvmsg_cloexec_fallback(int sockfd, struct msghdr *msg, int flag
|
|||||||
return len;
|
return len;
|
||||||
|
|
||||||
cmsg = CMSG_FIRSTHDR(msg);
|
cmsg = CMSG_FIRSTHDR(msg);
|
||||||
for (; cmsg != NULL; cmsg = CMSG_NXTHDR(msg, cmsg)) {
|
|
||||||
|
for (; cmsg != NULL; cmsg = CMSG_NXTHDR(msg, cmsg))
|
||||||
|
{
|
||||||
if (cmsg->cmsg_level != SOL_SOCKET ||
|
if (cmsg->cmsg_level != SOL_SOCKET ||
|
||||||
cmsg->cmsg_type != SCM_RIGHTS)
|
cmsg->cmsg_type != SCM_RIGHTS)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
data = CMSG_DATA(cmsg);
|
data = CMSG_DATA(cmsg);
|
||||||
end = (int *)(data + cmsg->cmsg_len - CMSG_LEN(0));
|
end = (int*)(data + cmsg->cmsg_len - CMSG_LEN(0));
|
||||||
for (fd = (int *)data; fd < end; ++fd)
|
|
||||||
|
for (fd = (int*)data; fd < end; ++fd)
|
||||||
*fd = set_cloexec_or_close(*fd);
|
*fd = set_cloexec_or_close(*fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
ssize_t uwac_os_recvmsg_cloexec(int sockfd, struct msghdr *msg, int flags)
|
ssize_t uwac_os_recvmsg_cloexec(int sockfd, struct msghdr* msg, int flags)
|
||||||
{
|
{
|
||||||
ssize_t len;
|
ssize_t len;
|
||||||
|
|
||||||
len = recvmsg(sockfd, msg, flags | MSG_CMSG_CLOEXEC);
|
len = recvmsg(sockfd, msg, flags | MSG_CMSG_CLOEXEC);
|
||||||
|
|
||||||
if (len >= 0)
|
if (len >= 0)
|
||||||
return len;
|
return len;
|
||||||
|
|
||||||
if (errno != EINVAL)
|
if (errno != EINVAL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -143,37 +150,41 @@ ssize_t uwac_os_recvmsg_cloexec(int sockfd, struct msghdr *msg, int flags)
|
|||||||
int uwac_os_epoll_create_cloexec(void)
|
int uwac_os_epoll_create_cloexec(void)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
#ifdef EPOLL_CLOEXEC
|
#ifdef EPOLL_CLOEXEC
|
||||||
fd = epoll_create1(EPOLL_CLOEXEC);
|
fd = epoll_create1(EPOLL_CLOEXEC);
|
||||||
|
|
||||||
if (fd >= 0)
|
if (fd >= 0)
|
||||||
return fd;
|
return fd;
|
||||||
|
|
||||||
if (errno != EINVAL)
|
if (errno != EINVAL)
|
||||||
return -1;
|
return -1;
|
||||||
#endif
|
|
||||||
|
|
||||||
|
#endif
|
||||||
fd = epoll_create(1);
|
fd = epoll_create(1);
|
||||||
return set_cloexec_or_close(fd);
|
return set_cloexec_or_close(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int create_tmpfile_cloexec(char *tmpname)
|
static int create_tmpfile_cloexec(char* tmpname)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
#ifdef USE_SHM
|
#ifdef USE_SHM
|
||||||
fd = shm_open(SHM_ANON, O_CREAT | O_RDWR, 0600);
|
fd = shm_open(SHM_ANON, O_CREAT | O_RDWR, 0600);
|
||||||
#elif defined(HAVE_MKOSTEMP)
|
#elif defined(HAVE_MKOSTEMP)
|
||||||
fd = mkostemp(tmpname, O_CLOEXEC);
|
fd = mkostemp(tmpname, O_CLOEXEC);
|
||||||
|
|
||||||
if (fd >= 0)
|
if (fd >= 0)
|
||||||
unlink(tmpname);
|
unlink(tmpname);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
fd = mkstemp(tmpname);
|
fd = mkstemp(tmpname);
|
||||||
if (fd >= 0) {
|
|
||||||
|
if (fd >= 0)
|
||||||
|
{
|
||||||
fd = set_cloexec_or_close(fd);
|
fd = set_cloexec_or_close(fd);
|
||||||
unlink(tmpname);
|
unlink(tmpname);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
#endif
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,26 +212,27 @@ static int create_tmpfile_cloexec(char *tmpname)
|
|||||||
int uwac_create_anonymous_file(off_t size)
|
int uwac_create_anonymous_file(off_t size)
|
||||||
{
|
{
|
||||||
static const char template[] = "/weston-shared-XXXXXX";
|
static const char template[] = "/weston-shared-XXXXXX";
|
||||||
const char *path;
|
const char* path;
|
||||||
char *name;
|
char* name;
|
||||||
int fd;
|
int fd;
|
||||||
int ret;
|
int ret;
|
||||||
|
size_t length;
|
||||||
path = getenv("XDG_RUNTIME_DIR");
|
path = getenv("XDG_RUNTIME_DIR");
|
||||||
if (!path) {
|
|
||||||
|
if (!path)
|
||||||
|
{
|
||||||
errno = ENOENT;
|
errno = ENOENT;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
name = malloc(strlen(path) + sizeof(template));
|
length = strlen(path) + sizeof(template);
|
||||||
|
name = malloc(length);
|
||||||
|
|
||||||
if (!name)
|
if (!name)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
strcpy(name, path);
|
snprintf(name, length, "%s%s", path, template);
|
||||||
strcat(name, template);
|
|
||||||
|
|
||||||
fd = create_tmpfile_cloexec(name);
|
fd = create_tmpfile_cloexec(name);
|
||||||
|
|
||||||
free(name);
|
free(name);
|
||||||
|
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
@ -228,18 +240,23 @@ int uwac_create_anonymous_file(off_t size)
|
|||||||
|
|
||||||
#ifdef HAVE_POSIX_FALLOCATE
|
#ifdef HAVE_POSIX_FALLOCATE
|
||||||
ret = posix_fallocate(fd, 0, size);
|
ret = posix_fallocate(fd, 0, size);
|
||||||
if (ret != 0) {
|
|
||||||
|
if (ret != 0)
|
||||||
|
{
|
||||||
close(fd);
|
close(fd);
|
||||||
errno = ret;
|
errno = ret;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
ret = ftruncate(fd, size);
|
ret = ftruncate(fd, size);
|
||||||
if (ret < 0) {
|
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
close(fd);
|
close(fd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
#endif
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
@ -331,7 +331,7 @@ static void* clipboard_synthesize_html_format(wClipboard* clipboard, UINT32 form
|
|||||||
{
|
{
|
||||||
char* body;
|
char* body;
|
||||||
BYTE bom[2];
|
BYTE bom[2];
|
||||||
char num[11];
|
char num[20];
|
||||||
WCHAR* wstr;
|
WCHAR* wstr;
|
||||||
|
|
||||||
if (SrcSize > 2)
|
if (SrcSize > 2)
|
||||||
@ -369,12 +369,12 @@ static void* clipboard_synthesize_html_format(wClipboard* clipboard, UINT32 form
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(pDstData,
|
sprintf_s(pDstData, SrcSize + 200,
|
||||||
"Version:0.9\r\n"
|
"Version:0.9\r\n"
|
||||||
"StartHTML:0000000000\r\n"
|
"StartHTML:0000000000\r\n"
|
||||||
"EndHTML:0000000000\r\n"
|
"EndHTML:0000000000\r\n"
|
||||||
"StartFragment:0000000000\r\n"
|
"StartFragment:0000000000\r\n"
|
||||||
"EndFragment:0000000000\r\n");
|
"EndFragment:0000000000\r\n");
|
||||||
body = strstr(pSrcData, "<body");
|
body = strstr(pSrcData, "<body");
|
||||||
|
|
||||||
if (!body)
|
if (!body)
|
||||||
|
@ -58,6 +58,7 @@ static BOOL NamedPipeClientIsHandled(HANDLE handle)
|
|||||||
SetLastError(ERROR_INVALID_HANDLE);
|
SetLastError(ERROR_INVALID_HANDLE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,7 +66,6 @@ BOOL NamedPipeClientCloseHandle(HANDLE handle)
|
|||||||
{
|
{
|
||||||
WINPR_NAMED_PIPE* pNamedPipe = (WINPR_NAMED_PIPE*) handle;
|
WINPR_NAMED_PIPE* pNamedPipe = (WINPR_NAMED_PIPE*) handle;
|
||||||
|
|
||||||
|
|
||||||
if (!NamedPipeClientIsHandled(handle))
|
if (!NamedPipeClientIsHandled(handle))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
@ -88,13 +88,12 @@ BOOL NamedPipeClientCloseHandle(HANDLE handle)
|
|||||||
free(pNamedPipe->lpFilePath);
|
free(pNamedPipe->lpFilePath);
|
||||||
free(pNamedPipe->name);
|
free(pNamedPipe->name);
|
||||||
free(pNamedPipe);
|
free(pNamedPipe);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int NamedPipeClientGetFd(HANDLE handle)
|
static int NamedPipeClientGetFd(HANDLE handle)
|
||||||
{
|
{
|
||||||
WINPR_NAMED_PIPE *file = (WINPR_NAMED_PIPE *)handle;
|
WINPR_NAMED_PIPE* file = (WINPR_NAMED_PIPE*)handle;
|
||||||
|
|
||||||
if (!NamedPipeClientIsHandled(handle))
|
if (!NamedPipeClientIsHandled(handle))
|
||||||
return -1;
|
return -1;
|
||||||
@ -105,31 +104,33 @@ static int NamedPipeClientGetFd(HANDLE handle)
|
|||||||
return file->clientfd;
|
return file->clientfd;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HANDLE_OPS ops = {
|
static HANDLE_OPS ops =
|
||||||
NamedPipeClientIsHandled,
|
{
|
||||||
NamedPipeClientCloseHandle,
|
NamedPipeClientIsHandled,
|
||||||
NamedPipeClientGetFd,
|
NamedPipeClientCloseHandle,
|
||||||
NULL, /* CleanupHandle */
|
NamedPipeClientGetFd,
|
||||||
NamedPipeRead,
|
NULL, /* CleanupHandle */
|
||||||
NULL, /* FileReadEx */
|
NamedPipeRead,
|
||||||
NULL, /* FileReadScatter */
|
NULL, /* FileReadEx */
|
||||||
NamedPipeWrite,
|
NULL, /* FileReadScatter */
|
||||||
NULL, /* FileWriteEx */
|
NamedPipeWrite,
|
||||||
NULL, /* FileWriteGather */
|
NULL, /* FileWriteEx */
|
||||||
NULL, /* FileGetFileSize */
|
NULL, /* FileWriteGather */
|
||||||
NULL, /* FlushFileBuffers */
|
NULL, /* FileGetFileSize */
|
||||||
NULL, /* FileSetEndOfFile */
|
NULL, /* FlushFileBuffers */
|
||||||
NULL, /* FileSetFilePointer */
|
NULL, /* FileSetEndOfFile */
|
||||||
NULL, /* SetFilePointerEx */
|
NULL, /* FileSetFilePointer */
|
||||||
NULL, /* FileLockFile */
|
NULL, /* SetFilePointerEx */
|
||||||
NULL, /* FileLockFileEx */
|
NULL, /* FileLockFile */
|
||||||
NULL, /* FileUnlockFile */
|
NULL, /* FileLockFileEx */
|
||||||
NULL, /* FileUnlockFileEx */
|
NULL, /* FileUnlockFile */
|
||||||
NULL /* SetFileTime */
|
NULL, /* FileUnlockFileEx */
|
||||||
|
NULL /* SetFileTime */
|
||||||
};
|
};
|
||||||
|
|
||||||
static HANDLE NamedPipeClientCreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes,
|
static HANDLE NamedPipeClientCreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess,
|
||||||
DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)
|
DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes,
|
||||||
|
DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)
|
||||||
{
|
{
|
||||||
char* name;
|
char* name;
|
||||||
int status;
|
int status;
|
||||||
@ -157,6 +158,7 @@ static HANDLE NamedPipeClientCreateFileA(LPCSTR lpFileName, DWORD dwDesiredAcces
|
|||||||
|
|
||||||
free(name);
|
free(name);
|
||||||
pNamedPipe = (WINPR_NAMED_PIPE*) calloc(1, sizeof(WINPR_NAMED_PIPE));
|
pNamedPipe = (WINPR_NAMED_PIPE*) calloc(1, sizeof(WINPR_NAMED_PIPE));
|
||||||
|
|
||||||
if (!pNamedPipe)
|
if (!pNamedPipe)
|
||||||
{
|
{
|
||||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
@ -166,12 +168,14 @@ static HANDLE NamedPipeClientCreateFileA(LPCSTR lpFileName, DWORD dwDesiredAcces
|
|||||||
hNamedPipe = (HANDLE) pNamedPipe;
|
hNamedPipe = (HANDLE) pNamedPipe;
|
||||||
WINPR_HANDLE_SET_TYPE_AND_MODE(pNamedPipe, HANDLE_TYPE_NAMED_PIPE, WINPR_FD_READ);
|
WINPR_HANDLE_SET_TYPE_AND_MODE(pNamedPipe, HANDLE_TYPE_NAMED_PIPE, WINPR_FD_READ);
|
||||||
pNamedPipe->name = _strdup(lpFileName);
|
pNamedPipe->name = _strdup(lpFileName);
|
||||||
|
|
||||||
if (!pNamedPipe->name)
|
if (!pNamedPipe->name)
|
||||||
{
|
{
|
||||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
free(pNamedPipe);
|
free(pNamedPipe);
|
||||||
return INVALID_HANDLE_VALUE;
|
return INVALID_HANDLE_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
pNamedPipe->dwOpenMode = 0;
|
pNamedPipe->dwOpenMode = 0;
|
||||||
pNamedPipe->dwPipeMode = 0;
|
pNamedPipe->dwPipeMode = 0;
|
||||||
pNamedPipe->nMaxInstances = 0;
|
pNamedPipe->nMaxInstances = 0;
|
||||||
@ -180,30 +184,31 @@ static HANDLE NamedPipeClientCreateFileA(LPCSTR lpFileName, DWORD dwDesiredAcces
|
|||||||
pNamedPipe->nDefaultTimeOut = 0;
|
pNamedPipe->nDefaultTimeOut = 0;
|
||||||
pNamedPipe->dwFlagsAndAttributes = dwFlagsAndAttributes;
|
pNamedPipe->dwFlagsAndAttributes = dwFlagsAndAttributes;
|
||||||
pNamedPipe->lpFileName = GetNamedPipeNameWithoutPrefixA(lpFileName);
|
pNamedPipe->lpFileName = GetNamedPipeNameWithoutPrefixA(lpFileName);
|
||||||
|
|
||||||
if (!pNamedPipe->lpFileName)
|
if (!pNamedPipe->lpFileName)
|
||||||
{
|
{
|
||||||
free((void *)pNamedPipe->name);
|
free((void*)pNamedPipe->name);
|
||||||
free(pNamedPipe);
|
free(pNamedPipe);
|
||||||
return INVALID_HANDLE_VALUE;
|
return INVALID_HANDLE_VALUE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pNamedPipe->lpFilePath = GetNamedPipeUnixDomainSocketFilePathA(lpFileName);
|
pNamedPipe->lpFilePath = GetNamedPipeUnixDomainSocketFilePathA(lpFileName);
|
||||||
|
|
||||||
if (!pNamedPipe->lpFilePath)
|
if (!pNamedPipe->lpFilePath)
|
||||||
{
|
{
|
||||||
free((void *)pNamedPipe->lpFileName);
|
free((void*)pNamedPipe->lpFileName);
|
||||||
free((void *)pNamedPipe->name);
|
free((void*)pNamedPipe->name);
|
||||||
free(pNamedPipe);
|
free(pNamedPipe);
|
||||||
return INVALID_HANDLE_VALUE;
|
return INVALID_HANDLE_VALUE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pNamedPipe->clientfd = socket(PF_LOCAL, SOCK_STREAM, 0);
|
pNamedPipe->clientfd = socket(PF_LOCAL, SOCK_STREAM, 0);
|
||||||
pNamedPipe->serverfd = -1;
|
pNamedPipe->serverfd = -1;
|
||||||
pNamedPipe->ServerMode = FALSE;
|
pNamedPipe->ServerMode = FALSE;
|
||||||
ZeroMemory(&s, sizeof(struct sockaddr_un));
|
ZeroMemory(&s, sizeof(struct sockaddr_un));
|
||||||
s.sun_family = AF_UNIX;
|
s.sun_family = AF_UNIX;
|
||||||
strcpy(s.sun_path, pNamedPipe->lpFilePath);
|
sprintf_s(s.sun_path, ARRAYSIZE(s.sun_path), "%s", pNamedPipe->lpFilePath);
|
||||||
status = connect(pNamedPipe->clientfd, (struct sockaddr*) &s, sizeof(struct sockaddr_un));
|
status = connect(pNamedPipe->clientfd, (struct sockaddr*) &s, sizeof(struct sockaddr_un));
|
||||||
|
|
||||||
pNamedPipe->ops = &ops;
|
pNamedPipe->ops = &ops;
|
||||||
|
|
||||||
if (status != 0)
|
if (status != 0)
|
||||||
@ -230,7 +235,7 @@ static HANDLE NamedPipeClientCreateFileA(LPCSTR lpFileName, DWORD dwDesiredAcces
|
|||||||
return hNamedPipe;
|
return hNamedPipe;
|
||||||
}
|
}
|
||||||
|
|
||||||
HANDLE_CREATOR *GetNamedPipeClientHandleCreator(void)
|
HANDLE_CREATOR* GetNamedPipeClientHandleCreator(void)
|
||||||
{
|
{
|
||||||
_NamedPipeClientHandleCreator.IsHandled = IsNamedPipeFileNameA;
|
_NamedPipeClientHandleCreator.IsHandled = IsNamedPipeFileNameA;
|
||||||
_NamedPipeClientHandleCreator.CreateFileA = NamedPipeClientCreateFileA;
|
_NamedPipeClientHandleCreator.CreateFileA = NamedPipeClientCreateFileA;
|
||||||
@ -270,8 +275,10 @@ char* GetNamedPipeUnixDomainSocketBaseFilePathA()
|
|||||||
char* lpTempPath;
|
char* lpTempPath;
|
||||||
char* lpPipePath;
|
char* lpPipePath;
|
||||||
lpTempPath = GetKnownPath(KNOWN_PATH_TEMP);
|
lpTempPath = GetKnownPath(KNOWN_PATH_TEMP);
|
||||||
|
|
||||||
if (!lpTempPath)
|
if (!lpTempPath)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
lpPipePath = GetCombinedPath(lpTempPath, ".pipe");
|
lpPipePath = GetCombinedPath(lpTempPath, ".pipe");
|
||||||
free(lpTempPath);
|
free(lpTempPath);
|
||||||
return lpPipePath;
|
return lpPipePath;
|
||||||
|
@ -653,7 +653,7 @@ HANDLE CreateNamedPipeA(LPCSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD
|
|||||||
|
|
||||||
ZeroMemory(&s, sizeof(struct sockaddr_un));
|
ZeroMemory(&s, sizeof(struct sockaddr_un));
|
||||||
s.sun_family = AF_UNIX;
|
s.sun_family = AF_UNIX;
|
||||||
strcpy(s.sun_path, pNamedPipe->lpFilePath);
|
sprintf_s(s.sun_path, ARRAYSIZE(s.sun_path), "%s", pNamedPipe->lpFilePath);
|
||||||
|
|
||||||
if (bind(serverfd, (struct sockaddr*) &s, sizeof(struct sockaddr_un)) == -1)
|
if (bind(serverfd, (struct sockaddr*) &s, sizeof(struct sockaddr_un)) == -1)
|
||||||
{
|
{
|
||||||
|
@ -54,7 +54,6 @@ BOOL GetUserProfileDirectoryA(HANDLE hToken, LPSTR lpProfileDir, LPDWORD lpcchSi
|
|||||||
struct passwd pwd;
|
struct passwd pwd;
|
||||||
struct passwd* pw = NULL;
|
struct passwd* pw = NULL;
|
||||||
WINPR_ACCESS_TOKEN* token;
|
WINPR_ACCESS_TOKEN* token;
|
||||||
|
|
||||||
token = (WINPR_ACCESS_TOKEN*) hToken;
|
token = (WINPR_ACCESS_TOKEN*) hToken;
|
||||||
|
|
||||||
if (!token || (token->Type != HANDLE_TYPE_ACCESS_TOKEN) || !lpcchSize)
|
if (!token || (token->Type != HANDLE_TYPE_ACCESS_TOKEN) || !lpcchSize)
|
||||||
@ -78,7 +77,7 @@ BOOL GetUserProfileDirectoryA(HANDLE hToken, LPSTR lpProfileDir, LPDWORD lpcchSi
|
|||||||
if ((status != 0) || !pw)
|
if ((status != 0) || !pw)
|
||||||
{
|
{
|
||||||
SetLastError(ERROR_INVALID_PARAMETER);
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
free (buf);
|
free(buf);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,10 +92,9 @@ BOOL GetUserProfileDirectoryA(HANDLE hToken, LPSTR lpProfileDir, LPDWORD lpcchSi
|
|||||||
}
|
}
|
||||||
|
|
||||||
ZeroMemory(lpProfileDir, *lpcchSize);
|
ZeroMemory(lpProfileDir, *lpcchSize);
|
||||||
strcpy(lpProfileDir, pw->pw_dir);
|
sprintf_s(lpProfileDir, *lpcchSize, "%s", pw->pw_dir);
|
||||||
*lpcchSize = cchDirSize;
|
*lpcchSize = cchDirSize;
|
||||||
free(buf);
|
free(buf);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +137,6 @@ BOOL GetUserProfileDirectoryW(HANDLE hToken, LPWSTR lpProfileDir, LPDWORD lpcchS
|
|||||||
}
|
}
|
||||||
|
|
||||||
*lpcchSize = cchSizeA;
|
*lpcchSize = cchSizeA;
|
||||||
|
|
||||||
return bStatus;
|
return bStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -580,6 +580,7 @@ int makecert_context_output_certificate_file(MAKECERT_CONTEXT* context, char* pa
|
|||||||
int offset;
|
int offset;
|
||||||
char* filename = NULL;
|
char* filename = NULL;
|
||||||
char* fullpath = NULL;
|
char* fullpath = NULL;
|
||||||
|
char* ext;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
BIO* bio = NULL;
|
BIO* bio = NULL;
|
||||||
BYTE* x509_str = NULL;
|
BYTE* x509_str = NULL;
|
||||||
@ -604,14 +605,16 @@ int makecert_context_output_certificate_file(MAKECERT_CONTEXT* context, char* pa
|
|||||||
if (!filename)
|
if (!filename)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
strcpy(filename, context->output_file);
|
|
||||||
|
|
||||||
if (context->crtFormat)
|
if (context->crtFormat)
|
||||||
strcpy(&filename[length], ".crt");
|
ext = "crt";
|
||||||
else if (context->pemFormat)
|
else if (context->pemFormat)
|
||||||
strcpy(&filename[length], ".pem");
|
ext = "pem";
|
||||||
else if (context->pfxFormat)
|
else if (context->pfxFormat)
|
||||||
strcpy(&filename[length], ".pfx");
|
ext = "pfx";
|
||||||
|
else
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
sprintf_s(filename, length + 8, "%s.%s", context->output_file, ext);
|
||||||
|
|
||||||
if (path)
|
if (path)
|
||||||
fullpath = GetCombinedPath(path, filename);
|
fullpath = GetCombinedPath(path, filename);
|
||||||
@ -877,8 +880,7 @@ int makecert_context_output_private_key_file(MAKECERT_CONTEXT* context, char* pa
|
|||||||
if (!filename)
|
if (!filename)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
strcpy(filename, context->output_file);
|
sprintf_s(filename, length + 8, "%s.key", context->output_file);
|
||||||
strcpy(&filename[length], ".key");
|
|
||||||
|
|
||||||
if (path)
|
if (path)
|
||||||
fullpath = GetCombinedPath(path, filename);
|
fullpath = GetCombinedPath(path, filename);
|
||||||
|
Loading…
Reference in New Issue
Block a user