libfreerdp-core: add gateway-usage-method command line option, avoid resetting BIO flags we shouldn't reset

This commit is contained in:
Marc-André Moreau 2014-05-30 12:31:26 -04:00
parent 357b9197a8
commit 629858b676
5 changed files with 38 additions and 11 deletions

View File

@ -73,6 +73,7 @@ COMMAND_LINE_ARGUMENT_A args[] =
{ "gu", COMMAND_LINE_VALUE_REQUIRED, "[<domain>\\]<user> or <user>[@<domain>]", NULL, NULL, -1, NULL, "Gateway username" },
{ "gp", COMMAND_LINE_VALUE_REQUIRED, "<password>", NULL, NULL, -1, NULL, "Gateway password" },
{ "gd", COMMAND_LINE_VALUE_REQUIRED, "<domain>", NULL, NULL, -1, NULL, "Gateway domain" },
{ "gateway-usage-method", COMMAND_LINE_VALUE_REQUIRED, "<direct|detect>", NULL, NULL, -1, NULL, "Gateway usage method" },
{ "load-balance-info", COMMAND_LINE_VALUE_REQUIRED, "<info string>", NULL, NULL, -1, NULL, "Load balance info" },
{ "app", COMMAND_LINE_VALUE_REQUIRED, "<executable path> or <||alias>", NULL, NULL, -1, NULL, "Remote application program" },
{ "app-name", COMMAND_LINE_VALUE_REQUIRED, "<app name>", NULL, NULL, -1, NULL, "Remote application name for user interface" },
@ -1384,11 +1385,10 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
settings->GatewayHostname = _strdup(settings->ServerHostname);
}
settings->GatewayEnabled = TRUE;
settings->GatewayUseSameCredentials = TRUE;
settings->GatewayUsageMethod = TSC_PROXY_MODE_DETECT;
settings->GatewayEnabled = TRUE;
settings->GatewayBypassLocal = TRUE;
freerdp_set_gateway_usage_method(settings, TSC_PROXY_MODE_DETECT);
}
CommandLineSwitchCase(arg, "gu")
{
@ -1412,6 +1412,27 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
settings->GatewayPassword = _strdup(arg->Value);
settings->GatewayUseSameCredentials = FALSE;
}
CommandLineSwitchCase(arg, "gateway-usage-method")
{
int type;
char* pEnd;
type = strtol(arg->Value, &pEnd, 10);
if (type == 0)
{
if (_stricmp(arg->Value, "none") == 0)
type = TSC_PROXY_MODE_NONE_DIRECT;
else if (_stricmp(arg->Value, "direct") == 0)
type = TSC_PROXY_MODE_DIRECT;
else if (_stricmp(arg->Value, "detect") == 0)
type = TSC_PROXY_MODE_DETECT;
else if (_stricmp(arg->Value, "default") == 0)
type = TSC_PROXY_MODE_DEFAULT;
}
freerdp_set_gateway_usage_method(settings, (UINT32) type);
}
CommandLineSwitchCase(arg, "app")
{
settings->RemoteApplicationProgram = _strdup(arg->Value);

View File

@ -212,9 +212,14 @@ BOOL freerdp_check_fds(freerdp* instance)
int status;
rdpRdp* rdp;
assert(instance);
assert(instance->context);
assert(instance->context->rdp);
if (!instance)
return FALSE;
if (!instance->context)
return FALSE;
if (!instance->context->rdp)
return FALSE;
rdp = instance->context->rdp;

View File

@ -236,7 +236,6 @@ rdpSettings* freerdp_settings_new(DWORD flags)
settings->SaltedChecksum = TRUE;
settings->ServerPort = 3389;
settings->GatewayPort = 443;
settings->GatewayBypassLocal = TRUE;
settings->DesktopResize = TRUE;
settings->ToggleFullscreen = TRUE;
settings->DesktopPosX = 0;

View File

@ -79,7 +79,7 @@ static int transport_bio_buffered_write(BIO* bio, const char* buf, int num)
DataChunk chunks[2];
ret = num;
BIO_clear_retry_flags(bio);
BIO_clear_flags(bio, (BIO_FLAGS_WRITE | BIO_FLAGS_SHOULD_RETRY | BIO_FLAGS_IO_SPECIAL));
tcp->writeBlocked = FALSE;
/* we directly append extra bytes in the xmit buffer, this could be prevented
@ -132,7 +132,7 @@ static int transport_bio_buffered_read(BIO* bio, char* buf, int size)
rdpTcp *tcp = (rdpTcp *)bio->ptr;
tcp->readBlocked = FALSE;
BIO_clear_retry_flags(bio);
BIO_clear_flags(bio, (BIO_FLAGS_READ | BIO_FLAGS_SHOULD_RETRY | BIO_FLAGS_IO_SPECIAL));
status = BIO_read(bio->next_bio, buf, size);
/*fprintf(stderr, "%s: size=%d status=%d shouldRetry=%d\n", __FUNCTION__, size, status, BIO_should_retry(bio->next_bio)); */

View File

@ -133,8 +133,10 @@ static int transport_bio_tsg_write(BIO* bio, const char* buf, int num)
tsg = (rdpTsg*) bio->ptr;
BIO_clear_retry_flags(bio);
BIO_clear_flags(bio, (BIO_FLAGS_WRITE | BIO_FLAGS_SHOULD_RETRY | BIO_FLAGS_IO_SPECIAL));
status = tsg_write(tsg, (BYTE*) buf, num);
if (status > 0)
return status;
@ -152,7 +154,7 @@ static int transport_bio_tsg_read(BIO* bio, char* buf, int size)
tsg = (rdpTsg*) bio->ptr;
status = tsg_read(bio->ptr, (BYTE*) buf, size);
BIO_clear_retry_flags(bio);
BIO_clear_flags(bio, (BIO_FLAGS_READ | BIO_FLAGS_SHOULD_RETRY | BIO_FLAGS_IO_SPECIAL));
if (status == 0)
{