2012-11-06 07:11:13 +04:00
|
|
|
/**
|
|
|
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
|
|
|
* FreeRDP Client Command-Line Interface
|
|
|
|
*
|
|
|
|
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
Standard RDP Security Layer Levels/Method Overhaul
[MS-RDPBCGR] Section 5.3 describes the encryption level and method values for
standard RDP security.
Looking at the current usage of these values in the FreeRDP code gives me
reason to believe that there is a certain lack of understanding of how these
values should be handled.
The encryption level is only configured on the server side in the "Encryption
Level" setting found in the Remote Desktop Session Host Configuration RDP-Tcp
properties dialog and this value is never transferred from the client to the
server over the wire.
The possible options are "None", "Low", "Client Compatible", "High" and
"FIPS Compliant". The client receices this value in the Server Security Data
block (TS_UD_SC_SEC1), probably only for informational purposes and maybe to
give the client the possibility to verify if the server's decision for the
encryption method confirms to the server's encryption level.
The possible encryption methods are "NONE", "40BIT", "56BIT", "128BIT" and
"FIPS" and the RDP client advertises the ones it supports to the server in the
Client Security Data block (TS_UD_CS_SEC).
The server's configured encryption level value restricts the possible final
encryption method.
Something that I was not able to find in the documentation is the priority
level of the individual encryption methods based on which the server makes its
final method decision if there are several options.
My analysis with Windows Servers reveiled that the order is 128, 56, 40, FIPS.
The server only chooses FIPS if the level is "FIPS Comliant" or if it is the
only method advertised by the client.
Bottom line:
* FreeRDP's client side does not need to set settings->EncryptionLevel
(which was done quite frequently).
* FreeRDP's server side does not have to set the supported encryption methods
list in settings->EncryptionMethods
Changes in this commit:
Removed unnecessary/confusing changes of EncryptionLevel/Methods settings
Refactor settings->DisableEncryption
* This value actually means "Advanced RDP Encryption (NLA/TLS) is NOT used"
* The old name caused lots of confusion among developers
* Renamed it to "UseRdpSecurityLayer" (the compare logic stays untouched)
Any client's setting of settings->EncryptionMethods were annihilated
* All clients "want" to set all supported methods
* Some clients forgot 56bit because 56bit was not supported at the time the
code was written
* settings->EncryptionMethods was overwritten anyways in nego_connect()
* Removed all client side settings of settings->EncryptionMethods
The default is "None" (0)
* Changed nego_connect() to advertise all supported methods if
settings->EncryptionMethods is 0 (None)
* Added a commandline option /encryption-methods:comma separated list of the
values "40", "56", "128", "FIPS". E.g. /encryption-methods:56,128
* Print warning if server chooses non-advertised method
Verify received level and method in client's gcc_read_server_security_data
* Only accept valid/known encryption methods
* Verify encryption level/method combinations according to MS-RDPBCGR 5.3.2
Server implementations can now set settings->EncryptionLevel
* The default for settings->EncryptionLevel is 0 (None)
* nego_send_negotiation_response() changes it to ClientCompatible in that case
* default to ClientCompatible if the server implementation set an invalid level
Fix server's gcc_write_server_security_data
* Verify server encryption level value set by server implementations
* Choose rdp encryption method based on level and supported client methods
* Moved FIPS to the lowest priority (only used if other methods are possible)
Updated sample server
* Support RDP Security (RdpKeyFile was not set)
* Added commented sample code for setting the security level
2014-12-12 04:17:12 +03:00
|
|
|
* Copyright 2014 Norbert Federa <norbert.federa@thincast.com>
|
2016-02-26 16:50:27 +03:00
|
|
|
* Copyright 2016 Armin Novak <armin.novak@gmail.com>
|
2012-11-06 07:11:13 +04:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2022-02-16 13:20:38 +03:00
|
|
|
#include <freerdp/config.h>
|
2012-11-06 07:11:13 +04:00
|
|
|
|
2016-12-11 01:13:35 +03:00
|
|
|
#include <ctype.h>
|
2017-11-14 18:10:52 +03:00
|
|
|
#include <errno.h>
|
2013-10-02 11:48:25 +04:00
|
|
|
|
2022-02-02 01:23:34 +03:00
|
|
|
#include <winpr/assert.h>
|
2012-11-06 07:11:13 +04:00
|
|
|
#include <winpr/crt.h>
|
2016-01-23 17:16:13 +03:00
|
|
|
#include <winpr/wlog.h>
|
2017-11-30 18:56:45 +03:00
|
|
|
#include <winpr/path.h>
|
2022-02-02 01:23:34 +03:00
|
|
|
#include <winpr/ncrypt.h>
|
2012-11-06 07:11:13 +04:00
|
|
|
|
2012-11-18 07:03:04 +04:00
|
|
|
#include <freerdp/addin.h>
|
2012-11-09 23:35:21 +04:00
|
|
|
#include <freerdp/settings.h>
|
2012-11-09 04:01:52 +04:00
|
|
|
#include <freerdp/client/channels.h>
|
2021-08-25 11:02:46 +03:00
|
|
|
#include <freerdp/channels/drdynvc.h>
|
|
|
|
#include <freerdp/channels/cliprdr.h>
|
|
|
|
#include <freerdp/channels/encomsp.h>
|
|
|
|
#include <freerdp/channels/rdp2tcp.h>
|
|
|
|
#include <freerdp/channels/remdesk.h>
|
|
|
|
#include <freerdp/channels/rdpsnd.h>
|
2022-02-22 12:54:42 +03:00
|
|
|
#include <freerdp/channels/disp.h>
|
2013-10-22 19:14:29 +04:00
|
|
|
#include <freerdp/crypto/crypto.h>
|
2012-11-27 01:49:12 +04:00
|
|
|
#include <freerdp/locale/keyboard.h>
|
2017-11-10 13:52:23 +03:00
|
|
|
#include <freerdp/utils/passphrase.h>
|
2022-04-04 13:59:37 +03:00
|
|
|
#include <freerdp/utils/proxy_utils.h>
|
2019-11-22 12:43:29 +03:00
|
|
|
#include <freerdp/channels/urbdrc.h>
|
2021-09-22 15:27:21 +03:00
|
|
|
#include <freerdp/channels/rdpdr.h>
|
2014-09-12 19:13:01 +04:00
|
|
|
|
2022-01-17 16:21:17 +03:00
|
|
|
#if defined(CHANNEL_AINPUT_CLIENT)
|
|
|
|
#include <freerdp/channels/ainput.h>
|
|
|
|
#endif
|
|
|
|
|
2012-11-06 07:11:13 +04:00
|
|
|
#include <freerdp/client/cmdline.h>
|
2013-11-06 20:29:33 +04:00
|
|
|
#include <freerdp/version.h>
|
2022-02-23 18:26:14 +03:00
|
|
|
#include <freerdp/client/utils/smartcard_cli.h>
|
2012-11-06 07:11:13 +04:00
|
|
|
|
2018-02-01 18:59:55 +03:00
|
|
|
#include "cmdline.h"
|
2012-12-05 21:12:18 +04:00
|
|
|
|
2014-09-12 19:13:01 +04:00
|
|
|
#include <freerdp/log.h>
|
|
|
|
#define TAG CLIENT_TAG("common.cmdline")
|
|
|
|
|
2019-11-08 17:42:05 +03:00
|
|
|
static BOOL freerdp_client_print_codepages(const char* arg)
|
|
|
|
{
|
|
|
|
size_t count = 0, x;
|
|
|
|
DWORD column = 2;
|
|
|
|
const char* filter = NULL;
|
|
|
|
char buffer[80];
|
|
|
|
RDP_CODEPAGE* pages;
|
|
|
|
|
|
|
|
if (arg)
|
|
|
|
filter = strchr(arg, ',') + 1;
|
|
|
|
pages = freerdp_keyboard_get_matching_codepages(column, filter, &count);
|
|
|
|
if (!pages)
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
printf("%-10s %-8s %-60s %-36s %-48s\n", "<id>", "<locale>", "<win langid>", "<language>",
|
|
|
|
"<country>");
|
|
|
|
for (x = 0; x < count; x++)
|
|
|
|
{
|
|
|
|
const RDP_CODEPAGE* page = &pages[x];
|
|
|
|
if (strnlen(page->subLanguageSymbol, ARRAYSIZE(page->subLanguageSymbol)) > 0)
|
|
|
|
_snprintf(buffer, sizeof(buffer), "[%s|%s]", page->primaryLanguageSymbol,
|
|
|
|
page->subLanguageSymbol);
|
|
|
|
else
|
|
|
|
_snprintf(buffer, sizeof(buffer), "[%s]", page->primaryLanguageSymbol);
|
|
|
|
printf("id=0x%04" PRIx16 ": [%-6s] %-60s %-36s %-48s\n", page->id, page->locale, buffer,
|
|
|
|
page->primaryLanguage, page->subLanguage);
|
|
|
|
}
|
|
|
|
freerdp_codepages_free(pages);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2019-08-23 12:47:31 +03:00
|
|
|
static BOOL freerdp_path_valid(const char* path, BOOL* special)
|
|
|
|
{
|
|
|
|
const char DynamicDrives[] = "DynamicDrives";
|
|
|
|
BOOL isPath = FALSE;
|
|
|
|
BOOL isSpecial;
|
|
|
|
if (!path)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
isSpecial = (strncmp(path, "*", 2) == 0) ||
|
2019-11-06 17:24:51 +03:00
|
|
|
(strncmp(path, DynamicDrives, sizeof(DynamicDrives)) == 0) ||
|
|
|
|
(strncmp(path, "%", 2) == 0)
|
|
|
|
? TRUE
|
|
|
|
: FALSE;
|
2019-08-23 12:47:31 +03:00
|
|
|
if (!isSpecial)
|
2021-05-31 12:42:03 +03:00
|
|
|
isPath = winpr_PathFileExists(path);
|
2019-08-23 12:47:31 +03:00
|
|
|
|
|
|
|
if (special)
|
|
|
|
*special = isSpecial;
|
|
|
|
|
|
|
|
return isSpecial || isPath;
|
|
|
|
}
|
|
|
|
|
2019-08-23 13:44:44 +03:00
|
|
|
static BOOL freerdp_sanitize_drive_name(char* name, const char* invalid, const char* replacement)
|
|
|
|
{
|
|
|
|
if (!name || !invalid || !replacement)
|
|
|
|
return FALSE;
|
|
|
|
if (strlen(invalid) != strlen(replacement))
|
|
|
|
return FALSE;
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
while (*invalid != '\0')
|
2019-08-23 13:44:44 +03:00
|
|
|
{
|
|
|
|
const char what = *invalid++;
|
|
|
|
const char with = *replacement++;
|
|
|
|
|
|
|
|
char* cur = name;
|
2019-11-06 17:24:51 +03:00
|
|
|
while ((cur = strchr(cur, what)) != NULL)
|
2019-08-23 13:44:44 +03:00
|
|
|
*cur = with;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2021-03-09 14:09:58 +03:00
|
|
|
static char* name_from_path(const char* path)
|
|
|
|
{
|
|
|
|
const char* name = "NULL";
|
|
|
|
if (path)
|
|
|
|
{
|
|
|
|
if (_strnicmp(path, "%", 2) == 0)
|
|
|
|
name = "home";
|
|
|
|
else if (_strnicmp(path, "*", 2) == 0)
|
|
|
|
name = "hotplug-all";
|
|
|
|
else if (_strnicmp(path, "DynamicDrives", 2) == 0)
|
|
|
|
name = "hotplug";
|
|
|
|
else
|
|
|
|
name = path;
|
|
|
|
}
|
|
|
|
return _strdup(name);
|
|
|
|
}
|
|
|
|
|
2019-08-23 12:47:31 +03:00
|
|
|
static BOOL freerdp_client_add_drive(rdpSettings* settings, const char* path, const char* name)
|
|
|
|
{
|
2021-10-07 11:43:16 +03:00
|
|
|
char* dname;
|
|
|
|
RDPDR_DEVICE* device = NULL;
|
2019-08-23 12:47:31 +03:00
|
|
|
|
|
|
|
if (name)
|
|
|
|
{
|
|
|
|
/* Path was entered as secondary argument, swap */
|
2021-05-31 12:42:03 +03:00
|
|
|
if (winpr_PathFileExists(name))
|
2019-08-23 12:47:31 +03:00
|
|
|
{
|
2021-05-31 12:42:03 +03:00
|
|
|
if (!winpr_PathFileExists(path) || (!PathIsRelativeA(name) && PathIsRelativeA(path)))
|
2019-09-24 16:44:34 +03:00
|
|
|
{
|
|
|
|
const char* tmp = path;
|
|
|
|
path = name;
|
|
|
|
name = tmp;
|
|
|
|
}
|
2019-08-23 12:47:31 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (name)
|
2021-10-07 11:43:16 +03:00
|
|
|
dname = _strdup(name);
|
2019-08-23 12:47:31 +03:00
|
|
|
else /* We need a name to send to the server. */
|
2021-10-07 11:43:16 +03:00
|
|
|
dname = name_from_path(path);
|
|
|
|
|
|
|
|
if (freerdp_sanitize_drive_name(dname, "\\/", "__"))
|
2021-03-09 14:09:58 +03:00
|
|
|
{
|
2021-10-07 11:43:16 +03:00
|
|
|
const char* args[] = { dname, path };
|
|
|
|
device = freerdp_device_new(RDPDR_DTYP_FILESYSTEM, ARRAYSIZE(args), args);
|
2021-03-09 14:09:58 +03:00
|
|
|
}
|
2021-10-07 11:43:16 +03:00
|
|
|
free(dname);
|
|
|
|
if (!device)
|
2022-05-01 11:57:11 +03:00
|
|
|
goto fail;
|
2019-08-23 12:47:31 +03:00
|
|
|
|
2021-10-07 11:43:16 +03:00
|
|
|
if (!path)
|
2019-08-23 12:47:31 +03:00
|
|
|
goto fail;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
BOOL isSpecial = FALSE;
|
|
|
|
BOOL isPath = freerdp_path_valid(path, &isSpecial);
|
|
|
|
|
2021-10-07 11:43:16 +03:00
|
|
|
if (!isPath && !isSpecial)
|
2019-08-23 12:47:31 +03:00
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
2021-10-07 11:43:16 +03:00
|
|
|
if (!freerdp_device_collection_add(settings, device))
|
2019-08-23 12:47:31 +03:00
|
|
|
goto fail;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
fail:
|
2021-10-07 11:43:16 +03:00
|
|
|
freerdp_device_free(device);
|
2019-08-23 12:47:31 +03:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2018-10-15 12:51:16 +03:00
|
|
|
static BOOL copy_value(const char* value, char** dst)
|
|
|
|
{
|
|
|
|
if (!dst || !value)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
free(*dst);
|
|
|
|
(*dst) = _strdup(value);
|
|
|
|
return (*dst) != NULL;
|
|
|
|
}
|
|
|
|
|
2020-02-12 14:03:43 +03:00
|
|
|
static BOOL append_value(const char* value, char** dst)
|
|
|
|
{
|
|
|
|
size_t x = 0, y;
|
2022-06-03 11:25:30 +03:00
|
|
|
size_t size;
|
2020-02-12 14:03:43 +03:00
|
|
|
char* tmp;
|
|
|
|
if (!dst || !value)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (*dst)
|
|
|
|
x = strlen(*dst);
|
|
|
|
y = strlen(value);
|
2022-06-03 11:25:30 +03:00
|
|
|
|
|
|
|
size = x + y + 2;
|
|
|
|
tmp = realloc(*dst, size);
|
2020-02-12 14:03:43 +03:00
|
|
|
if (!tmp)
|
|
|
|
return FALSE;
|
|
|
|
if (x == 0)
|
|
|
|
tmp[0] = '\0';
|
|
|
|
else
|
2022-06-03 11:25:30 +03:00
|
|
|
winpr_str_append(",", tmp, size, NULL);
|
|
|
|
winpr_str_append(value, tmp, size, NULL);
|
2020-02-12 14:03:43 +03:00
|
|
|
*dst = tmp;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
static BOOL value_to_int(const char* value, LONGLONG* result, LONGLONG min, LONGLONG max)
|
|
|
|
{
|
|
|
|
long long rc;
|
|
|
|
|
|
|
|
if (!value || !result)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
errno = 0;
|
|
|
|
rc = _strtoi64(value, NULL, 0);
|
|
|
|
|
|
|
|
if (errno != 0)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if ((rc < min) || (rc > max))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
*result = rc;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL value_to_uint(const char* value, ULONGLONG* result, ULONGLONG min, ULONGLONG max)
|
|
|
|
{
|
|
|
|
unsigned long long rc;
|
|
|
|
|
|
|
|
if (!value || !result)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
errno = 0;
|
|
|
|
rc = _strtoui64(value, NULL, 0);
|
|
|
|
|
|
|
|
if (errno != 0)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if ((rc < min) || (rc > max))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
*result = rc;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2017-05-04 15:46:58 +03:00
|
|
|
BOOL freerdp_client_print_version(void)
|
2012-11-07 07:08:09 +04:00
|
|
|
{
|
2021-05-18 13:31:59 +03:00
|
|
|
printf("This is FreeRDP version %s (%s)\n", FREERDP_VERSION_FULL, FREERDP_GIT_REVISION);
|
2016-02-01 17:09:51 +03:00
|
|
|
return TRUE;
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
|
|
|
|
2017-05-04 15:46:58 +03:00
|
|
|
BOOL freerdp_client_print_buildconfig(void)
|
2016-01-11 18:18:40 +03:00
|
|
|
{
|
2016-01-28 16:26:50 +03:00
|
|
|
printf("%s", freerdp_get_build_config());
|
2016-02-01 17:09:51 +03:00
|
|
|
return TRUE;
|
2016-01-11 18:18:40 +03:00
|
|
|
}
|
|
|
|
|
2021-09-10 14:03:09 +03:00
|
|
|
static void freerdp_client_print_scancodes(void)
|
|
|
|
{
|
|
|
|
DWORD x;
|
|
|
|
printf("RDP scancodes and their name for use with /kbd-remap\n");
|
|
|
|
|
|
|
|
for (x = 0; x < UINT16_MAX; x++)
|
|
|
|
{
|
|
|
|
const char* name = freerdp_keyboard_scancode_name(x);
|
|
|
|
if (name)
|
2022-02-01 18:46:03 +03:00
|
|
|
printf("0x%04" PRIx32 " --> %s\n", x, name);
|
2021-09-10 14:03:09 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-24 15:56:58 +03:00
|
|
|
static BOOL is_delimiter(const char* delimiters, char c)
|
|
|
|
{
|
|
|
|
char d;
|
|
|
|
while ((d = *delimiters++) != '\0')
|
|
|
|
{
|
|
|
|
if (d == c)
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2019-10-29 13:12:15 +03:00
|
|
|
static char* print_token(char* text, size_t start_offset, size_t* current, size_t limit,
|
2022-02-24 15:56:58 +03:00
|
|
|
const char* delimiters)
|
2018-11-20 16:11:10 +03:00
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
int rc;
|
|
|
|
size_t len = strlen(text);
|
2018-11-20 16:11:10 +03:00
|
|
|
|
|
|
|
if (*current < start_offset)
|
2019-10-29 13:12:15 +03:00
|
|
|
{
|
|
|
|
rc = printf("%*c", (int)(start_offset - *current), ' ');
|
|
|
|
if (rc < 0)
|
|
|
|
return NULL;
|
|
|
|
*current += (size_t)rc;
|
|
|
|
}
|
2018-11-20 16:11:10 +03:00
|
|
|
|
|
|
|
if (*current + len > limit)
|
|
|
|
{
|
2019-10-29 13:12:15 +03:00
|
|
|
size_t x;
|
2018-11-20 16:11:10 +03:00
|
|
|
|
|
|
|
for (x = MIN(len, limit - start_offset); x > 1; x--)
|
|
|
|
{
|
2022-02-24 15:56:58 +03:00
|
|
|
if (is_delimiter(delimiters, text[x]))
|
2018-11-20 16:11:10 +03:00
|
|
|
{
|
2019-10-29 13:12:15 +03:00
|
|
|
printf("%.*s\n", (int)x, text);
|
2018-11-20 16:11:10 +03:00
|
|
|
*current = 0;
|
|
|
|
return &text[x];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2019-10-29 13:12:15 +03:00
|
|
|
rc = printf("%s", text);
|
|
|
|
if (rc < 0)
|
|
|
|
return NULL;
|
|
|
|
*current += (size_t)rc;
|
2018-11-20 16:11:10 +03:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2019-10-29 13:12:15 +03:00
|
|
|
static size_t print_optionals(const char* text, size_t start_offset, size_t current)
|
2018-11-20 16:11:10 +03:00
|
|
|
{
|
|
|
|
const size_t limit = 80;
|
|
|
|
char* str = _strdup(text);
|
2022-02-24 15:56:58 +03:00
|
|
|
char* cur = print_token(str, start_offset, ¤t, limit, "[], ");
|
2018-11-20 16:11:10 +03:00
|
|
|
|
|
|
|
while (cur)
|
2022-02-24 15:56:58 +03:00
|
|
|
{
|
|
|
|
cur++;
|
|
|
|
cur = print_token(cur, start_offset + 1, ¤t, limit, "[], ");
|
|
|
|
}
|
2018-11-20 16:11:10 +03:00
|
|
|
|
|
|
|
free(str);
|
|
|
|
return current;
|
|
|
|
}
|
|
|
|
|
2019-10-29 13:12:15 +03:00
|
|
|
static size_t print_description(const char* text, size_t start_offset, size_t current)
|
2018-11-20 16:11:10 +03:00
|
|
|
{
|
|
|
|
const size_t limit = 80;
|
|
|
|
char* str = _strdup(text);
|
2022-02-24 15:56:58 +03:00
|
|
|
char* cur = print_token(str, start_offset, ¤t, limit, " ");
|
2018-11-20 16:11:10 +03:00
|
|
|
|
|
|
|
while (cur)
|
|
|
|
{
|
|
|
|
cur++;
|
2022-02-24 15:56:58 +03:00
|
|
|
cur = print_token(cur, start_offset, ¤t, limit, " ");
|
2018-11-20 16:11:10 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
free(str);
|
2019-11-06 17:24:51 +03:00
|
|
|
current += (size_t)printf("\n");
|
2018-11-20 16:11:10 +03:00
|
|
|
return current;
|
|
|
|
}
|
|
|
|
|
2021-09-07 09:31:07 +03:00
|
|
|
static void freerdp_client_print_command_line_args(const COMMAND_LINE_ARGUMENT_A* arg)
|
2012-11-07 03:49:02 +04:00
|
|
|
{
|
2017-05-04 15:46:58 +03:00
|
|
|
if (!arg)
|
|
|
|
return;
|
2012-11-07 03:49:02 +04:00
|
|
|
|
|
|
|
do
|
|
|
|
{
|
2019-10-29 13:12:15 +03:00
|
|
|
int rc;
|
|
|
|
size_t pos = 0;
|
|
|
|
const size_t description_offset = 30 + 8;
|
2012-11-07 03:49:02 +04:00
|
|
|
|
2018-11-20 16:11:10 +03:00
|
|
|
if (arg->Flags & COMMAND_LINE_VALUE_BOOL)
|
2019-10-29 13:12:15 +03:00
|
|
|
rc = printf(" %s%s", arg->Default ? "-" : "+", arg->Name);
|
2018-11-20 16:11:10 +03:00
|
|
|
else
|
2019-10-29 13:12:15 +03:00
|
|
|
rc = printf(" /%s", arg->Name);
|
|
|
|
|
|
|
|
if (rc < 0)
|
|
|
|
return;
|
|
|
|
pos += (size_t)rc;
|
2018-11-20 16:11:10 +03:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
if ((arg->Flags & COMMAND_LINE_VALUE_REQUIRED) ||
|
|
|
|
(arg->Flags & COMMAND_LINE_VALUE_OPTIONAL))
|
2018-11-20 16:11:10 +03:00
|
|
|
{
|
2012-11-07 03:49:02 +04:00
|
|
|
if (arg->Format)
|
|
|
|
{
|
2017-09-25 12:44:07 +03:00
|
|
|
if (arg->Flags & COMMAND_LINE_VALUE_OPTIONAL)
|
2018-11-20 16:11:10 +03:00
|
|
|
{
|
2019-10-29 13:12:15 +03:00
|
|
|
rc = printf("[:");
|
|
|
|
if (rc < 0)
|
|
|
|
return;
|
|
|
|
pos += (size_t)rc;
|
2018-11-20 16:11:10 +03:00
|
|
|
pos = print_optionals(arg->Format, pos, pos);
|
2019-10-29 13:12:15 +03:00
|
|
|
rc = printf("]");
|
|
|
|
if (rc < 0)
|
|
|
|
return;
|
|
|
|
pos += (size_t)rc;
|
2018-11-20 16:11:10 +03:00
|
|
|
}
|
2017-09-25 12:44:07 +03:00
|
|
|
else
|
2018-11-20 16:11:10 +03:00
|
|
|
{
|
2019-10-29 13:12:15 +03:00
|
|
|
rc = printf(":");
|
|
|
|
if (rc < 0)
|
|
|
|
return;
|
|
|
|
pos += (size_t)rc;
|
2018-11-20 16:11:10 +03:00
|
|
|
pos = print_optionals(arg->Format, pos, pos);
|
|
|
|
}
|
2012-11-07 03:49:02 +04:00
|
|
|
|
2018-11-20 16:11:10 +03:00
|
|
|
if (pos > description_offset)
|
|
|
|
{
|
|
|
|
printf("\n");
|
|
|
|
pos = 0;
|
|
|
|
}
|
|
|
|
}
|
2012-11-07 03:49:02 +04:00
|
|
|
}
|
2018-11-20 16:11:10 +03:00
|
|
|
|
2019-10-29 13:12:15 +03:00
|
|
|
rc = printf("%*c", (int)(description_offset - pos), ' ');
|
|
|
|
if (rc < 0)
|
|
|
|
return;
|
|
|
|
pos += (size_t)rc;
|
2018-11-20 16:11:10 +03:00
|
|
|
|
|
|
|
if (arg->Flags & COMMAND_LINE_VALUE_BOOL)
|
2019-10-29 13:12:15 +03:00
|
|
|
{
|
|
|
|
rc = printf("%s ", arg->Default ? "Disable" : "Enable");
|
|
|
|
if (rc < 0)
|
|
|
|
return;
|
|
|
|
pos += (size_t)rc;
|
|
|
|
}
|
2018-11-20 16:11:10 +03:00
|
|
|
|
|
|
|
print_description(arg->Text, description_offset, pos);
|
2019-11-06 17:24:51 +03:00
|
|
|
} while ((arg = CommandLineFindNextArgumentA(arg)) != NULL);
|
2017-05-04 15:46:58 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
BOOL freerdp_client_print_command_line_help(int argc, char** argv)
|
|
|
|
{
|
|
|
|
return freerdp_client_print_command_line_help_ex(argc, argv, NULL);
|
|
|
|
}
|
2012-11-07 03:49:02 +04:00
|
|
|
|
2017-05-04 15:46:58 +03:00
|
|
|
BOOL freerdp_client_print_command_line_help_ex(int argc, char** argv,
|
2022-02-24 15:56:58 +03:00
|
|
|
const COMMAND_LINE_ARGUMENT_A* custom)
|
2017-05-04 15:46:58 +03:00
|
|
|
{
|
2019-02-12 12:53:42 +03:00
|
|
|
const char* name = "FreeRDP";
|
2021-10-06 10:47:30 +03:00
|
|
|
COMMAND_LINE_ARGUMENT_A largs[ARRAYSIZE(global_cmd_args)];
|
|
|
|
memcpy(largs, global_cmd_args, sizeof(global_cmd_args));
|
2019-02-12 12:53:42 +03:00
|
|
|
|
|
|
|
if (argc > 0)
|
|
|
|
name = argv[0];
|
2019-01-29 18:22:46 +03:00
|
|
|
|
2017-05-04 15:46:58 +03:00
|
|
|
printf("\n");
|
|
|
|
printf("FreeRDP - A Free Remote Desktop Protocol Implementation\n");
|
|
|
|
printf("See www.freerdp.com for more information\n");
|
|
|
|
printf("\n");
|
|
|
|
printf("Usage: %s [file] [options] [/v:<server>[:port]]\n", argv[0]);
|
|
|
|
printf("\n");
|
|
|
|
printf("Syntax:\n");
|
|
|
|
printf(" /flag (enables flag)\n");
|
|
|
|
printf(" /option:<value> (specifies option with value)\n");
|
|
|
|
printf(" +toggle -toggle (enables or disables toggle, where '/' is a synonym of '+')\n");
|
|
|
|
printf("\n");
|
|
|
|
freerdp_client_print_command_line_args(custom);
|
2019-10-28 12:10:14 +03:00
|
|
|
freerdp_client_print_command_line_args(largs);
|
2014-09-16 23:07:38 +04:00
|
|
|
printf("\n");
|
|
|
|
printf("Examples:\n");
|
2019-02-12 12:53:42 +03:00
|
|
|
printf(" %s connection.rdp /p:Pwd123! /f\n", name);
|
|
|
|
printf(" %s /u:CONTOSO\\JohnDoe /p:Pwd123! /v:rdp.contoso.com\n", name);
|
|
|
|
printf(" %s /u:JohnDoe /p:Pwd123! /w:1366 /h:768 /v:192.168.1.100:4489\n", name);
|
2019-11-06 17:24:51 +03:00
|
|
|
printf(" %s /u:JohnDoe /p:Pwd123! /vmconnect:C824F53E-95D2-46C6-9A18-23A5BB403532 "
|
|
|
|
"/v:192.168.1.100\n",
|
2019-05-08 15:35:25 +03:00
|
|
|
name);
|
2014-09-16 23:07:38 +04:00
|
|
|
printf("\n");
|
|
|
|
printf("Clipboard Redirection: +clipboard\n");
|
|
|
|
printf("\n");
|
|
|
|
printf("Drive Redirection: /drive:home,/home/user\n");
|
|
|
|
printf("Smartcard Redirection: /smartcard:<device>\n");
|
2022-02-02 01:23:34 +03:00
|
|
|
printf("Smartcard logon with Kerberos authentication: /smartcard-logon /sec:nla\n");
|
|
|
|
|
2014-09-16 14:08:33 +04:00
|
|
|
printf("Serial Port Redirection: /serial:<name>,<device>,[SerCx2|SerCx|Serial],[permissive]\n");
|
|
|
|
printf("Serial Port Redirection: /serial:COM1,/dev/ttyS0\n");
|
2017-12-21 17:19:29 +03:00
|
|
|
printf("Parallel Port Redirection: /parallel:<name>,<device>\n");
|
2022-09-20 11:36:45 +03:00
|
|
|
printf("Printer Redirection: /printer:<device>,<driver>,[default]\n");
|
2019-05-14 21:02:31 +03:00
|
|
|
printf("TCP redirection: /rdp2tcp:/usr/bin/rdp2tcp\n");
|
2014-09-16 23:07:38 +04:00
|
|
|
printf("\n");
|
2015-03-17 05:10:58 +03:00
|
|
|
printf("Audio Output Redirection: /sound:sys:oss,dev:1,format:1\n");
|
2014-09-16 23:07:38 +04:00
|
|
|
printf("Audio Output Redirection: /sound:sys:alsa\n");
|
2015-03-17 05:10:58 +03:00
|
|
|
printf("Audio Input Redirection: /microphone:sys:oss,dev:1,format:1\n");
|
2014-09-16 23:07:38 +04:00
|
|
|
printf("Audio Input Redirection: /microphone:sys:alsa\n");
|
|
|
|
printf("\n");
|
2020-02-25 17:21:16 +03:00
|
|
|
printf("Multimedia Redirection: /video\n");
|
2020-02-26 13:12:46 +03:00
|
|
|
#ifdef CHANNEL_URBDRC_CLIENT
|
2020-04-24 02:16:10 +03:00
|
|
|
printf("USB Device Redirection: /usb:id:054c:0268#4669:6e6b,addr:04:0c\n");
|
2020-02-26 13:12:46 +03:00
|
|
|
#endif
|
2014-09-16 23:07:38 +04:00
|
|
|
printf("\n");
|
2014-03-22 04:24:43 +04:00
|
|
|
printf("For Gateways, the https_proxy environment variable is respected:\n");
|
2014-03-22 18:58:16 +04:00
|
|
|
#ifdef _WIN32
|
|
|
|
printf(" set HTTPS_PROXY=http://proxy.contoso.com:3128/\n");
|
|
|
|
#else
|
2014-03-22 04:24:43 +04:00
|
|
|
printf(" export https_proxy=http://proxy.contoso.com:3128/\n");
|
2014-03-22 18:58:16 +04:00
|
|
|
#endif
|
2019-02-12 12:53:42 +03:00
|
|
|
printf(" %s /g:rdp.contoso.com ...\n", name);
|
2014-03-22 04:24:43 +04:00
|
|
|
printf("\n");
|
2014-09-16 23:07:38 +04:00
|
|
|
printf("More documentation is coming, in the meantime consult source files\n");
|
|
|
|
printf("\n");
|
2016-02-01 17:09:51 +03:00
|
|
|
return TRUE;
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
static int freerdp_client_command_line_pre_filter(void* context, int index, int argc, LPSTR* argv)
|
2012-11-07 07:08:09 +04:00
|
|
|
{
|
|
|
|
if (index == 1)
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
size_t length;
|
2012-11-07 07:08:09 +04:00
|
|
|
rdpSettings* settings;
|
2019-01-29 18:22:46 +03:00
|
|
|
|
|
|
|
if (argc <= index)
|
|
|
|
return -1;
|
|
|
|
|
2018-10-15 12:51:16 +03:00
|
|
|
length = strlen(argv[index]);
|
2012-11-07 07:08:09 +04:00
|
|
|
|
|
|
|
if (length > 4)
|
|
|
|
{
|
2012-12-05 21:12:18 +04:00
|
|
|
if (_stricmp(&(argv[index])[length - 4], ".rdp") == 0)
|
2012-11-07 07:08:09 +04:00
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
settings = (rdpSettings*)context;
|
2016-08-04 17:13:37 +03:00
|
|
|
|
2022-02-02 11:41:25 +03:00
|
|
|
if (!freerdp_settings_set_string(settings, FreeRDP_ConnectionFile, argv[index]))
|
2015-06-18 14:00:10 +03:00
|
|
|
return COMMAND_LINE_ERROR_MEMORY;
|
2012-12-05 23:00:49 +04:00
|
|
|
|
|
|
|
return 1;
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
|
|
|
}
|
2014-06-29 02:33:46 +04:00
|
|
|
|
|
|
|
if (length > 13)
|
|
|
|
{
|
|
|
|
if (_stricmp(&(argv[index])[length - 13], ".msrcIncident") == 0)
|
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
settings = (rdpSettings*)context;
|
2016-08-04 17:13:37 +03:00
|
|
|
|
2022-02-02 11:41:25 +03:00
|
|
|
if (!freerdp_settings_set_string(settings, FreeRDP_AssistanceFile, argv[index]))
|
2015-06-18 14:00:10 +03:00
|
|
|
return COMMAND_LINE_ERROR_MEMORY;
|
2014-06-29 02:33:46 +04:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
|
|
|
|
2012-12-05 23:00:49 +04:00
|
|
|
return 0;
|
2012-11-07 03:49:02 +04:00
|
|
|
}
|
|
|
|
|
2021-10-06 10:44:26 +03:00
|
|
|
BOOL freerdp_client_add_device_channel(rdpSettings* settings, size_t count, const char** params)
|
2012-11-09 04:01:52 +04:00
|
|
|
{
|
2021-10-07 11:43:16 +03:00
|
|
|
WINPR_ASSERT(settings);
|
|
|
|
WINPR_ASSERT(params);
|
|
|
|
WINPR_ASSERT(count > 0);
|
|
|
|
|
2012-11-09 04:01:52 +04:00
|
|
|
if (strcmp(params[0], "drive") == 0)
|
|
|
|
{
|
2019-08-23 12:47:31 +03:00
|
|
|
BOOL rc;
|
|
|
|
if (count < 2)
|
2016-02-01 17:09:51 +03:00
|
|
|
return FALSE;
|
2012-11-09 04:01:52 +04:00
|
|
|
|
2014-04-28 05:29:44 +04:00
|
|
|
settings->DeviceRedirection = TRUE;
|
2019-08-23 12:47:31 +03:00
|
|
|
if (count < 3)
|
|
|
|
rc = freerdp_client_add_drive(settings, params[1], NULL);
|
|
|
|
else
|
|
|
|
rc = freerdp_client_add_drive(settings, params[2], params[1]);
|
2012-11-09 04:01:52 +04:00
|
|
|
|
2019-08-23 12:47:31 +03:00
|
|
|
return rc;
|
2012-11-09 04:01:52 +04:00
|
|
|
}
|
|
|
|
else if (strcmp(params[0], "printer") == 0)
|
|
|
|
{
|
2021-10-07 11:43:16 +03:00
|
|
|
RDPDR_DEVICE* printer;
|
2012-11-09 04:01:52 +04:00
|
|
|
|
2013-05-20 23:50:22 +04:00
|
|
|
if (count < 1)
|
2016-02-01 17:09:51 +03:00
|
|
|
return FALSE;
|
2012-11-09 04:01:52 +04:00
|
|
|
|
2014-04-28 05:29:44 +04:00
|
|
|
settings->RedirectPrinters = TRUE;
|
|
|
|
settings->DeviceRedirection = TRUE;
|
2014-03-26 19:05:12 +04:00
|
|
|
|
2021-10-07 11:43:16 +03:00
|
|
|
printer = freerdp_device_new(RDPDR_DTYP_PRINT, count - 1, ¶ms[1]);
|
|
|
|
if (!printer)
|
|
|
|
return FALSE;
|
2015-06-18 14:00:10 +03:00
|
|
|
|
2021-10-07 11:43:16 +03:00
|
|
|
if (!freerdp_device_collection_add(settings, printer))
|
|
|
|
{
|
|
|
|
freerdp_device_free(printer);
|
|
|
|
return FALSE;
|
2014-04-28 05:29:44 +04:00
|
|
|
}
|
2012-11-09 04:01:52 +04:00
|
|
|
|
2016-02-01 17:09:51 +03:00
|
|
|
return TRUE;
|
2012-11-09 04:01:52 +04:00
|
|
|
}
|
|
|
|
else if (strcmp(params[0], "smartcard") == 0)
|
|
|
|
{
|
2021-10-07 11:43:16 +03:00
|
|
|
RDPDR_DEVICE* smartcard;
|
2012-11-09 04:01:52 +04:00
|
|
|
|
2013-09-12 14:18:35 +04:00
|
|
|
if (count < 1)
|
2016-02-01 17:09:51 +03:00
|
|
|
return FALSE;
|
2012-11-09 04:01:52 +04:00
|
|
|
|
2014-04-28 05:29:44 +04:00
|
|
|
settings->RedirectSmartCards = TRUE;
|
|
|
|
settings->DeviceRedirection = TRUE;
|
2021-10-07 11:43:16 +03:00
|
|
|
|
|
|
|
smartcard = freerdp_device_new(RDPDR_DTYP_SMARTCARD, count - 1, ¶ms[1]);
|
2014-03-26 19:05:12 +04:00
|
|
|
|
2017-12-11 16:00:09 +03:00
|
|
|
if (!smartcard)
|
|
|
|
return FALSE;
|
2014-03-26 19:05:12 +04:00
|
|
|
|
2021-10-07 11:43:16 +03:00
|
|
|
if (!freerdp_device_collection_add(settings, smartcard))
|
2017-12-11 16:00:09 +03:00
|
|
|
{
|
2021-10-07 11:43:16 +03:00
|
|
|
freerdp_device_free(smartcard);
|
2017-12-11 16:00:09 +03:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2016-02-01 17:09:51 +03:00
|
|
|
return TRUE;
|
2012-11-09 04:01:52 +04:00
|
|
|
}
|
|
|
|
else if (strcmp(params[0], "serial") == 0)
|
|
|
|
{
|
2021-10-07 11:43:16 +03:00
|
|
|
RDPDR_DEVICE* serial;
|
2012-11-09 04:01:52 +04:00
|
|
|
|
2013-09-12 14:18:35 +04:00
|
|
|
if (count < 1)
|
2016-02-01 17:09:51 +03:00
|
|
|
return FALSE;
|
2012-11-09 04:01:52 +04:00
|
|
|
|
2014-04-28 05:29:44 +04:00
|
|
|
settings->RedirectSerialPorts = TRUE;
|
|
|
|
settings->DeviceRedirection = TRUE;
|
2021-10-07 11:43:16 +03:00
|
|
|
|
|
|
|
serial = freerdp_device_new(RDPDR_DTYP_SERIAL, count - 1, ¶ms[1]);
|
2014-03-26 19:05:12 +04:00
|
|
|
|
|
|
|
if (!serial)
|
2016-02-01 17:09:51 +03:00
|
|
|
return FALSE;
|
2012-11-09 04:01:52 +04:00
|
|
|
|
2021-10-07 11:43:16 +03:00
|
|
|
if (!freerdp_device_collection_add(settings, serial))
|
2015-06-18 14:00:10 +03:00
|
|
|
{
|
2021-10-07 11:43:16 +03:00
|
|
|
freerdp_device_free(serial);
|
2016-02-01 17:09:51 +03:00
|
|
|
return FALSE;
|
2015-06-18 14:00:10 +03:00
|
|
|
}
|
2012-11-09 04:01:52 +04:00
|
|
|
|
2016-02-01 17:09:51 +03:00
|
|
|
return TRUE;
|
2012-11-09 04:01:52 +04:00
|
|
|
}
|
|
|
|
else if (strcmp(params[0], "parallel") == 0)
|
|
|
|
{
|
2021-10-07 11:43:16 +03:00
|
|
|
RDPDR_DEVICE* parallel;
|
2012-11-09 04:01:52 +04:00
|
|
|
|
2013-09-12 14:18:35 +04:00
|
|
|
if (count < 1)
|
2016-02-01 17:09:51 +03:00
|
|
|
return FALSE;
|
2012-11-09 04:01:52 +04:00
|
|
|
|
2014-04-28 05:29:44 +04:00
|
|
|
settings->RedirectParallelPorts = TRUE;
|
|
|
|
settings->DeviceRedirection = TRUE;
|
2021-10-07 11:43:16 +03:00
|
|
|
|
|
|
|
parallel = freerdp_device_new(RDPDR_DTYP_PARALLEL, count - 1, ¶ms[1]);
|
2014-03-26 19:05:12 +04:00
|
|
|
|
|
|
|
if (!parallel)
|
2016-02-01 17:09:51 +03:00
|
|
|
return FALSE;
|
2012-11-09 04:01:52 +04:00
|
|
|
|
2021-10-07 11:43:16 +03:00
|
|
|
if (!freerdp_device_collection_add(settings, parallel))
|
2015-06-18 14:00:10 +03:00
|
|
|
{
|
2021-10-07 11:43:16 +03:00
|
|
|
freerdp_device_free(parallel);
|
2016-02-01 17:09:51 +03:00
|
|
|
return FALSE;
|
2015-06-18 14:00:10 +03:00
|
|
|
}
|
2012-11-09 04:01:52 +04:00
|
|
|
|
2016-02-01 17:09:51 +03:00
|
|
|
return TRUE;
|
2012-11-09 04:01:52 +04:00
|
|
|
}
|
|
|
|
|
2016-02-01 17:09:51 +03:00
|
|
|
return FALSE;
|
2012-11-09 04:01:52 +04:00
|
|
|
}
|
|
|
|
|
2021-04-12 11:38:40 +03:00
|
|
|
BOOL freerdp_client_del_static_channel(rdpSettings* settings, const char* name)
|
|
|
|
{
|
|
|
|
return freerdp_static_channel_collection_del(settings, name);
|
|
|
|
}
|
|
|
|
|
2021-10-06 10:44:26 +03:00
|
|
|
BOOL freerdp_client_add_static_channel(rdpSettings* settings, size_t count, const char** params)
|
2012-11-18 09:08:03 +04:00
|
|
|
{
|
2021-07-28 17:27:59 +03:00
|
|
|
ADDIN_ARGV* _args;
|
2017-02-22 15:46:47 +03:00
|
|
|
|
2019-10-29 13:12:15 +03:00
|
|
|
if (!settings || !params || !params[0] || (count > INT_MAX))
|
2017-02-22 15:46:47 +03:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (freerdp_static_channel_collection_find(settings, params[0]))
|
|
|
|
return TRUE;
|
|
|
|
|
2021-07-28 17:27:59 +03:00
|
|
|
_args = freerdp_addin_argv_new(count, (const char**)params);
|
2016-08-04 17:13:37 +03:00
|
|
|
|
2021-07-28 17:27:59 +03:00
|
|
|
if (!_args)
|
2016-02-01 17:09:51 +03:00
|
|
|
return FALSE;
|
2012-11-18 09:08:03 +04:00
|
|
|
|
2021-07-28 17:27:59 +03:00
|
|
|
if (!freerdp_static_channel_collection_add(settings, _args))
|
2021-04-12 11:38:40 +03:00
|
|
|
goto fail;
|
2012-11-18 09:08:03 +04:00
|
|
|
|
2016-02-01 17:09:51 +03:00
|
|
|
return TRUE;
|
2021-04-12 11:38:40 +03:00
|
|
|
fail:
|
2021-07-28 17:27:59 +03:00
|
|
|
freerdp_addin_argv_free(_args);
|
2016-02-01 17:09:51 +03:00
|
|
|
return FALSE;
|
2012-11-18 09:08:03 +04:00
|
|
|
}
|
|
|
|
|
2021-04-12 11:38:40 +03:00
|
|
|
BOOL freerdp_client_del_dynamic_channel(rdpSettings* settings, const char* name)
|
|
|
|
{
|
|
|
|
return freerdp_dynamic_channel_collection_del(settings, name);
|
|
|
|
}
|
|
|
|
|
2021-10-06 10:44:26 +03:00
|
|
|
BOOL freerdp_client_add_dynamic_channel(rdpSettings* settings, size_t count, const char** params)
|
2012-11-18 09:08:03 +04:00
|
|
|
{
|
2021-07-28 17:27:59 +03:00
|
|
|
ADDIN_ARGV* _args;
|
2017-02-22 15:46:47 +03:00
|
|
|
|
2019-10-29 13:12:15 +03:00
|
|
|
if (!settings || !params || !params[0] || (count > INT_MAX))
|
2017-02-22 15:46:47 +03:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (freerdp_dynamic_channel_collection_find(settings, params[0]))
|
|
|
|
return TRUE;
|
|
|
|
|
2021-10-06 10:44:26 +03:00
|
|
|
_args = freerdp_addin_argv_new(count, params);
|
2016-08-04 17:13:37 +03:00
|
|
|
|
2021-07-28 17:27:59 +03:00
|
|
|
if (!_args)
|
2016-02-01 17:09:51 +03:00
|
|
|
return FALSE;
|
2012-11-18 09:08:03 +04:00
|
|
|
|
2021-07-28 17:27:59 +03:00
|
|
|
if (!freerdp_dynamic_channel_collection_add(settings, _args))
|
2021-04-12 11:38:40 +03:00
|
|
|
goto fail;
|
2012-11-18 09:08:03 +04:00
|
|
|
|
2016-02-01 17:09:51 +03:00
|
|
|
return TRUE;
|
2016-08-04 17:13:37 +03:00
|
|
|
|
2021-04-12 11:38:40 +03:00
|
|
|
fail:
|
2021-07-28 17:27:59 +03:00
|
|
|
freerdp_addin_argv_free(_args);
|
2016-02-01 17:09:51 +03:00
|
|
|
return FALSE;
|
2012-11-18 09:08:03 +04:00
|
|
|
}
|
|
|
|
|
2022-05-06 09:21:29 +03:00
|
|
|
static BOOL read_pem_file(rdpSettings* settings, size_t id, const char* file)
|
|
|
|
{
|
|
|
|
INT64 s;
|
|
|
|
int rs;
|
|
|
|
size_t fr;
|
|
|
|
char* ptr;
|
|
|
|
BOOL rc = FALSE;
|
|
|
|
FILE* fp = winpr_fopen(file, "r");
|
|
|
|
if (!fp)
|
|
|
|
return FALSE;
|
|
|
|
rs = _fseeki64(fp, 0, SEEK_END);
|
|
|
|
if (rs < 0)
|
|
|
|
goto fail;
|
|
|
|
s = _ftelli64(fp);
|
|
|
|
if (s < 0)
|
|
|
|
goto fail;
|
|
|
|
rs = _fseeki64(fp, 0, SEEK_SET);
|
|
|
|
if (rs < 0)
|
|
|
|
goto fail;
|
|
|
|
|
|
|
|
if (!freerdp_settings_set_string_len(settings, id, NULL, s + 1ull))
|
|
|
|
goto fail;
|
|
|
|
|
|
|
|
ptr = freerdp_settings_get_string_writable(settings, id);
|
|
|
|
fr = fread(ptr, (size_t)s, 1, fp);
|
|
|
|
if (fr != 1)
|
|
|
|
goto fail;
|
|
|
|
rc = TRUE;
|
|
|
|
fail:
|
|
|
|
fclose(fp);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** @brief suboption type */
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
CMDLINE_SUBOPTION_STRING,
|
|
|
|
CMDLINE_SUBOPTION_FILE,
|
|
|
|
} CmdLineSubOptionType;
|
|
|
|
|
|
|
|
typedef BOOL (*CmdLineSubOptionCb)(const char* value, rdpSettings* settings);
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
const char* optname;
|
|
|
|
size_t id;
|
|
|
|
CmdLineSubOptionType opttype;
|
|
|
|
CmdLineSubOptionCb cb;
|
|
|
|
} CmdLineSubOptions;
|
|
|
|
|
|
|
|
static BOOL parseSubOptions(rdpSettings* settings, const CmdLineSubOptions* opts, size_t count,
|
|
|
|
const char* arg)
|
|
|
|
{
|
|
|
|
BOOL found = FALSE;
|
|
|
|
size_t xx;
|
|
|
|
|
|
|
|
for (xx = 0; xx < count; xx++)
|
|
|
|
{
|
|
|
|
const CmdLineSubOptions* opt = &opts[xx];
|
|
|
|
size_t optlen = strlen(opt->optname);
|
|
|
|
|
|
|
|
if (strncmp(opt->optname, arg, optlen) == 0)
|
|
|
|
{
|
|
|
|
const char* val = &arg[optlen];
|
|
|
|
BOOL status;
|
|
|
|
|
|
|
|
switch (opt->opttype)
|
|
|
|
{
|
|
|
|
case CMDLINE_SUBOPTION_STRING:
|
|
|
|
status = freerdp_settings_set_string(settings, opt->id, val);
|
|
|
|
break;
|
|
|
|
case CMDLINE_SUBOPTION_FILE:
|
|
|
|
status = read_pem_file(settings, opt->id, val);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
WLog_ERR(TAG, "invalid subOption type");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!status)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (opt->cb && !opt->cb(val, settings))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
found = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!found)
|
|
|
|
WLog_ERR(TAG, "option %s not handled", arg);
|
|
|
|
|
|
|
|
return found;
|
|
|
|
}
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
static int freerdp_client_command_line_post_filter(void* context, COMMAND_LINE_ARGUMENT_A* arg)
|
2012-11-07 08:07:03 +04:00
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
rdpSettings* settings = (rdpSettings*)context;
|
2017-11-30 18:56:45 +03:00
|
|
|
BOOL status = TRUE;
|
2018-10-15 12:51:16 +03:00
|
|
|
BOOL enable = arg->Value ? TRUE : FALSE;
|
2021-10-06 10:44:26 +03:00
|
|
|
union
|
2012-11-07 08:07:03 +04:00
|
|
|
{
|
2012-11-18 09:08:03 +04:00
|
|
|
char** p;
|
2021-10-06 10:44:26 +03:00
|
|
|
const char** pc;
|
|
|
|
} ptr;
|
|
|
|
|
|
|
|
CommandLineSwitchStart(arg) CommandLineSwitchCase(arg, "a")
|
|
|
|
{
|
2017-11-30 18:56:45 +03:00
|
|
|
size_t count;
|
2021-10-06 10:44:26 +03:00
|
|
|
ptr.p = CommandLineParseCommaSeparatedValues(arg->Value, &count);
|
2012-11-09 04:01:52 +04:00
|
|
|
|
2021-10-06 10:44:26 +03:00
|
|
|
if ((status = freerdp_client_add_device_channel(settings, count, ptr.pc)))
|
2012-11-09 04:01:52 +04:00
|
|
|
{
|
2012-11-18 09:08:03 +04:00
|
|
|
settings->DeviceRedirection = TRUE;
|
|
|
|
}
|
2012-11-09 04:01:52 +04:00
|
|
|
|
2021-10-06 10:44:26 +03:00
|
|
|
free(ptr.p);
|
2012-11-18 09:08:03 +04:00
|
|
|
}
|
2022-05-06 09:21:29 +03:00
|
|
|
CommandLineSwitchCase(arg, "kerberos")
|
|
|
|
{
|
|
|
|
size_t count;
|
|
|
|
|
|
|
|
ptr.p = CommandLineParseCommaSeparatedValuesEx("kerberos", arg->Value, &count);
|
|
|
|
if (ptr.pc)
|
|
|
|
{
|
|
|
|
size_t x;
|
|
|
|
const CmdLineSubOptions opts[] = {
|
|
|
|
{ "start-time:", FreeRDP_KerberosStartTime, CMDLINE_SUBOPTION_STRING, NULL },
|
|
|
|
{ "lifetime:", FreeRDP_KerberosLifeTime, CMDLINE_SUBOPTION_STRING, NULL },
|
|
|
|
{ "renewable-lifetime:", FreeRDP_KerberosRenewableLifeTime,
|
|
|
|
CMDLINE_SUBOPTION_STRING, NULL },
|
|
|
|
{ "cache:", FreeRDP_KerberosCache, CMDLINE_SUBOPTION_STRING, NULL },
|
|
|
|
{ "armor:", FreeRDP_KerberosArmor, CMDLINE_SUBOPTION_STRING, NULL },
|
|
|
|
{ "pkinit-anchors:", FreeRDP_PkinitAnchors, CMDLINE_SUBOPTION_STRING, NULL },
|
|
|
|
{ "pkcs11-module:", FreeRDP_Pkcs11Module, CMDLINE_SUBOPTION_STRING, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
for (x = 1; x < count; x++)
|
|
|
|
{
|
|
|
|
const char* cur = ptr.pc[x];
|
|
|
|
if (!parseSubOptions(settings, opts, ARRAYSIZE(opts), cur))
|
|
|
|
{
|
|
|
|
free(ptr.p);
|
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
free(ptr.p);
|
|
|
|
}
|
|
|
|
|
2012-11-18 09:08:03 +04:00
|
|
|
CommandLineSwitchCase(arg, "vc")
|
|
|
|
{
|
2017-11-30 18:56:45 +03:00
|
|
|
size_t count;
|
2021-10-06 10:44:26 +03:00
|
|
|
ptr.p = CommandLineParseCommaSeparatedValues(arg->Value, &count);
|
|
|
|
status = freerdp_client_add_static_channel(settings, count, ptr.pc);
|
|
|
|
free(ptr.p);
|
2012-11-18 09:08:03 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "dvc")
|
|
|
|
{
|
2017-11-30 18:56:45 +03:00
|
|
|
size_t count;
|
2021-10-06 10:44:26 +03:00
|
|
|
ptr.p = CommandLineParseCommaSeparatedValues(arg->Value, &count);
|
|
|
|
status = freerdp_client_add_dynamic_channel(settings, count, ptr.pc);
|
|
|
|
free(ptr.p);
|
2012-11-07 08:07:03 +04:00
|
|
|
}
|
2013-02-18 16:49:52 +04:00
|
|
|
CommandLineSwitchCase(arg, "drive")
|
|
|
|
{
|
2017-11-30 18:56:45 +03:00
|
|
|
size_t count;
|
2021-10-06 10:44:26 +03:00
|
|
|
ptr.p = CommandLineParseCommaSeparatedValuesEx(arg->Name, arg->Value, &count);
|
|
|
|
status = freerdp_client_add_device_channel(settings, count, ptr.pc);
|
|
|
|
free(ptr.p);
|
2013-02-18 16:49:52 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "serial")
|
|
|
|
{
|
2017-11-30 18:56:45 +03:00
|
|
|
size_t count;
|
2021-10-06 10:44:26 +03:00
|
|
|
ptr.p = CommandLineParseCommaSeparatedValuesEx(arg->Name, arg->Value, &count);
|
|
|
|
status = freerdp_client_add_device_channel(settings, count, ptr.pc);
|
|
|
|
free(ptr.p);
|
2013-02-18 16:49:52 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "parallel")
|
|
|
|
{
|
2017-11-30 18:56:45 +03:00
|
|
|
size_t count;
|
2021-10-06 10:44:26 +03:00
|
|
|
ptr.p = CommandLineParseCommaSeparatedValuesEx(arg->Name, arg->Value, &count);
|
|
|
|
status = freerdp_client_add_device_channel(settings, count, ptr.pc);
|
|
|
|
free(ptr.p);
|
2013-02-18 16:49:52 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "smartcard")
|
|
|
|
{
|
2017-11-30 18:56:45 +03:00
|
|
|
size_t count;
|
2021-10-06 10:44:26 +03:00
|
|
|
ptr.p = CommandLineParseCommaSeparatedValuesEx(arg->Name, arg->Value, &count);
|
|
|
|
status = freerdp_client_add_device_channel(settings, count, ptr.pc);
|
|
|
|
free(ptr.p);
|
2013-02-18 16:49:52 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "printer")
|
|
|
|
{
|
2017-11-30 18:56:45 +03:00
|
|
|
size_t count;
|
2021-10-06 10:44:26 +03:00
|
|
|
ptr.p = CommandLineParseCommaSeparatedValuesEx(arg->Name, arg->Value, &count);
|
|
|
|
status = freerdp_client_add_device_channel(settings, count, ptr.pc);
|
|
|
|
free(ptr.p);
|
2013-02-18 16:49:52 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "usb")
|
|
|
|
{
|
2017-11-30 18:56:45 +03:00
|
|
|
size_t count;
|
2021-10-06 10:44:26 +03:00
|
|
|
ptr.p = CommandLineParseCommaSeparatedValuesEx(URBDRC_CHANNEL_NAME, arg->Value, &count);
|
|
|
|
status = freerdp_client_add_dynamic_channel(settings, count, ptr.pc);
|
|
|
|
free(ptr.p);
|
2013-02-18 16:49:52 +04:00
|
|
|
}
|
2013-05-09 06:14:16 +04:00
|
|
|
CommandLineSwitchCase(arg, "multitouch")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->MultiTouchInput = enable;
|
2013-05-09 06:14:16 +04:00
|
|
|
}
|
2013-06-20 02:43:24 +04:00
|
|
|
CommandLineSwitchCase(arg, "gestures")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->MultiTouchGestures = enable;
|
2013-06-20 02:43:24 +04:00
|
|
|
}
|
2013-03-13 03:23:59 +04:00
|
|
|
CommandLineSwitchCase(arg, "echo")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->SupportEchoChannel = enable;
|
2013-03-13 03:23:59 +04:00
|
|
|
}
|
2017-06-26 23:16:22 +03:00
|
|
|
CommandLineSwitchCase(arg, "ssh-agent")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->SupportSSHAgentChannel = enable;
|
2017-06-26 23:16:22 +03:00
|
|
|
}
|
2013-07-10 00:10:59 +04:00
|
|
|
CommandLineSwitchCase(arg, "disp")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->SupportDisplayControl = enable;
|
2013-07-10 00:10:59 +04:00
|
|
|
}
|
2017-12-06 15:51:45 +03:00
|
|
|
CommandLineSwitchCase(arg, "geometry")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->SupportGeometryTracking = enable;
|
2017-12-06 15:51:45 +03:00
|
|
|
}
|
2017-12-08 00:50:29 +03:00
|
|
|
CommandLineSwitchCase(arg, "video")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->SupportGeometryTracking = enable; /* this requires geometry tracking */
|
|
|
|
settings->SupportVideoOptimized = enable;
|
2017-12-08 00:50:29 +03:00
|
|
|
}
|
2013-02-18 16:49:52 +04:00
|
|
|
CommandLineSwitchCase(arg, "sound")
|
|
|
|
{
|
2017-11-30 18:56:45 +03:00
|
|
|
size_t count;
|
2021-10-06 10:44:26 +03:00
|
|
|
ptr.p = CommandLineParseCommaSeparatedValuesEx(RDPSND_CHANNEL_NAME, arg->Value, &count);
|
|
|
|
status = freerdp_client_add_static_channel(settings, count, ptr.pc);
|
2020-02-27 14:12:20 +03:00
|
|
|
if (status)
|
|
|
|
{
|
2021-10-06 10:44:26 +03:00
|
|
|
status = freerdp_client_add_dynamic_channel(settings, count, ptr.pc);
|
2020-02-27 14:12:20 +03:00
|
|
|
}
|
2021-10-06 10:44:26 +03:00
|
|
|
free(ptr.p);
|
2013-02-18 16:49:52 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "microphone")
|
|
|
|
{
|
2017-11-30 18:56:45 +03:00
|
|
|
size_t count;
|
2021-10-06 10:44:26 +03:00
|
|
|
ptr.p = CommandLineParseCommaSeparatedValuesEx("audin", arg->Value, &count);
|
|
|
|
status = freerdp_client_add_dynamic_channel(settings, count, ptr.pc);
|
|
|
|
free(ptr.p);
|
2013-02-18 16:49:52 +04:00
|
|
|
}
|
2020-02-25 17:21:16 +03:00
|
|
|
#if defined(CHANNEL_TSMF_CLIENT)
|
2013-02-18 16:49:52 +04:00
|
|
|
CommandLineSwitchCase(arg, "multimedia")
|
|
|
|
{
|
2017-11-30 18:56:45 +03:00
|
|
|
size_t count;
|
2021-10-06 10:44:26 +03:00
|
|
|
ptr.p = CommandLineParseCommaSeparatedValuesEx("tsmf", arg->Value, &count);
|
|
|
|
status = freerdp_client_add_dynamic_channel(settings, count, ptr.pc);
|
|
|
|
free(ptr.p);
|
2013-02-18 16:49:52 +04:00
|
|
|
}
|
2020-02-25 17:21:16 +03:00
|
|
|
#endif
|
2014-01-30 07:53:32 +04:00
|
|
|
CommandLineSwitchCase(arg, "heartbeat")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->SupportHeartbeatPdu = enable;
|
2014-01-30 07:53:32 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "multitransport")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->SupportMultitransport = enable;
|
|
|
|
|
|
|
|
if (settings->SupportMultitransport)
|
2019-11-06 17:24:51 +03:00
|
|
|
settings->MultitransportFlags =
|
|
|
|
(TRANSPORT_TYPE_UDP_FECR | TRANSPORT_TYPE_UDP_FECL | TRANSPORT_TYPE_UDP_PREFERRED);
|
2018-10-15 12:51:16 +03:00
|
|
|
else
|
|
|
|
settings->MultitransportFlags = 0;
|
2014-01-30 07:53:32 +04:00
|
|
|
}
|
2021-10-07 11:43:16 +03:00
|
|
|
CommandLineSwitchEnd(arg)
|
|
|
|
|
|
|
|
return status
|
|
|
|
? 1
|
|
|
|
: -1;
|
2012-11-07 08:07:03 +04:00
|
|
|
}
|
|
|
|
|
2018-03-08 15:46:46 +03:00
|
|
|
BOOL freerdp_parse_username(const char* username, char** user, char** domain)
|
2012-11-26 23:31:31 +04:00
|
|
|
{
|
|
|
|
char* p;
|
2019-01-29 18:22:46 +03:00
|
|
|
size_t length = 0;
|
2012-11-26 23:31:31 +04:00
|
|
|
p = strchr(username, '\\');
|
2015-06-18 13:24:22 +03:00
|
|
|
*user = NULL;
|
|
|
|
*domain = NULL;
|
2012-11-26 23:31:31 +04:00
|
|
|
|
|
|
|
if (p)
|
|
|
|
{
|
2019-01-29 18:22:46 +03:00
|
|
|
length = (size_t)(p - username);
|
2015-06-15 10:47:16 +03:00
|
|
|
*user = _strdup(&p[1]);
|
2016-08-04 17:13:37 +03:00
|
|
|
|
2015-06-15 10:47:16 +03:00
|
|
|
if (!*user)
|
2016-02-01 17:09:51 +03:00
|
|
|
return FALSE;
|
2015-06-15 10:47:16 +03:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
*domain = (char*)calloc(length + 1UL, sizeof(char));
|
2016-08-04 17:13:37 +03:00
|
|
|
|
2015-06-15 10:47:16 +03:00
|
|
|
if (!*domain)
|
|
|
|
{
|
2016-08-04 17:13:37 +03:00
|
|
|
free(*user);
|
2015-06-15 10:47:16 +03:00
|
|
|
*user = NULL;
|
2016-02-01 17:09:51 +03:00
|
|
|
return FALSE;
|
2015-06-15 10:47:16 +03:00
|
|
|
}
|
|
|
|
|
2012-11-26 23:31:31 +04:00
|
|
|
strncpy(*domain, username, length);
|
|
|
|
(*domain)[length] = '\0';
|
2015-06-15 10:47:16 +03:00
|
|
|
}
|
2015-06-18 13:24:22 +03:00
|
|
|
else if (username)
|
2012-11-26 23:31:31 +04:00
|
|
|
{
|
2014-08-16 01:45:06 +04:00
|
|
|
/* Do not break up the name for '@'; both credSSP and the
|
|
|
|
* ClientInfo PDU expect 'user@corp.net' to be transmitted
|
2015-06-18 13:24:22 +03:00
|
|
|
* as username 'user@corp.net', domain empty (not NULL!).
|
2014-08-16 01:45:06 +04:00
|
|
|
*/
|
|
|
|
*user = _strdup(username);
|
2016-08-04 17:13:37 +03:00
|
|
|
|
2015-06-15 10:47:16 +03:00
|
|
|
if (!*user)
|
2016-02-01 17:09:51 +03:00
|
|
|
return FALSE;
|
2015-06-15 10:47:16 +03:00
|
|
|
|
2015-06-18 17:07:09 +03:00
|
|
|
*domain = _strdup("\0");
|
2015-06-18 13:24:22 +03:00
|
|
|
|
|
|
|
if (!*domain)
|
|
|
|
{
|
|
|
|
free(*user);
|
|
|
|
*user = NULL;
|
2016-02-01 17:09:51 +03:00
|
|
|
return FALSE;
|
2015-06-18 13:24:22 +03:00
|
|
|
}
|
2012-11-26 23:31:31 +04:00
|
|
|
}
|
2015-06-18 13:24:22 +03:00
|
|
|
else
|
2016-02-01 17:09:51 +03:00
|
|
|
return FALSE;
|
2012-11-26 23:31:31 +04:00
|
|
|
|
2016-02-01 17:09:51 +03:00
|
|
|
return TRUE;
|
2012-11-26 23:31:31 +04:00
|
|
|
}
|
|
|
|
|
2018-03-08 15:46:46 +03:00
|
|
|
BOOL freerdp_parse_hostname(const char* hostname, char** host, int* port)
|
2014-06-12 18:49:29 +04:00
|
|
|
{
|
|
|
|
char* p;
|
|
|
|
p = strrchr(hostname, ':');
|
|
|
|
|
|
|
|
if (p)
|
|
|
|
{
|
2019-01-29 18:22:46 +03:00
|
|
|
size_t length = (size_t)(p - hostname);
|
2018-11-22 18:28:30 +03:00
|
|
|
LONGLONG val;
|
2017-11-14 18:10:52 +03:00
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
if (!value_to_int(p + 1, &val, 1, UINT16_MAX))
|
2017-11-14 18:10:52 +03:00
|
|
|
return FALSE;
|
2017-11-27 12:54:49 +03:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
*host = (char*)calloc(length + 1UL, sizeof(char));
|
2014-06-12 18:49:29 +04:00
|
|
|
|
|
|
|
if (!(*host))
|
2016-02-01 17:09:51 +03:00
|
|
|
return FALSE;
|
2014-06-12 18:49:29 +04:00
|
|
|
|
|
|
|
CopyMemory(*host, hostname, length);
|
|
|
|
(*host)[length] = '\0';
|
2018-11-22 18:28:30 +03:00
|
|
|
*port = (UINT16)val;
|
2014-06-12 18:49:29 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*host = _strdup(hostname);
|
|
|
|
|
|
|
|
if (!(*host))
|
2016-02-01 17:09:51 +03:00
|
|
|
return FALSE;
|
2014-06-12 18:49:29 +04:00
|
|
|
|
|
|
|
*port = -1;
|
|
|
|
}
|
|
|
|
|
2016-02-01 17:09:51 +03:00
|
|
|
return TRUE;
|
2014-06-12 18:49:29 +04:00
|
|
|
}
|
|
|
|
|
2019-01-29 18:22:46 +03:00
|
|
|
BOOL freerdp_set_connection_type(rdpSettings* settings, UINT32 type)
|
2012-11-26 23:31:31 +04:00
|
|
|
{
|
2013-04-23 00:08:47 +04:00
|
|
|
settings->ConnectionType = type;
|
2014-09-25 01:23:12 +04:00
|
|
|
|
2012-11-26 23:31:31 +04:00
|
|
|
if (type == CONNECTION_TYPE_MODEM)
|
|
|
|
{
|
|
|
|
settings->DisableWallpaper = TRUE;
|
|
|
|
settings->AllowFontSmoothing = FALSE;
|
|
|
|
settings->AllowDesktopComposition = FALSE;
|
|
|
|
settings->DisableFullWindowDrag = TRUE;
|
|
|
|
settings->DisableMenuAnims = TRUE;
|
|
|
|
settings->DisableThemes = TRUE;
|
2021-11-17 21:17:52 +03:00
|
|
|
settings->NetworkAutoDetect = FALSE;
|
2012-11-26 23:31:31 +04:00
|
|
|
}
|
|
|
|
else if (type == CONNECTION_TYPE_BROADBAND_LOW)
|
|
|
|
{
|
|
|
|
settings->DisableWallpaper = TRUE;
|
|
|
|
settings->AllowFontSmoothing = FALSE;
|
|
|
|
settings->AllowDesktopComposition = FALSE;
|
|
|
|
settings->DisableFullWindowDrag = TRUE;
|
|
|
|
settings->DisableMenuAnims = TRUE;
|
|
|
|
settings->DisableThemes = FALSE;
|
2021-11-17 21:17:52 +03:00
|
|
|
settings->NetworkAutoDetect = FALSE;
|
2012-11-26 23:31:31 +04:00
|
|
|
}
|
|
|
|
else if (type == CONNECTION_TYPE_SATELLITE)
|
|
|
|
{
|
|
|
|
settings->DisableWallpaper = TRUE;
|
|
|
|
settings->AllowFontSmoothing = FALSE;
|
|
|
|
settings->AllowDesktopComposition = TRUE;
|
|
|
|
settings->DisableFullWindowDrag = TRUE;
|
|
|
|
settings->DisableMenuAnims = TRUE;
|
|
|
|
settings->DisableThemes = FALSE;
|
2021-11-17 21:17:52 +03:00
|
|
|
settings->NetworkAutoDetect = FALSE;
|
2012-11-26 23:31:31 +04:00
|
|
|
}
|
|
|
|
else if (type == CONNECTION_TYPE_BROADBAND_HIGH)
|
|
|
|
{
|
|
|
|
settings->DisableWallpaper = TRUE;
|
|
|
|
settings->AllowFontSmoothing = FALSE;
|
|
|
|
settings->AllowDesktopComposition = TRUE;
|
|
|
|
settings->DisableFullWindowDrag = TRUE;
|
|
|
|
settings->DisableMenuAnims = TRUE;
|
|
|
|
settings->DisableThemes = FALSE;
|
2021-11-17 21:17:52 +03:00
|
|
|
settings->NetworkAutoDetect = FALSE;
|
2012-11-26 23:31:31 +04:00
|
|
|
}
|
|
|
|
else if (type == CONNECTION_TYPE_WAN)
|
|
|
|
{
|
|
|
|
settings->DisableWallpaper = FALSE;
|
|
|
|
settings->AllowFontSmoothing = TRUE;
|
|
|
|
settings->AllowDesktopComposition = TRUE;
|
|
|
|
settings->DisableFullWindowDrag = FALSE;
|
|
|
|
settings->DisableMenuAnims = FALSE;
|
|
|
|
settings->DisableThemes = FALSE;
|
2021-11-17 21:17:52 +03:00
|
|
|
settings->NetworkAutoDetect = FALSE;
|
2012-11-26 23:31:31 +04:00
|
|
|
}
|
|
|
|
else if (type == CONNECTION_TYPE_LAN)
|
|
|
|
{
|
|
|
|
settings->DisableWallpaper = FALSE;
|
|
|
|
settings->AllowFontSmoothing = TRUE;
|
|
|
|
settings->AllowDesktopComposition = TRUE;
|
|
|
|
settings->DisableFullWindowDrag = FALSE;
|
|
|
|
settings->DisableMenuAnims = FALSE;
|
|
|
|
settings->DisableThemes = FALSE;
|
2021-11-17 21:17:52 +03:00
|
|
|
settings->NetworkAutoDetect = FALSE;
|
2012-11-26 23:31:31 +04:00
|
|
|
}
|
|
|
|
else if (type == CONNECTION_TYPE_AUTODETECT)
|
|
|
|
{
|
|
|
|
settings->DisableWallpaper = FALSE;
|
|
|
|
settings->AllowFontSmoothing = TRUE;
|
|
|
|
settings->AllowDesktopComposition = TRUE;
|
|
|
|
settings->DisableFullWindowDrag = FALSE;
|
|
|
|
settings->DisableMenuAnims = FALSE;
|
|
|
|
settings->DisableThemes = FALSE;
|
|
|
|
settings->NetworkAutoDetect = TRUE;
|
2019-08-22 16:56:10 +03:00
|
|
|
|
|
|
|
/* Automatically activate GFX and RFX codec support */
|
|
|
|
#ifdef WITH_GFX_H264
|
|
|
|
settings->GfxAVC444 = TRUE;
|
|
|
|
settings->GfxH264 = TRUE;
|
|
|
|
#endif
|
|
|
|
settings->RemoteFxCodec = TRUE;
|
|
|
|
settings->SupportGraphicsPipeline = TRUE;
|
2012-11-26 23:31:31 +04:00
|
|
|
}
|
2018-09-11 18:17:52 +03:00
|
|
|
else
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
2012-11-26 23:31:31 +04:00
|
|
|
|
2016-02-01 17:09:51 +03:00
|
|
|
return TRUE;
|
2012-11-26 23:31:31 +04:00
|
|
|
}
|
|
|
|
|
2019-11-20 13:30:14 +03:00
|
|
|
static int freerdp_map_keyboard_layout_name_to_id(char* name)
|
2012-11-27 01:49:12 +04:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int id = 0;
|
|
|
|
RDP_KEYBOARD_LAYOUT* layouts;
|
|
|
|
layouts = freerdp_keyboard_get_layouts(RDP_KEYBOARD_LAYOUT_TYPE_STANDARD);
|
2016-08-04 17:13:37 +03:00
|
|
|
|
2015-06-17 23:08:02 +03:00
|
|
|
if (!layouts)
|
|
|
|
return -1;
|
2015-05-06 23:32:45 +03:00
|
|
|
|
2012-11-27 01:49:12 +04:00
|
|
|
for (i = 0; layouts[i].code; i++)
|
|
|
|
{
|
|
|
|
if (_stricmp(layouts[i].name, name) == 0)
|
2019-10-29 13:12:15 +03:00
|
|
|
id = (int)layouts[i].code;
|
2012-11-27 01:49:12 +04:00
|
|
|
}
|
2015-05-06 23:32:45 +03:00
|
|
|
|
2018-09-24 10:07:59 +03:00
|
|
|
freerdp_keyboard_layouts_free(layouts);
|
2012-11-27 01:49:12 +04:00
|
|
|
|
|
|
|
if (id)
|
|
|
|
return id;
|
|
|
|
|
|
|
|
layouts = freerdp_keyboard_get_layouts(RDP_KEYBOARD_LAYOUT_TYPE_VARIANT);
|
2016-08-04 17:13:37 +03:00
|
|
|
|
2015-06-17 23:08:02 +03:00
|
|
|
if (!layouts)
|
|
|
|
return -1;
|
2015-05-06 23:32:45 +03:00
|
|
|
|
2012-11-27 01:49:12 +04:00
|
|
|
for (i = 0; layouts[i].code; i++)
|
|
|
|
{
|
|
|
|
if (_stricmp(layouts[i].name, name) == 0)
|
2019-10-29 13:12:15 +03:00
|
|
|
id = (int)layouts[i].code;
|
2012-11-27 01:49:12 +04:00
|
|
|
}
|
2015-05-06 23:32:45 +03:00
|
|
|
|
2018-09-24 10:07:59 +03:00
|
|
|
freerdp_keyboard_layouts_free(layouts);
|
2012-11-27 01:49:12 +04:00
|
|
|
|
|
|
|
if (id)
|
|
|
|
return id;
|
|
|
|
|
|
|
|
layouts = freerdp_keyboard_get_layouts(RDP_KEYBOARD_LAYOUT_TYPE_IME);
|
2016-08-04 17:13:37 +03:00
|
|
|
|
2015-06-17 23:08:02 +03:00
|
|
|
if (!layouts)
|
|
|
|
return -1;
|
2015-05-06 23:32:45 +03:00
|
|
|
|
2012-11-27 01:49:12 +04:00
|
|
|
for (i = 0; layouts[i].code; i++)
|
|
|
|
{
|
|
|
|
if (_stricmp(layouts[i].name, name) == 0)
|
2019-10-29 13:12:15 +03:00
|
|
|
id = (int)layouts[i].code;
|
2012-11-27 01:49:12 +04:00
|
|
|
}
|
2015-05-06 23:32:45 +03:00
|
|
|
|
2018-09-24 10:07:59 +03:00
|
|
|
freerdp_keyboard_layouts_free(layouts);
|
2012-11-27 01:49:12 +04:00
|
|
|
|
|
|
|
if (id)
|
|
|
|
return id;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
static int freerdp_detect_command_line_pre_filter(void* context, int index, int argc, LPSTR* argv)
|
2013-09-18 01:03:35 +04:00
|
|
|
{
|
2019-01-29 18:22:46 +03:00
|
|
|
size_t length;
|
|
|
|
WINPR_UNUSED(context);
|
2013-09-18 01:03:35 +04:00
|
|
|
|
|
|
|
if (index == 1)
|
|
|
|
{
|
2019-01-29 18:22:46 +03:00
|
|
|
if (argc < index)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
length = strlen(argv[index]);
|
2013-09-18 01:03:35 +04:00
|
|
|
|
|
|
|
if (length > 4)
|
|
|
|
{
|
|
|
|
if (_stricmp(&(argv[index])[length - 4], ".rdp") == 0)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
2015-05-06 23:32:45 +03:00
|
|
|
|
|
|
|
if (length > 13)
|
|
|
|
{
|
|
|
|
if (_stricmp(&(argv[index])[length - 13], ".msrcIncident") == 0)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
2013-09-18 01:03:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
static int freerdp_detect_windows_style_command_line_syntax(int argc, char** argv, size_t* count,
|
|
|
|
BOOL ignoreUnknown)
|
2012-12-05 21:12:18 +04:00
|
|
|
{
|
|
|
|
int status;
|
|
|
|
DWORD flags;
|
|
|
|
int detect_status;
|
2021-09-07 09:31:07 +03:00
|
|
|
const COMMAND_LINE_ARGUMENT_A* arg;
|
2021-10-06 10:47:30 +03:00
|
|
|
COMMAND_LINE_ARGUMENT_A largs[ARRAYSIZE(global_cmd_args)];
|
|
|
|
memcpy(largs, global_cmd_args, sizeof(global_cmd_args));
|
2019-10-28 12:10:14 +03:00
|
|
|
|
2018-12-11 12:25:44 +03:00
|
|
|
flags = COMMAND_LINE_SEPARATOR_COLON | COMMAND_LINE_SILENCE_PARSER;
|
2012-12-05 21:12:18 +04:00
|
|
|
flags |= COMMAND_LINE_SIGIL_SLASH | COMMAND_LINE_SIGIL_PLUS_MINUS;
|
2015-05-06 23:32:45 +03:00
|
|
|
|
2015-03-16 12:25:31 +03:00
|
|
|
if (ignoreUnknown)
|
|
|
|
{
|
|
|
|
flags |= COMMAND_LINE_IGN_UNKNOWN_KEYWORD;
|
|
|
|
}
|
2012-12-05 21:12:18 +04:00
|
|
|
|
|
|
|
*count = 0;
|
|
|
|
detect_status = 0;
|
2019-10-28 12:10:14 +03:00
|
|
|
CommandLineClearArgumentsA(largs);
|
2019-11-06 17:24:51 +03:00
|
|
|
status = CommandLineParseArgumentsA(argc, argv, largs, flags, NULL,
|
|
|
|
freerdp_detect_command_line_pre_filter, NULL);
|
2013-09-18 01:03:35 +04:00
|
|
|
|
2013-09-09 18:07:14 +04:00
|
|
|
if (status < 0)
|
|
|
|
return status;
|
2012-12-05 21:12:18 +04:00
|
|
|
|
2019-10-28 12:10:14 +03:00
|
|
|
arg = largs;
|
2012-12-05 21:12:18 +04:00
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if (!(arg->Flags & COMMAND_LINE_ARGUMENT_PRESENT))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
(*count)++;
|
2019-11-06 17:24:51 +03:00
|
|
|
} while ((arg = CommandLineFindNextArgumentA(arg)) != NULL);
|
2012-12-05 21:12:18 +04:00
|
|
|
|
2013-07-03 18:44:06 +04:00
|
|
|
if ((status <= COMMAND_LINE_ERROR) && (status >= COMMAND_LINE_ERROR_LAST))
|
|
|
|
detect_status = -1;
|
2012-12-05 21:12:18 +04:00
|
|
|
|
2013-07-03 18:44:06 +04:00
|
|
|
return detect_status;
|
2012-12-05 21:12:18 +04:00
|
|
|
}
|
|
|
|
|
2019-11-20 13:30:14 +03:00
|
|
|
static int freerdp_detect_posix_style_command_line_syntax(int argc, char** argv, size_t* count,
|
|
|
|
BOOL ignoreUnknown)
|
2012-12-05 21:12:18 +04:00
|
|
|
{
|
|
|
|
int status;
|
|
|
|
DWORD flags;
|
|
|
|
int detect_status;
|
2021-09-07 09:31:07 +03:00
|
|
|
const COMMAND_LINE_ARGUMENT_A* arg;
|
2021-10-06 10:47:30 +03:00
|
|
|
COMMAND_LINE_ARGUMENT_A largs[ARRAYSIZE(global_cmd_args)];
|
|
|
|
memcpy(largs, global_cmd_args, sizeof(global_cmd_args));
|
2019-10-28 12:10:14 +03:00
|
|
|
|
2018-12-11 12:25:44 +03:00
|
|
|
flags = COMMAND_LINE_SEPARATOR_SPACE | COMMAND_LINE_SILENCE_PARSER;
|
2012-12-05 21:12:18 +04:00
|
|
|
flags |= COMMAND_LINE_SIGIL_DASH | COMMAND_LINE_SIGIL_DOUBLE_DASH;
|
|
|
|
flags |= COMMAND_LINE_SIGIL_ENABLE_DISABLE;
|
2015-05-06 23:32:45 +03:00
|
|
|
|
2015-03-16 12:25:31 +03:00
|
|
|
if (ignoreUnknown)
|
|
|
|
{
|
|
|
|
flags |= COMMAND_LINE_IGN_UNKNOWN_KEYWORD;
|
|
|
|
}
|
2012-12-05 21:12:18 +04:00
|
|
|
|
|
|
|
*count = 0;
|
|
|
|
detect_status = 0;
|
2019-10-28 12:10:14 +03:00
|
|
|
CommandLineClearArgumentsA(largs);
|
2019-11-06 17:24:51 +03:00
|
|
|
status = CommandLineParseArgumentsA(argc, argv, largs, flags, NULL,
|
|
|
|
freerdp_detect_command_line_pre_filter, NULL);
|
2013-09-18 01:03:35 +04:00
|
|
|
|
2013-09-09 18:07:14 +04:00
|
|
|
if (status < 0)
|
|
|
|
return status;
|
2012-12-05 21:12:18 +04:00
|
|
|
|
2019-10-28 12:10:14 +03:00
|
|
|
arg = largs;
|
2012-12-05 21:12:18 +04:00
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if (!(arg->Flags & COMMAND_LINE_ARGUMENT_PRESENT))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
(*count)++;
|
2019-11-06 17:24:51 +03:00
|
|
|
} while ((arg = CommandLineFindNextArgumentA(arg)) != NULL);
|
2012-12-05 21:12:18 +04:00
|
|
|
|
2013-07-03 18:44:06 +04:00
|
|
|
if ((status <= COMMAND_LINE_ERROR) && (status >= COMMAND_LINE_ERROR_LAST))
|
|
|
|
detect_status = -1;
|
2012-12-05 21:12:18 +04:00
|
|
|
|
2013-07-03 18:44:06 +04:00
|
|
|
return detect_status;
|
2012-12-05 21:12:18 +04:00
|
|
|
}
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
static BOOL freerdp_client_detect_command_line(int argc, char** argv, DWORD* flags)
|
2012-12-05 21:12:18 +04:00
|
|
|
{
|
|
|
|
int posix_cli_status;
|
2017-11-30 18:56:45 +03:00
|
|
|
size_t posix_cli_count;
|
2012-12-05 21:12:18 +04:00
|
|
|
int windows_cli_status;
|
2017-11-30 18:56:45 +03:00
|
|
|
size_t windows_cli_count;
|
2018-12-11 13:42:25 +03:00
|
|
|
const BOOL ignoreUnknown = TRUE;
|
2019-11-06 17:24:51 +03:00
|
|
|
windows_cli_status = freerdp_detect_windows_style_command_line_syntax(
|
|
|
|
argc, argv, &windows_cli_count, ignoreUnknown);
|
|
|
|
posix_cli_status =
|
|
|
|
freerdp_detect_posix_style_command_line_syntax(argc, argv, &posix_cli_count, ignoreUnknown);
|
2021-10-14 09:25:46 +03:00
|
|
|
|
2012-12-05 21:12:18 +04:00
|
|
|
/* Default is POSIX syntax */
|
|
|
|
*flags = COMMAND_LINE_SEPARATOR_SPACE;
|
|
|
|
*flags |= COMMAND_LINE_SIGIL_DASH | COMMAND_LINE_SIGIL_DOUBLE_DASH;
|
|
|
|
*flags |= COMMAND_LINE_SIGIL_ENABLE_DISABLE;
|
|
|
|
|
2014-09-17 00:51:01 +04:00
|
|
|
if (posix_cli_status <= COMMAND_LINE_STATUS_PRINT)
|
2021-10-14 09:25:46 +03:00
|
|
|
return FALSE;
|
2014-09-17 00:51:01 +04:00
|
|
|
|
2015-01-15 15:57:28 +03:00
|
|
|
/* Check, if this may be windows style syntax... */
|
2019-11-06 17:24:51 +03:00
|
|
|
if ((windows_cli_count && (windows_cli_count >= posix_cli_count)) ||
|
|
|
|
(windows_cli_status <= COMMAND_LINE_STATUS_PRINT))
|
2012-12-05 21:12:18 +04:00
|
|
|
{
|
2015-01-15 18:01:57 +03:00
|
|
|
windows_cli_count = 1;
|
2012-12-05 21:12:18 +04:00
|
|
|
*flags = COMMAND_LINE_SEPARATOR_COLON;
|
|
|
|
*flags |= COMMAND_LINE_SIGIL_SLASH | COMMAND_LINE_SIGIL_PLUS_MINUS;
|
|
|
|
}
|
|
|
|
|
2021-10-14 09:25:46 +03:00
|
|
|
WLog_DBG(TAG, "windows: %d/%d posix: %d/%d", windows_cli_status, windows_cli_count,
|
|
|
|
posix_cli_status, posix_cli_count);
|
2021-10-14 10:01:00 +03:00
|
|
|
if ((posix_cli_count == 0) && (windows_cli_count == 0))
|
|
|
|
{
|
|
|
|
if ((posix_cli_status == COMMAND_LINE_ERROR) && (windows_cli_status == COMMAND_LINE_ERROR))
|
|
|
|
return TRUE;
|
|
|
|
}
|
2021-10-14 09:25:46 +03:00
|
|
|
return FALSE;
|
2012-12-05 21:12:18 +04:00
|
|
|
}
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
int freerdp_client_settings_command_line_status_print(rdpSettings* settings, int status, int argc,
|
|
|
|
char** argv)
|
2017-05-04 15:46:58 +03:00
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
return freerdp_client_settings_command_line_status_print_ex(settings, status, argc, argv, NULL);
|
2017-05-04 15:46:58 +03:00
|
|
|
}
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
int freerdp_client_settings_command_line_status_print_ex(rdpSettings* settings, int status,
|
|
|
|
int argc, char** argv,
|
2022-02-24 15:56:58 +03:00
|
|
|
const COMMAND_LINE_ARGUMENT_A* custom)
|
2012-11-06 07:11:13 +04:00
|
|
|
{
|
2021-09-07 09:31:07 +03:00
|
|
|
const COMMAND_LINE_ARGUMENT_A* arg;
|
2021-10-06 10:47:30 +03:00
|
|
|
COMMAND_LINE_ARGUMENT_A largs[ARRAYSIZE(global_cmd_args)];
|
|
|
|
memcpy(largs, global_cmd_args, sizeof(global_cmd_args));
|
2012-11-06 07:11:13 +04:00
|
|
|
|
2013-09-09 18:07:14 +04:00
|
|
|
if (status == COMMAND_LINE_STATUS_PRINT_VERSION)
|
2012-11-07 03:49:02 +04:00
|
|
|
{
|
2012-11-07 07:08:09 +04:00
|
|
|
freerdp_client_print_version();
|
2021-01-22 11:44:55 +03:00
|
|
|
goto out;
|
2012-11-07 03:49:02 +04:00
|
|
|
}
|
2016-08-04 17:13:37 +03:00
|
|
|
|
2016-01-11 18:18:40 +03:00
|
|
|
if (status == COMMAND_LINE_STATUS_PRINT_BUILDCONFIG)
|
|
|
|
{
|
|
|
|
freerdp_client_print_version();
|
|
|
|
freerdp_client_print_buildconfig();
|
2021-01-22 11:44:55 +03:00
|
|
|
goto out;
|
2016-01-11 18:18:40 +03:00
|
|
|
}
|
2012-11-27 01:49:12 +04:00
|
|
|
else if (status == COMMAND_LINE_STATUS_PRINT)
|
|
|
|
{
|
2019-11-08 17:42:05 +03:00
|
|
|
CommandLineParseArgumentsA(argc, argv, largs, 0x112, NULL, NULL, NULL);
|
|
|
|
|
|
|
|
arg = CommandLineFindArgumentA(largs, "kbd-lang-list");
|
|
|
|
|
|
|
|
if (arg->Flags & COMMAND_LINE_ARGUMENT_PRESENT)
|
|
|
|
{
|
|
|
|
freerdp_client_print_codepages(arg->Value);
|
|
|
|
}
|
|
|
|
|
2019-10-28 12:10:14 +03:00
|
|
|
arg = CommandLineFindArgumentA(largs, "kbd-list");
|
2012-11-27 01:49:12 +04:00
|
|
|
|
|
|
|
if (arg->Flags & COMMAND_LINE_VALUE_PRESENT)
|
|
|
|
{
|
2017-11-21 10:46:29 +03:00
|
|
|
DWORD i;
|
2012-11-27 01:49:12 +04:00
|
|
|
RDP_KEYBOARD_LAYOUT* layouts;
|
|
|
|
layouts = freerdp_keyboard_get_layouts(RDP_KEYBOARD_LAYOUT_TYPE_STANDARD);
|
2019-11-06 17:24:51 +03:00
|
|
|
// if (!layouts) /* FIXME*/
|
2014-09-16 23:07:38 +04:00
|
|
|
printf("\nKeyboard Layouts\n");
|
2016-08-04 17:13:37 +03:00
|
|
|
|
2012-11-27 01:49:12 +04:00
|
|
|
for (i = 0; layouts[i].code; i++)
|
2019-11-06 17:24:51 +03:00
|
|
|
printf("0x%08" PRIX32 "\t%s\n", layouts[i].code, layouts[i].name);
|
2014-09-12 19:13:01 +04:00
|
|
|
|
2018-09-24 10:07:59 +03:00
|
|
|
freerdp_keyboard_layouts_free(layouts);
|
2014-09-16 23:07:38 +04:00
|
|
|
layouts = freerdp_keyboard_get_layouts(RDP_KEYBOARD_LAYOUT_TYPE_VARIANT);
|
2019-11-06 17:24:51 +03:00
|
|
|
// if (!layouts) /* FIXME*/
|
2014-09-16 23:07:38 +04:00
|
|
|
printf("\nKeyboard Layout Variants\n");
|
2016-08-04 17:13:37 +03:00
|
|
|
|
2012-11-27 01:49:12 +04:00
|
|
|
for (i = 0; layouts[i].code; i++)
|
2019-11-06 17:24:51 +03:00
|
|
|
printf("0x%08" PRIX32 "\t%s\n", layouts[i].code, layouts[i].name);
|
2014-09-12 19:13:01 +04:00
|
|
|
|
2018-09-24 10:07:59 +03:00
|
|
|
freerdp_keyboard_layouts_free(layouts);
|
2014-09-16 23:07:38 +04:00
|
|
|
layouts = freerdp_keyboard_get_layouts(RDP_KEYBOARD_LAYOUT_TYPE_IME);
|
2019-11-06 17:24:51 +03:00
|
|
|
// if (!layouts) /* FIXME*/
|
2014-09-16 23:07:38 +04:00
|
|
|
printf("\nKeyboard Input Method Editors (IMEs)\n");
|
2016-08-04 17:13:37 +03:00
|
|
|
|
2012-11-27 01:49:12 +04:00
|
|
|
for (i = 0; layouts[i].code; i++)
|
2019-11-06 17:24:51 +03:00
|
|
|
printf("0x%08" PRIX32 "\t%s\n", layouts[i].code, layouts[i].name);
|
2014-09-16 23:07:38 +04:00
|
|
|
|
2018-09-24 10:07:59 +03:00
|
|
|
freerdp_keyboard_layouts_free(layouts);
|
2014-09-16 23:07:38 +04:00
|
|
|
printf("\n");
|
2012-11-27 01:49:12 +04:00
|
|
|
}
|
|
|
|
|
2019-10-28 12:10:14 +03:00
|
|
|
arg = CommandLineFindArgumentA(largs, "monitor-list");
|
2013-04-29 01:10:43 +04:00
|
|
|
|
|
|
|
if (arg->Flags & COMMAND_LINE_VALUE_PRESENT)
|
|
|
|
{
|
|
|
|
settings->ListMonitors = TRUE;
|
|
|
|
}
|
|
|
|
|
2022-02-02 01:23:34 +03:00
|
|
|
arg = CommandLineFindArgumentA(largs, "smartcard-list");
|
|
|
|
if (arg->Flags & COMMAND_LINE_VALUE_PRESENT)
|
|
|
|
{
|
2022-02-02 15:15:58 +03:00
|
|
|
freerdp_smartcard_list(settings);
|
2022-02-02 01:23:34 +03:00
|
|
|
}
|
|
|
|
|
2021-09-10 14:03:09 +03:00
|
|
|
arg = CommandLineFindArgumentA(largs, "kbd-scancode-list");
|
|
|
|
|
|
|
|
if (arg->Flags & COMMAND_LINE_VALUE_PRESENT)
|
|
|
|
{
|
|
|
|
freerdp_client_print_scancodes();
|
|
|
|
goto out;
|
|
|
|
}
|
2021-01-22 11:44:55 +03:00
|
|
|
goto out;
|
2012-11-27 01:49:12 +04:00
|
|
|
}
|
2013-09-09 18:07:14 +04:00
|
|
|
else if (status < 0)
|
|
|
|
{
|
2017-05-04 15:46:58 +03:00
|
|
|
freerdp_client_print_command_line_help_ex(argc, argv, custom);
|
2021-01-22 11:44:55 +03:00
|
|
|
goto out;
|
2013-09-09 18:07:14 +04:00
|
|
|
}
|
2012-11-07 03:49:02 +04:00
|
|
|
|
2021-01-22 11:44:55 +03:00
|
|
|
out:
|
|
|
|
if (status <= COMMAND_LINE_STATUS_PRINT && status >= COMMAND_LINE_STATUS_PRINT_LAST)
|
|
|
|
return 0;
|
|
|
|
return status;
|
2013-06-15 23:13:38 +04:00
|
|
|
}
|
2012-11-26 23:31:31 +04:00
|
|
|
|
2017-11-21 21:10:28 +03:00
|
|
|
static BOOL ends_with(const char* str, const char* ext)
|
|
|
|
{
|
|
|
|
const size_t strLen = strlen(str);
|
|
|
|
const size_t extLen = strlen(ext);
|
|
|
|
|
|
|
|
if (strLen < extLen)
|
|
|
|
return FALSE;
|
|
|
|
|
2019-10-25 15:23:01 +03:00
|
|
|
return _strnicmp(&str[strLen - extLen], ext, extLen) == 0;
|
2017-11-21 21:10:28 +03:00
|
|
|
}
|
2018-09-04 16:49:21 +03:00
|
|
|
|
2018-11-15 16:40:03 +03:00
|
|
|
/**
|
|
|
|
* parses a string value with the format <v1>x<v2>
|
2022-04-28 00:10:49 +03:00
|
|
|
*
|
|
|
|
* @param input input string
|
|
|
|
* @param v1 pointer to output v1
|
|
|
|
* @param v2 pointer to output v2
|
2018-11-15 16:40:03 +03:00
|
|
|
* @return if the parsing was successful
|
|
|
|
*/
|
2018-11-20 16:11:10 +03:00
|
|
|
static BOOL parseSizeValue(const char* input, unsigned long* v1, unsigned long* v2)
|
2018-11-15 16:40:03 +03:00
|
|
|
{
|
2018-11-20 16:11:10 +03:00
|
|
|
const char* xcharpos;
|
|
|
|
char* endPtr;
|
2018-11-15 16:40:03 +03:00
|
|
|
unsigned long v;
|
|
|
|
errno = 0;
|
|
|
|
v = strtoul(input, &endPtr, 10);
|
|
|
|
|
|
|
|
if ((v == 0 || v == ULONG_MAX) && (errno != 0))
|
|
|
|
return FALSE;
|
2018-11-20 16:11:10 +03:00
|
|
|
|
2018-11-15 16:40:03 +03:00
|
|
|
if (v1)
|
|
|
|
*v1 = v;
|
|
|
|
|
|
|
|
xcharpos = strchr(input, 'x');
|
2018-11-20 16:11:10 +03:00
|
|
|
|
2018-11-15 16:40:03 +03:00
|
|
|
if (!xcharpos || xcharpos != endPtr)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
errno = 0;
|
|
|
|
v = strtoul(xcharpos + 1, &endPtr, 10);
|
|
|
|
|
|
|
|
if ((v == 0 || v == ULONG_MAX) && (errno != 0))
|
|
|
|
return FALSE;
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
if (*endPtr != '\0')
|
2018-11-15 16:40:03 +03:00
|
|
|
return FALSE;
|
2018-11-20 16:11:10 +03:00
|
|
|
|
2018-11-15 16:40:03 +03:00
|
|
|
if (v2)
|
|
|
|
*v2 = v;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2021-09-06 16:12:12 +03:00
|
|
|
static BOOL prepare_default_settings(rdpSettings* settings, COMMAND_LINE_ARGUMENT_A* args,
|
2021-07-29 14:26:05 +03:00
|
|
|
BOOL rdp_file)
|
|
|
|
{
|
|
|
|
size_t x;
|
|
|
|
const char* arguments[] = { "network", "gfx", "rfx", "bpp" };
|
|
|
|
WINPR_ASSERT(settings);
|
|
|
|
WINPR_ASSERT(args);
|
|
|
|
|
|
|
|
if (rdp_file)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
for (x = 0; x < ARRAYSIZE(arguments); x++)
|
|
|
|
{
|
|
|
|
const char* arg = arguments[x];
|
2021-09-07 09:31:07 +03:00
|
|
|
const COMMAND_LINE_ARGUMENT_A* p = CommandLineFindArgumentA(args, arg);
|
2021-07-29 14:26:05 +03:00
|
|
|
if (p && (p->Flags & COMMAND_LINE_ARGUMENT_PRESENT))
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return freerdp_set_connection_type(settings, CONNECTION_TYPE_AUTODETECT);
|
|
|
|
}
|
|
|
|
|
2022-02-05 01:59:16 +03:00
|
|
|
static BOOL setSmartcardEmulation(const char* value, rdpSettings* settings)
|
|
|
|
{
|
|
|
|
settings->SmartcardEmulation = TRUE;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings, int argc,
|
|
|
|
char** argv, BOOL allowUnknown)
|
2013-06-15 23:13:38 +04:00
|
|
|
{
|
2015-06-18 12:35:22 +03:00
|
|
|
char* user = NULL;
|
|
|
|
char* gwUser = NULL;
|
2013-06-15 23:13:38 +04:00
|
|
|
char* str;
|
|
|
|
int status;
|
2018-02-19 12:00:54 +03:00
|
|
|
BOOL ext = FALSE;
|
|
|
|
BOOL assist = FALSE;
|
|
|
|
DWORD flags = 0;
|
2017-11-10 13:52:23 +03:00
|
|
|
BOOL promptForPassword = FALSE;
|
2018-02-19 12:00:54 +03:00
|
|
|
BOOL compatibility = FALSE;
|
2021-09-07 09:31:07 +03:00
|
|
|
const COMMAND_LINE_ARGUMENT_A* arg;
|
2021-10-06 10:47:30 +03:00
|
|
|
COMMAND_LINE_ARGUMENT_A largs[ARRAYSIZE(global_cmd_args)];
|
|
|
|
memcpy(largs, global_cmd_args, sizeof(global_cmd_args));
|
2018-02-19 12:00:54 +03:00
|
|
|
|
|
|
|
/* Command line detection fails if only a .rdp or .msrcIncident file
|
|
|
|
* is supplied. Check this case first, only then try to detect
|
|
|
|
* legacy command line syntax. */
|
|
|
|
if (argc > 1)
|
|
|
|
{
|
|
|
|
ext = ends_with(argv[1], ".rdp");
|
|
|
|
assist = ends_with(argv[1], ".msrcIncident");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!ext && !assist)
|
2018-12-11 13:42:25 +03:00
|
|
|
compatibility = freerdp_client_detect_command_line(argc, argv, &flags);
|
2018-03-09 16:25:45 +03:00
|
|
|
else
|
2018-12-11 13:42:25 +03:00
|
|
|
compatibility = freerdp_client_detect_command_line(argc - 1, &argv[1], &flags);
|
2013-06-15 23:13:38 +04:00
|
|
|
|
2020-08-04 09:49:46 +03:00
|
|
|
freerdp_settings_set_string(settings, FreeRDP_ProxyHostname, NULL);
|
|
|
|
freerdp_settings_set_string(settings, FreeRDP_ProxyUsername, NULL);
|
|
|
|
freerdp_settings_set_string(settings, FreeRDP_ProxyPassword, NULL);
|
2017-08-18 20:17:17 +03:00
|
|
|
|
2013-06-15 23:13:38 +04:00
|
|
|
if (compatibility)
|
|
|
|
{
|
2021-10-14 09:25:46 +03:00
|
|
|
WLog_WARN(TAG, "Unsupported command line syntax!");
|
2021-10-14 10:01:00 +03:00
|
|
|
WLog_WARN(TAG, "FreeRDP 1.0 style syntax was dropped with version 3!");
|
2021-10-14 09:25:46 +03:00
|
|
|
return -1;
|
2013-06-15 23:13:38 +04:00
|
|
|
}
|
|
|
|
else
|
2012-11-26 23:31:31 +04:00
|
|
|
{
|
2015-03-16 12:15:37 +03:00
|
|
|
if (allowUnknown)
|
|
|
|
flags |= COMMAND_LINE_IGN_UNKNOWN_KEYWORD;
|
2016-08-04 17:13:37 +03:00
|
|
|
|
2018-02-19 12:00:54 +03:00
|
|
|
if (ext)
|
2017-11-21 15:47:28 +03:00
|
|
|
{
|
2018-02-19 12:00:54 +03:00
|
|
|
if (freerdp_client_settings_parse_connection_file(settings, argv[1]))
|
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
|
|
|
}
|
2017-11-21 15:47:28 +03:00
|
|
|
|
2018-02-19 12:00:54 +03:00
|
|
|
if (assist)
|
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
if (freerdp_client_settings_parse_assistance_file(settings, argc, argv) < 0)
|
2018-02-19 12:00:54 +03:00
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
2017-11-21 15:47:28 +03:00
|
|
|
}
|
|
|
|
|
2019-10-28 12:10:14 +03:00
|
|
|
CommandLineClearArgumentsA(largs);
|
2019-11-06 17:24:51 +03:00
|
|
|
status = CommandLineParseArgumentsA(argc, argv, largs, flags, settings,
|
2016-08-04 17:13:37 +03:00
|
|
|
freerdp_client_command_line_pre_filter,
|
|
|
|
freerdp_client_command_line_post_filter);
|
2013-09-18 01:03:35 +04:00
|
|
|
|
2013-09-09 18:07:14 +04:00
|
|
|
if (status < 0)
|
|
|
|
return status;
|
2021-07-29 14:26:05 +03:00
|
|
|
|
|
|
|
prepare_default_settings(settings, largs, ext);
|
2012-11-26 23:31:31 +04:00
|
|
|
}
|
|
|
|
|
2019-10-28 12:10:14 +03:00
|
|
|
CommandLineFindArgumentA(largs, "v");
|
|
|
|
arg = largs;
|
2017-11-14 18:10:52 +03:00
|
|
|
errno = 0;
|
2012-11-06 07:11:13 +04:00
|
|
|
|
2021-09-10 16:46:33 +03:00
|
|
|
/* Disable unicode input unless requested. */
|
|
|
|
if (!freerdp_settings_set_bool(settings, FreeRDP_UnicodeInput, FALSE))
|
|
|
|
return COMMAND_LINE_ERROR_MEMORY;
|
|
|
|
|
2012-11-06 07:11:13 +04:00
|
|
|
do
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
BOOL enable = arg->Value ? TRUE : FALSE;
|
|
|
|
|
2012-11-27 11:49:44 +04:00
|
|
|
if (!(arg->Flags & COMMAND_LINE_ARGUMENT_PRESENT))
|
2012-11-06 07:11:13 +04:00
|
|
|
continue;
|
|
|
|
|
2022-02-02 01:23:34 +03:00
|
|
|
CommandLineSwitchStart(arg)
|
|
|
|
|
|
|
|
CommandLineSwitchCase(arg, "v")
|
2012-11-06 07:11:13 +04:00
|
|
|
{
|
2021-07-28 17:27:59 +03:00
|
|
|
char* p;
|
|
|
|
|
2020-01-23 11:09:35 +03:00
|
|
|
if (!arg->Value)
|
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
2016-08-04 17:13:37 +03:00
|
|
|
free(settings->ServerHostname);
|
2016-03-07 15:12:38 +03:00
|
|
|
settings->ServerHostname = NULL;
|
2014-10-17 14:08:39 +04:00
|
|
|
p = strchr(arg->Value, '[');
|
2016-08-04 17:13:37 +03:00
|
|
|
|
2014-10-17 14:08:39 +04:00
|
|
|
/* ipv4 */
|
|
|
|
if (!p)
|
2012-11-07 03:49:02 +04:00
|
|
|
{
|
2014-10-17 14:08:39 +04:00
|
|
|
p = strchr(arg->Value, ':');
|
2016-08-04 17:13:37 +03:00
|
|
|
|
2014-10-17 14:08:39 +04:00
|
|
|
if (p)
|
|
|
|
{
|
2018-11-22 18:28:30 +03:00
|
|
|
LONGLONG val;
|
2021-07-28 17:27:59 +03:00
|
|
|
size_t length;
|
2017-11-14 18:10:52 +03:00
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
if (!value_to_int(&p[1], &val, 1, UINT16_MAX))
|
2017-11-14 18:10:52 +03:00
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
2017-11-27 12:54:49 +03:00
|
|
|
|
2019-01-29 18:22:46 +03:00
|
|
|
length = (size_t)(p - arg->Value);
|
2018-11-22 18:28:30 +03:00
|
|
|
settings->ServerPort = (UINT16)val;
|
2016-08-04 17:13:37 +03:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
if (!(settings->ServerHostname = (char*)calloc(length + 1UL, sizeof(char))))
|
2015-06-18 14:00:10 +03:00
|
|
|
return COMMAND_LINE_ERROR_MEMORY;
|
|
|
|
|
2014-10-17 14:08:39 +04:00
|
|
|
strncpy(settings->ServerHostname, arg->Value, length);
|
|
|
|
settings->ServerHostname[length] = '\0';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-02-02 11:41:25 +03:00
|
|
|
if (!freerdp_settings_set_string(settings, FreeRDP_ServerHostname, arg->Value))
|
2015-06-18 14:00:10 +03:00
|
|
|
return COMMAND_LINE_ERROR_MEMORY;
|
2014-10-17 14:08:39 +04:00
|
|
|
}
|
2012-11-07 03:49:02 +04:00
|
|
|
}
|
2014-10-17 14:08:39 +04:00
|
|
|
else /* ipv6 */
|
2012-11-07 03:49:02 +04:00
|
|
|
{
|
2021-07-28 17:27:59 +03:00
|
|
|
size_t length;
|
2016-08-04 17:13:37 +03:00
|
|
|
char* p2 = strchr(arg->Value, ']');
|
|
|
|
|
2014-10-17 14:08:39 +04:00
|
|
|
/* not a valid [] ipv6 addr found */
|
|
|
|
if (!p2)
|
|
|
|
continue;
|
|
|
|
|
2019-01-29 18:22:46 +03:00
|
|
|
length = (size_t)(p2 - p);
|
2016-08-04 17:13:37 +03:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
if (!(settings->ServerHostname = (char*)calloc(length, sizeof(char))))
|
2016-02-01 17:09:51 +03:00
|
|
|
return COMMAND_LINE_ERROR_MEMORY;
|
2016-08-04 17:13:37 +03:00
|
|
|
|
|
|
|
strncpy(settings->ServerHostname, p + 1, length - 1);
|
|
|
|
|
2014-10-17 14:08:39 +04:00
|
|
|
if (*(p2 + 1) == ':')
|
|
|
|
{
|
2018-11-22 18:28:30 +03:00
|
|
|
LONGLONG val;
|
2017-11-14 18:10:52 +03:00
|
|
|
|
2022-08-19 14:43:44 +03:00
|
|
|
if (!value_to_int(&p2[2], &val, 0, UINT16_MAX))
|
2017-11-14 18:10:52 +03:00
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
settings->ServerPort = (UINT16)val;
|
2014-10-17 14:08:39 +04:00
|
|
|
}
|
2016-08-04 17:13:37 +03:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
printf("hostname %s port %" PRIu32 "\n", settings->ServerHostname,
|
|
|
|
settings->ServerPort);
|
2012-11-07 03:49:02 +04:00
|
|
|
}
|
|
|
|
}
|
2014-02-12 09:43:02 +04:00
|
|
|
CommandLineSwitchCase(arg, "spn-class")
|
|
|
|
{
|
2022-02-02 11:41:25 +03:00
|
|
|
if (!freerdp_settings_set_string(settings, FreeRDP_AuthenticationServiceClass,
|
|
|
|
arg->Value))
|
2015-06-18 14:00:10 +03:00
|
|
|
return COMMAND_LINE_ERROR_MEMORY;
|
2014-02-12 09:43:02 +04:00
|
|
|
}
|
2022-05-26 18:42:28 +03:00
|
|
|
CommandLineSwitchCase(arg, "sspi-module")
|
|
|
|
{
|
|
|
|
if (!freerdp_settings_set_string(settings, FreeRDP_SspiModule, arg->Value))
|
|
|
|
return COMMAND_LINE_ERROR_MEMORY;
|
|
|
|
}
|
2018-08-08 12:16:24 +03:00
|
|
|
CommandLineSwitchCase(arg, "redirect-prefer")
|
|
|
|
{
|
2018-08-08 13:26:57 +03:00
|
|
|
size_t count = 0;
|
|
|
|
char* cur = arg->Value;
|
2020-01-23 11:09:35 +03:00
|
|
|
if (!arg->Value)
|
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
2018-08-08 13:26:57 +03:00
|
|
|
settings->RedirectionPreferType = 0;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
UINT32 mask;
|
|
|
|
char* next = strchr(cur, ',');
|
|
|
|
|
|
|
|
if (next)
|
|
|
|
{
|
|
|
|
*next = '\0';
|
|
|
|
next++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_strnicmp(cur, "fqdn", 5) == 0)
|
|
|
|
mask = 0x06U;
|
|
|
|
else if (_strnicmp(cur, "ip", 3) == 0)
|
|
|
|
mask = 0x05U;
|
|
|
|
else if (_strnicmp(cur, "netbios", 8) == 0)
|
|
|
|
mask = 0x03U;
|
|
|
|
else
|
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
|
|
|
|
|
|
|
cur = next;
|
|
|
|
mask = (mask & 0x07);
|
|
|
|
settings->RedirectionPreferType |= mask << (count * 3);
|
|
|
|
count++;
|
2019-11-06 17:24:51 +03:00
|
|
|
} while (cur != NULL);
|
2018-08-08 13:26:57 +03:00
|
|
|
|
|
|
|
if (count > 3)
|
2018-08-08 12:16:24 +03:00
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
|
|
|
}
|
2014-02-14 09:43:31 +04:00
|
|
|
CommandLineSwitchCase(arg, "credentials-delegation")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->DisableCredentialsDelegation = !enable;
|
2014-02-14 09:43:31 +04:00
|
|
|
}
|
2013-01-09 02:18:34 +04:00
|
|
|
CommandLineSwitchCase(arg, "vmconnect")
|
|
|
|
{
|
2016-05-11 22:52:36 +03:00
|
|
|
settings->VmConnectMode = TRUE;
|
2013-01-09 02:18:34 +04:00
|
|
|
settings->ServerPort = 2179;
|
|
|
|
settings->NegotiateSecurityLayer = FALSE;
|
|
|
|
|
|
|
|
if (arg->Flags & COMMAND_LINE_VALUE_PRESENT)
|
|
|
|
{
|
|
|
|
settings->SendPreconnectionPdu = TRUE;
|
2016-08-04 17:13:37 +03:00
|
|
|
|
2022-02-02 11:41:25 +03:00
|
|
|
if (!freerdp_settings_set_string(settings, FreeRDP_PreconnectionBlob, arg->Value))
|
2015-06-18 14:00:10 +03:00
|
|
|
return COMMAND_LINE_ERROR_MEMORY;
|
2013-01-09 02:18:34 +04:00
|
|
|
}
|
|
|
|
}
|
2012-11-06 07:11:13 +04:00
|
|
|
CommandLineSwitchCase(arg, "w")
|
|
|
|
{
|
2018-11-22 18:28:30 +03:00
|
|
|
LONGLONG val;
|
2017-11-14 18:10:52 +03:00
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
if (!value_to_int(arg->Value, &val, -1, UINT32_MAX))
|
2017-11-14 18:10:52 +03:00
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
settings->DesktopWidth = (UINT32)val;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "h")
|
|
|
|
{
|
2018-11-22 18:28:30 +03:00
|
|
|
LONGLONG val;
|
2017-11-14 18:10:52 +03:00
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
if (!value_to_int(arg->Value, &val, -1, UINT32_MAX))
|
2017-11-14 18:10:52 +03:00
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
settings->DesktopHeight = (UINT32)val;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
2012-11-07 07:08:09 +04:00
|
|
|
CommandLineSwitchCase(arg, "size")
|
|
|
|
{
|
2021-07-28 17:27:59 +03:00
|
|
|
char* p;
|
2020-01-23 11:09:35 +03:00
|
|
|
if (!arg->Value)
|
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
2018-11-15 16:40:03 +03:00
|
|
|
p = strchr(arg->Value, 'x');
|
2012-11-07 07:08:09 +04:00
|
|
|
|
|
|
|
if (p)
|
|
|
|
{
|
2018-11-15 16:40:03 +03:00
|
|
|
unsigned long w, h;
|
2018-11-20 16:11:10 +03:00
|
|
|
|
2018-11-15 16:40:03 +03:00
|
|
|
if (!parseSizeValue(arg->Value, &w, &h) || (w > UINT16_MAX) || (h > UINT16_MAX))
|
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
2017-11-14 18:10:52 +03:00
|
|
|
|
2019-01-29 18:22:46 +03:00
|
|
|
settings->DesktopWidth = (UINT32)w;
|
|
|
|
settings->DesktopHeight = (UINT32)h;
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
2014-08-06 14:19:50 +04:00
|
|
|
else
|
|
|
|
{
|
2018-11-15 16:40:03 +03:00
|
|
|
if (!(str = _strdup(arg->Value)))
|
|
|
|
return COMMAND_LINE_ERROR_MEMORY;
|
|
|
|
|
2014-08-06 14:19:50 +04:00
|
|
|
p = strchr(str, '%');
|
2016-08-04 17:13:37 +03:00
|
|
|
|
|
|
|
if (p)
|
2014-08-06 14:19:50 +04:00
|
|
|
{
|
2017-09-25 10:35:49 +03:00
|
|
|
BOOL partial = FALSE;
|
|
|
|
|
|
|
|
if (strchr(p, 'w'))
|
|
|
|
{
|
|
|
|
settings->PercentScreenUseWidth = 1;
|
|
|
|
partial = TRUE;
|
|
|
|
}
|
2017-11-27 12:54:49 +03:00
|
|
|
|
2017-09-25 10:35:49 +03:00
|
|
|
if (strchr(p, 'h'))
|
|
|
|
{
|
|
|
|
settings->PercentScreenUseHeight = 1;
|
|
|
|
partial = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!partial)
|
|
|
|
{
|
|
|
|
settings->PercentScreenUseWidth = 1;
|
|
|
|
settings->PercentScreenUseHeight = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
*p = '\0';
|
2017-11-14 18:10:52 +03:00
|
|
|
{
|
2018-11-22 18:28:30 +03:00
|
|
|
LONGLONG val;
|
2017-11-14 18:10:52 +03:00
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
if (!value_to_int(str, &val, 0, 100))
|
2017-11-14 18:10:52 +03:00
|
|
|
{
|
|
|
|
free(str);
|
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
|
|
|
}
|
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
settings->PercentScreen = (UINT32)val;
|
2017-11-14 18:10:52 +03:00
|
|
|
}
|
2014-08-06 14:19:50 +04:00
|
|
|
}
|
2012-11-07 07:08:09 +04:00
|
|
|
|
2018-11-15 16:40:03 +03:00
|
|
|
free(str);
|
|
|
|
}
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
2012-11-06 07:11:13 +04:00
|
|
|
CommandLineSwitchCase(arg, "f")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->Fullscreen = enable;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
2018-11-29 21:42:32 +03:00
|
|
|
CommandLineSwitchCase(arg, "suppress-output")
|
|
|
|
{
|
|
|
|
settings->SuppressOutput = enable;
|
|
|
|
}
|
2012-12-13 23:38:02 +04:00
|
|
|
CommandLineSwitchCase(arg, "multimon")
|
|
|
|
{
|
|
|
|
settings->UseMultimon = TRUE;
|
2013-04-25 23:42:40 +04:00
|
|
|
|
2012-12-13 23:38:02 +04:00
|
|
|
if (arg->Flags & COMMAND_LINE_VALUE_PRESENT)
|
|
|
|
{
|
|
|
|
if (_stricmp(arg->Value, "force") == 0)
|
|
|
|
{
|
|
|
|
settings->ForceMultimon = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-03-25 22:39:21 +04:00
|
|
|
CommandLineSwitchCase(arg, "span")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->SpanMonitors = enable;
|
2014-03-25 22:39:21 +04:00
|
|
|
}
|
2012-11-07 07:08:09 +04:00
|
|
|
CommandLineSwitchCase(arg, "workarea")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->Workarea = enable;
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
2013-04-29 02:48:27 +04:00
|
|
|
CommandLineSwitchCase(arg, "monitors")
|
|
|
|
{
|
|
|
|
if (arg->Flags & COMMAND_LINE_VALUE_PRESENT)
|
|
|
|
{
|
2014-02-11 07:23:59 +04:00
|
|
|
UINT32 i;
|
2021-10-06 10:44:26 +03:00
|
|
|
union
|
|
|
|
{
|
|
|
|
char** p;
|
|
|
|
const char** pc;
|
|
|
|
} ptr;
|
2017-11-30 18:56:45 +03:00
|
|
|
size_t count = 0;
|
2021-04-12 12:06:45 +03:00
|
|
|
UINT32* MonitorIds;
|
2021-10-06 10:44:26 +03:00
|
|
|
ptr.p = CommandLineParseCommaSeparatedValues(arg->Value, &count);
|
2016-08-04 17:13:37 +03:00
|
|
|
|
2021-10-06 10:44:26 +03:00
|
|
|
if (!ptr.pc)
|
2015-06-18 14:00:10 +03:00
|
|
|
return COMMAND_LINE_ERROR_MEMORY;
|
2013-04-29 02:48:27 +04:00
|
|
|
|
2015-02-10 23:15:30 +03:00
|
|
|
if (count > 16)
|
|
|
|
count = 16;
|
|
|
|
|
2021-04-12 12:06:45 +03:00
|
|
|
if (!freerdp_settings_set_pointer_len(settings, FreeRDP_MonitorIds, NULL, count))
|
|
|
|
{
|
2021-10-06 10:44:26 +03:00
|
|
|
free(ptr.p);
|
2021-04-12 12:06:45 +03:00
|
|
|
return FALSE;
|
|
|
|
}
|
2013-04-29 02:48:27 +04:00
|
|
|
|
2021-04-12 12:06:45 +03:00
|
|
|
MonitorIds =
|
|
|
|
freerdp_settings_get_pointer_array_writable(settings, FreeRDP_MonitorIds, 0);
|
|
|
|
for (i = 0; i < count; i++)
|
2013-04-29 02:48:27 +04:00
|
|
|
{
|
2018-11-22 18:28:30 +03:00
|
|
|
LONGLONG val;
|
2017-11-14 18:10:52 +03:00
|
|
|
|
2021-10-06 10:44:26 +03:00
|
|
|
if (!value_to_int(ptr.pc[i], &val, 0, UINT16_MAX))
|
2017-11-14 18:10:52 +03:00
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
|
|
|
|
2021-04-12 12:06:45 +03:00
|
|
|
MonitorIds[i] = (UINT32)val;
|
2013-04-29 02:48:27 +04:00
|
|
|
}
|
2013-08-28 18:05:02 +04:00
|
|
|
|
2021-10-06 10:44:26 +03:00
|
|
|
free(ptr.p);
|
2013-04-29 02:48:27 +04:00
|
|
|
}
|
|
|
|
}
|
2013-04-29 01:10:43 +04:00
|
|
|
CommandLineSwitchCase(arg, "monitor-list")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->ListMonitors = enable;
|
2013-04-29 01:10:43 +04:00
|
|
|
}
|
2012-11-07 07:08:09 +04:00
|
|
|
CommandLineSwitchCase(arg, "t")
|
|
|
|
{
|
2022-02-02 11:41:25 +03:00
|
|
|
if (!freerdp_settings_set_string(settings, FreeRDP_WindowTitle, arg->Value))
|
2015-06-18 14:00:10 +03:00
|
|
|
return COMMAND_LINE_ERROR_MEMORY;
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "decorations")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->Decorations = enable;
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
2017-11-29 12:26:04 +03:00
|
|
|
CommandLineSwitchCase(arg, "dynamic-resolution")
|
|
|
|
{
|
|
|
|
if (settings->SmartSizing)
|
|
|
|
{
|
|
|
|
WLog_ERR(TAG, "Smart sizing and dynamic resolution are mutually exclusive options");
|
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
|
|
|
}
|
2017-12-28 16:05:11 +03:00
|
|
|
|
2017-11-29 12:26:04 +03:00
|
|
|
settings->SupportDisplayControl = TRUE;
|
|
|
|
settings->DynamicResolutionUpdate = TRUE;
|
|
|
|
}
|
2013-04-11 00:58:14 +04:00
|
|
|
CommandLineSwitchCase(arg, "smart-sizing")
|
|
|
|
{
|
2017-11-29 12:26:04 +03:00
|
|
|
if (settings->DynamicResolutionUpdate)
|
|
|
|
{
|
|
|
|
WLog_ERR(TAG, "Smart sizing and dynamic resolution are mutually exclusive options");
|
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
|
|
|
}
|
|
|
|
|
2014-12-01 13:56:44 +03:00
|
|
|
settings->SmartSizing = TRUE;
|
|
|
|
|
|
|
|
if (arg->Value)
|
|
|
|
{
|
2018-11-15 16:40:03 +03:00
|
|
|
unsigned long w, h;
|
2017-11-14 18:10:52 +03:00
|
|
|
|
2018-11-15 16:40:03 +03:00
|
|
|
if (!parseSizeValue(arg->Value, &w, &h) || (w > UINT16_MAX) || (h > UINT16_MAX))
|
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
2016-08-04 17:13:37 +03:00
|
|
|
|
2019-01-29 18:22:46 +03:00
|
|
|
settings->SmartSizingWidth = (UINT32)w;
|
|
|
|
settings->SmartSizingHeight = (UINT32)h;
|
2014-12-01 13:56:44 +03:00
|
|
|
}
|
2013-04-11 00:58:14 +04:00
|
|
|
}
|
2012-11-06 07:11:13 +04:00
|
|
|
CommandLineSwitchCase(arg, "bpp")
|
|
|
|
{
|
2018-11-22 18:28:30 +03:00
|
|
|
LONGLONG val;
|
2017-11-14 18:10:52 +03:00
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
if (!value_to_int(arg->Value, &val, 0, UINT32_MAX))
|
2017-11-14 18:10:52 +03:00
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
|
|
|
|
2021-07-29 19:24:13 +03:00
|
|
|
switch (val)
|
2016-08-04 17:13:37 +03:00
|
|
|
{
|
|
|
|
case 32:
|
|
|
|
case 24:
|
|
|
|
case 16:
|
|
|
|
case 15:
|
|
|
|
case 8:
|
2018-11-22 18:28:30 +03:00
|
|
|
settings->ColorDepth = (UINT32)val;
|
2016-08-04 17:13:37 +03:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
|
|
|
}
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
2012-12-13 16:39:49 +04:00
|
|
|
CommandLineSwitchCase(arg, "admin")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->ConsoleSession = enable;
|
2012-12-13 16:39:49 +04:00
|
|
|
}
|
2018-10-17 13:15:57 +03:00
|
|
|
CommandLineSwitchCase(arg, "relax-order-checks")
|
|
|
|
{
|
2018-10-18 10:09:30 +03:00
|
|
|
settings->AllowUnanouncedOrdersFromServer = enable;
|
2018-10-17 13:15:57 +03:00
|
|
|
}
|
2013-11-06 10:51:55 +04:00
|
|
|
CommandLineSwitchCase(arg, "restricted-admin")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->ConsoleSession = enable;
|
|
|
|
settings->RestrictedAdminModeRequired = enable;
|
2013-11-06 10:51:55 +04:00
|
|
|
}
|
2013-11-06 19:02:58 +04:00
|
|
|
CommandLineSwitchCase(arg, "pth")
|
|
|
|
{
|
|
|
|
settings->ConsoleSession = TRUE;
|
|
|
|
settings->RestrictedAdminModeRequired = TRUE;
|
2016-08-04 17:13:37 +03:00
|
|
|
|
2022-02-02 11:41:25 +03:00
|
|
|
if (!freerdp_settings_set_string(settings, FreeRDP_PasswordHash, arg->Value))
|
2015-06-18 14:00:10 +03:00
|
|
|
return COMMAND_LINE_ERROR_MEMORY;
|
2013-11-06 19:02:58 +04:00
|
|
|
}
|
2013-11-12 04:57:44 +04:00
|
|
|
CommandLineSwitchCase(arg, "client-hostname")
|
|
|
|
{
|
2022-02-02 11:41:25 +03:00
|
|
|
if (!freerdp_settings_set_string(settings, FreeRDP_ClientHostname, arg->Value))
|
2015-06-18 14:00:10 +03:00
|
|
|
return COMMAND_LINE_ERROR_MEMORY;
|
2013-11-12 04:57:44 +04:00
|
|
|
}
|
2012-11-27 01:49:12 +04:00
|
|
|
CommandLineSwitchCase(arg, "kbd")
|
|
|
|
{
|
2018-11-22 18:28:30 +03:00
|
|
|
LONGLONG val;
|
2012-11-27 01:49:12 +04:00
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
if (!value_to_int(arg->Value, &val, 1, UINT32_MAX))
|
2012-11-27 01:49:12 +04:00
|
|
|
{
|
2017-11-14 18:10:52 +03:00
|
|
|
const int rc = freerdp_map_keyboard_layout_name_to_id(arg->Value);
|
2016-08-04 17:13:37 +03:00
|
|
|
|
2017-11-21 10:46:29 +03:00
|
|
|
if (rc <= 0)
|
2012-11-27 01:49:12 +04:00
|
|
|
{
|
2015-06-15 10:47:16 +03:00
|
|
|
WLog_ERR(TAG, "Could not identify keyboard layout: %s", arg->Value);
|
2015-06-17 23:08:02 +03:00
|
|
|
WLog_ERR(TAG, "Use /kbd-list to list available layouts");
|
2017-11-21 10:46:29 +03:00
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
2012-11-27 01:49:12 +04:00
|
|
|
}
|
2016-08-04 17:13:37 +03:00
|
|
|
|
2017-11-21 10:46:29 +03:00
|
|
|
/* Found a valid mapping, reset errno */
|
2018-11-22 18:28:30 +03:00
|
|
|
val = rc;
|
2017-11-21 10:46:29 +03:00
|
|
|
errno = 0;
|
2012-11-27 01:49:12 +04:00
|
|
|
}
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
settings->KeyboardLayout = (UINT32)val;
|
2012-11-27 01:49:12 +04:00
|
|
|
}
|
2020-10-28 14:22:48 +03:00
|
|
|
CommandLineSwitchCase(arg, "kbd-remap")
|
|
|
|
{
|
2022-02-02 11:41:25 +03:00
|
|
|
if (!freerdp_settings_set_string(settings, FreeRDP_KeyboardRemappingList, arg->Value))
|
2020-10-28 14:22:48 +03:00
|
|
|
return COMMAND_LINE_ERROR_MEMORY;
|
|
|
|
}
|
2019-11-07 21:31:26 +03:00
|
|
|
CommandLineSwitchCase(arg, "kbd-lang")
|
|
|
|
{
|
|
|
|
LONGLONG val;
|
|
|
|
|
|
|
|
if (!value_to_int(arg->Value, &val, 1, UINT32_MAX))
|
|
|
|
{
|
|
|
|
WLog_ERR(TAG, "Could not identify keyboard active language %s", arg->Value);
|
2019-11-08 17:42:05 +03:00
|
|
|
WLog_ERR(TAG, "Use /kbd-lang-list to list available layouts");
|
2019-11-07 21:31:26 +03:00
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
settings->KeyboardCodePage = (UINT32)val;
|
|
|
|
}
|
2012-11-27 01:49:12 +04:00
|
|
|
CommandLineSwitchCase(arg, "kbd-type")
|
|
|
|
{
|
2018-11-22 18:28:30 +03:00
|
|
|
LONGLONG val;
|
2017-11-14 18:10:52 +03:00
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
if (!value_to_int(arg->Value, &val, 0, UINT32_MAX))
|
2017-11-14 18:10:52 +03:00
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
settings->KeyboardType = (UINT32)val;
|
2012-11-27 01:49:12 +04:00
|
|
|
}
|
2021-09-10 16:46:33 +03:00
|
|
|
CommandLineSwitchCase(arg, "kbd-unicode")
|
|
|
|
{
|
|
|
|
if (!freerdp_settings_set_bool(settings, FreeRDP_UnicodeInput, enable))
|
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
|
|
|
}
|
2012-11-27 01:49:12 +04:00
|
|
|
CommandLineSwitchCase(arg, "kbd-subtype")
|
|
|
|
{
|
2018-11-22 18:28:30 +03:00
|
|
|
LONGLONG val;
|
2017-11-14 18:10:52 +03:00
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
if (!value_to_int(arg->Value, &val, 0, UINT32_MAX))
|
2017-11-14 18:10:52 +03:00
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
settings->KeyboardSubType = (UINT32)val;
|
2012-11-27 01:49:12 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "kbd-fn-key")
|
|
|
|
{
|
2018-11-22 18:28:30 +03:00
|
|
|
LONGLONG val;
|
2017-11-14 18:10:52 +03:00
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
if (!value_to_int(arg->Value, &val, 0, UINT32_MAX))
|
2017-11-14 18:10:52 +03:00
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
settings->KeyboardFunctionKey = (UINT32)val;
|
2012-11-27 01:49:12 +04:00
|
|
|
}
|
2012-11-06 07:11:13 +04:00
|
|
|
CommandLineSwitchCase(arg, "u")
|
|
|
|
{
|
2015-06-18 12:35:22 +03:00
|
|
|
user = _strdup(arg->Value);
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "d")
|
|
|
|
{
|
2022-02-02 11:41:25 +03:00
|
|
|
if (!freerdp_settings_set_string(settings, FreeRDP_Domain, arg->Value))
|
2015-06-18 14:00:10 +03:00
|
|
|
return COMMAND_LINE_ERROR_MEMORY;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "p")
|
|
|
|
{
|
2022-02-02 11:41:25 +03:00
|
|
|
if (!freerdp_settings_set_string(settings, FreeRDP_Password, arg->Value))
|
2015-06-18 14:00:10 +03:00
|
|
|
return COMMAND_LINE_ERROR_MEMORY;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
2012-11-07 07:08:09 +04:00
|
|
|
CommandLineSwitchCase(arg, "g")
|
|
|
|
{
|
2012-11-27 11:49:44 +04:00
|
|
|
if (arg->Flags & COMMAND_LINE_VALUE_PRESENT)
|
2012-11-07 07:08:09 +04:00
|
|
|
{
|
2021-07-28 17:27:59 +03:00
|
|
|
char* p;
|
2020-01-23 11:09:35 +03:00
|
|
|
if (!arg->Value)
|
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
2012-11-27 11:49:44 +04:00
|
|
|
p = strchr(arg->Value, ':');
|
|
|
|
|
|
|
|
if (p)
|
|
|
|
{
|
2018-11-22 18:28:30 +03:00
|
|
|
size_t s;
|
|
|
|
LONGLONG val;
|
2017-11-14 18:10:52 +03:00
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
if (!value_to_int(&p[1], &val, 0, UINT32_MAX))
|
2017-11-14 18:10:52 +03:00
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
2017-11-27 12:54:49 +03:00
|
|
|
|
2019-01-29 18:22:46 +03:00
|
|
|
s = (size_t)(p - arg->Value);
|
2018-11-22 18:28:30 +03:00
|
|
|
settings->GatewayPort = (UINT32)val;
|
2016-08-04 17:13:37 +03:00
|
|
|
|
2022-04-20 16:04:00 +03:00
|
|
|
if (!freerdp_settings_set_string_len(settings, FreeRDP_GatewayHostname,
|
|
|
|
arg->Value, s))
|
2015-06-18 14:00:10 +03:00
|
|
|
return COMMAND_LINE_ERROR_MEMORY;
|
2012-11-27 11:49:44 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-02-02 11:41:25 +03:00
|
|
|
if (!freerdp_settings_set_string(settings, FreeRDP_GatewayHostname, arg->Value))
|
2015-06-18 14:00:10 +03:00
|
|
|
return COMMAND_LINE_ERROR_MEMORY;
|
2012-11-27 11:49:44 +04:00
|
|
|
}
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-02-02 11:41:25 +03:00
|
|
|
if (!freerdp_settings_set_string(settings, FreeRDP_GatewayHostname,
|
|
|
|
settings->ServerHostname))
|
2015-06-18 14:00:10 +03:00
|
|
|
return COMMAND_LINE_ERROR_MEMORY;
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
|
|
|
|
2014-05-30 20:31:26 +04:00
|
|
|
settings->GatewayEnabled = TRUE;
|
2012-11-09 04:56:37 +04:00
|
|
|
settings->GatewayUseSameCredentials = TRUE;
|
2015-01-28 23:16:31 +03:00
|
|
|
freerdp_set_gateway_usage_method(settings, TSC_PROXY_MODE_DIRECT);
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
2016-12-11 01:13:35 +03:00
|
|
|
CommandLineSwitchCase(arg, "proxy")
|
2014-03-21 21:58:28 +04:00
|
|
|
{
|
2018-04-29 22:25:28 +03:00
|
|
|
/* initial value */
|
2020-08-04 09:49:46 +03:00
|
|
|
if (!freerdp_settings_set_uint32(settings, FreeRDP_ProxyType, PROXY_TYPE_HTTP))
|
|
|
|
return COMMAND_LINE_ERROR_MEMORY;
|
2017-08-18 20:17:17 +03:00
|
|
|
|
2014-03-21 21:58:28 +04:00
|
|
|
if (arg->Flags & COMMAND_LINE_VALUE_PRESENT)
|
|
|
|
{
|
2021-09-07 09:31:07 +03:00
|
|
|
const char* cur = arg->Value;
|
|
|
|
|
|
|
|
if (!cur)
|
2020-01-23 11:09:35 +03:00
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
2018-04-29 22:25:28 +03:00
|
|
|
/* value is [scheme://][user:password@]hostname:port */
|
2022-04-02 13:03:24 +03:00
|
|
|
if (!proxy_parse_uri(settings, cur))
|
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
2014-03-21 21:58:28 +04:00
|
|
|
}
|
2016-12-11 01:13:35 +03:00
|
|
|
else
|
|
|
|
{
|
|
|
|
WLog_ERR(TAG, "Option http-proxy needs argument.");
|
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
|
|
|
}
|
2014-03-21 21:58:28 +04:00
|
|
|
}
|
2012-11-07 07:08:09 +04:00
|
|
|
CommandLineSwitchCase(arg, "gu")
|
|
|
|
{
|
2015-06-18 14:00:10 +03:00
|
|
|
if (!(gwUser = _strdup(arg->Value)))
|
|
|
|
return COMMAND_LINE_ERROR_MEMORY;
|
|
|
|
|
2012-11-08 00:13:14 +04:00
|
|
|
settings->GatewayUseSameCredentials = FALSE;
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "gd")
|
|
|
|
{
|
2022-02-02 11:41:25 +03:00
|
|
|
if (!freerdp_settings_set_string(settings, FreeRDP_GatewayDomain, arg->Value))
|
2015-06-18 14:00:10 +03:00
|
|
|
return COMMAND_LINE_ERROR_MEMORY;
|
2016-08-04 17:13:37 +03:00
|
|
|
|
2012-11-08 00:13:14 +04:00
|
|
|
settings->GatewayUseSameCredentials = FALSE;
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "gp")
|
|
|
|
{
|
2022-02-02 11:41:25 +03:00
|
|
|
if (!freerdp_settings_set_string(settings, FreeRDP_GatewayPassword, arg->Value))
|
2015-06-18 14:00:10 +03:00
|
|
|
return COMMAND_LINE_ERROR_MEMORY;
|
2016-08-04 17:13:37 +03:00
|
|
|
|
2012-11-08 00:13:14 +04:00
|
|
|
settings->GatewayUseSameCredentials = FALSE;
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
2015-03-19 18:44:47 +03:00
|
|
|
CommandLineSwitchCase(arg, "gt")
|
|
|
|
{
|
2022-04-28 09:00:39 +03:00
|
|
|
if ((arg->Flags & COMMAND_LINE_VALUE_PRESENT) == 0)
|
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
|
|
|
|
|
|
|
WINPR_ASSERT(arg->Value);
|
2015-03-19 18:44:47 +03:00
|
|
|
if (_stricmp(arg->Value, "rpc") == 0)
|
|
|
|
{
|
2022-04-19 15:47:57 +03:00
|
|
|
if (!freerdp_settings_set_bool(settings, FreeRDP_GatewayRpcTransport, TRUE) ||
|
|
|
|
!freerdp_settings_set_bool(settings, FreeRDP_GatewayHttpTransport, FALSE) ||
|
|
|
|
!freerdp_settings_set_bool(settings, FreeRDP_GatewayHttpUseWebsockets, FALSE))
|
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
2015-03-19 18:44:47 +03:00
|
|
|
}
|
2021-03-05 14:59:33 +03:00
|
|
|
else
|
2015-03-19 18:44:47 +03:00
|
|
|
{
|
2021-03-05 14:59:33 +03:00
|
|
|
char* c = strchr(arg->Value, ',');
|
|
|
|
if (c)
|
|
|
|
{
|
|
|
|
*c++ = '\0';
|
|
|
|
if (_stricmp(c, "no-websockets") != 0)
|
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
2022-04-19 15:47:57 +03:00
|
|
|
|
|
|
|
if (!freerdp_settings_set_bool(settings, FreeRDP_GatewayHttpUseWebsockets,
|
|
|
|
FALSE))
|
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
2021-03-05 14:59:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (_stricmp(arg->Value, "http") == 0)
|
|
|
|
{
|
2022-04-19 15:47:57 +03:00
|
|
|
if (!freerdp_settings_set_bool(settings, FreeRDP_GatewayRpcTransport, FALSE) ||
|
|
|
|
!freerdp_settings_set_bool(settings, FreeRDP_GatewayHttpTransport, TRUE))
|
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
2021-03-05 14:59:33 +03:00
|
|
|
}
|
|
|
|
else if (_stricmp(arg->Value, "auto") == 0)
|
|
|
|
{
|
2022-04-19 15:47:57 +03:00
|
|
|
if (!freerdp_settings_set_bool(settings, FreeRDP_GatewayRpcTransport, TRUE) ||
|
|
|
|
!freerdp_settings_set_bool(settings, FreeRDP_GatewayHttpTransport, TRUE))
|
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
2021-03-05 14:59:33 +03:00
|
|
|
}
|
2015-03-19 18:44:47 +03:00
|
|
|
}
|
|
|
|
}
|
2018-02-13 16:59:33 +03:00
|
|
|
CommandLineSwitchCase(arg, "gat")
|
|
|
|
{
|
2022-02-02 11:41:25 +03:00
|
|
|
if (!freerdp_settings_set_string(settings, FreeRDP_GatewayAccessToken, arg->Value))
|
2018-02-13 16:59:33 +03:00
|
|
|
return COMMAND_LINE_ERROR_MEMORY;
|
|
|
|
}
|
2014-05-30 20:31:26 +04:00
|
|
|
CommandLineSwitchCase(arg, "gateway-usage-method")
|
|
|
|
{
|
2018-11-22 18:28:30 +03:00
|
|
|
UINT32 type = 0;
|
2017-11-27 12:54:49 +03:00
|
|
|
|
2018-05-02 13:57:34 +03:00
|
|
|
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;
|
|
|
|
else
|
2014-05-30 20:31:26 +04:00
|
|
|
{
|
2018-11-22 18:28:30 +03:00
|
|
|
LONGLONG val;
|
2018-06-06 17:43:09 +03:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
if (!value_to_int(arg->Value, &val, TSC_PROXY_MODE_NONE_DIRECT,
|
|
|
|
TSC_PROXY_MODE_NONE_DETECT))
|
2018-05-02 13:57:34 +03:00
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
2014-05-30 20:31:26 +04:00
|
|
|
}
|
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
freerdp_set_gateway_usage_method(settings, type);
|
2014-05-30 20:31:26 +04:00
|
|
|
}
|
2012-11-19 22:26:56 +04:00
|
|
|
CommandLineSwitchCase(arg, "app")
|
|
|
|
{
|
2022-02-02 11:41:25 +03:00
|
|
|
if (!freerdp_settings_set_string(settings, FreeRDP_RemoteApplicationProgram,
|
|
|
|
arg->Value))
|
2015-06-18 14:00:10 +03:00
|
|
|
return COMMAND_LINE_ERROR_MEMORY;
|
2012-11-19 22:26:56 +04:00
|
|
|
|
|
|
|
settings->RemoteApplicationMode = TRUE;
|
|
|
|
settings->RemoteAppLanguageBarSupported = TRUE;
|
|
|
|
settings->Workarea = TRUE;
|
|
|
|
settings->DisableWallpaper = TRUE;
|
|
|
|
settings->DisableFullWindowDrag = TRUE;
|
|
|
|
}
|
2019-05-22 17:36:40 +03:00
|
|
|
CommandLineSwitchCase(arg, "app-workdir")
|
|
|
|
{
|
2022-02-02 11:41:25 +03:00
|
|
|
if (!freerdp_settings_set_string(settings, FreeRDP_RemoteApplicationWorkingDir,
|
|
|
|
arg->Value))
|
2019-05-22 17:36:40 +03:00
|
|
|
return COMMAND_LINE_ERROR_MEMORY;
|
|
|
|
}
|
2013-04-11 19:51:10 +04:00
|
|
|
CommandLineSwitchCase(arg, "load-balance-info")
|
|
|
|
{
|
2018-10-18 10:09:30 +03:00
|
|
|
if (!copy_value(arg->Value, (char**)&settings->LoadBalanceInfo))
|
2015-06-18 14:00:10 +03:00
|
|
|
return COMMAND_LINE_ERROR_MEMORY;
|
2016-08-04 17:13:37 +03:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
settings->LoadBalanceInfoLength = (UINT32)strlen((char*)settings->LoadBalanceInfo);
|
2013-04-11 19:51:10 +04:00
|
|
|
}
|
2012-11-19 22:26:56 +04:00
|
|
|
CommandLineSwitchCase(arg, "app-name")
|
|
|
|
{
|
2022-02-02 11:41:25 +03:00
|
|
|
if (!freerdp_settings_set_string(settings, FreeRDP_RemoteApplicationName, arg->Value))
|
2015-06-18 14:00:10 +03:00
|
|
|
return COMMAND_LINE_ERROR_MEMORY;
|
2012-11-19 22:26:56 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "app-icon")
|
|
|
|
{
|
2022-02-02 11:41:25 +03:00
|
|
|
if (!freerdp_settings_set_string(settings, FreeRDP_RemoteApplicationIcon, arg->Value))
|
2015-06-18 14:00:10 +03:00
|
|
|
return COMMAND_LINE_ERROR_MEMORY;
|
2012-11-19 22:26:56 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "app-cmd")
|
|
|
|
{
|
2022-02-02 11:41:25 +03:00
|
|
|
if (!freerdp_settings_set_string(settings, FreeRDP_RemoteApplicationCmdLine,
|
|
|
|
arg->Value))
|
2015-06-18 14:00:10 +03:00
|
|
|
return COMMAND_LINE_ERROR_MEMORY;
|
2012-11-19 22:26:56 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "app-file")
|
|
|
|
{
|
2022-02-02 11:41:25 +03:00
|
|
|
if (!freerdp_settings_set_string(settings, FreeRDP_RemoteApplicationFile, arg->Value))
|
2015-06-18 14:00:10 +03:00
|
|
|
return COMMAND_LINE_ERROR_MEMORY;
|
2012-11-19 22:26:56 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "app-guid")
|
|
|
|
{
|
2022-02-02 11:41:25 +03:00
|
|
|
if (!freerdp_settings_set_string(settings, FreeRDP_RemoteApplicationGuid, arg->Value))
|
2015-06-18 14:00:10 +03:00
|
|
|
return COMMAND_LINE_ERROR_MEMORY;
|
2012-11-19 22:26:56 +04:00
|
|
|
}
|
2012-11-26 23:31:31 +04:00
|
|
|
CommandLineSwitchCase(arg, "compression")
|
2012-11-06 07:11:13 +04:00
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->CompressionEnabled = enable;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
2014-03-10 19:16:36 +04:00
|
|
|
CommandLineSwitchCase(arg, "compression-level")
|
|
|
|
{
|
2018-11-22 18:28:30 +03:00
|
|
|
LONGLONG val;
|
2017-11-14 18:10:52 +03:00
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
if (!value_to_int(arg->Value, &val, 0, UINT32_MAX))
|
2017-11-14 18:10:52 +03:00
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
settings->CompressionLevel = (UINT32)val;
|
2014-03-10 19:16:36 +04:00
|
|
|
}
|
2013-02-15 04:38:45 +04:00
|
|
|
CommandLineSwitchCase(arg, "drives")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->RedirectDrives = enable;
|
2013-02-15 04:38:45 +04:00
|
|
|
}
|
2021-09-21 10:56:56 +03:00
|
|
|
CommandLineSwitchCase(arg, "disable-output")
|
|
|
|
{
|
|
|
|
freerdp_settings_set_bool(settings, FreeRDP_DeactivateClientDecoding, enable);
|
|
|
|
}
|
2013-02-15 04:38:45 +04:00
|
|
|
CommandLineSwitchCase(arg, "home-drive")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->RedirectHomeDrive = enable;
|
2013-02-15 04:38:45 +04:00
|
|
|
}
|
2017-11-27 12:54:49 +03:00
|
|
|
CommandLineSwitchCase(arg, "ipv6")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->PreferIPv6OverIPv4 = enable;
|
2017-11-27 12:54:49 +03:00
|
|
|
}
|
2012-11-21 04:34:52 +04:00
|
|
|
CommandLineSwitchCase(arg, "clipboard")
|
|
|
|
{
|
2020-03-18 23:59:12 +03:00
|
|
|
if (arg->Value == BoolValueTrue || arg->Value == BoolValueFalse)
|
|
|
|
{
|
|
|
|
settings->RedirectClipboard = (arg->Value == BoolValueTrue);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int rc = 0;
|
2021-10-06 10:44:26 +03:00
|
|
|
union
|
|
|
|
{
|
|
|
|
char** p;
|
|
|
|
const char** pc;
|
|
|
|
} ptr;
|
2020-03-18 23:59:12 +03:00
|
|
|
size_t count, x;
|
2021-10-06 10:44:26 +03:00
|
|
|
ptr.p = CommandLineParseCommaSeparatedValues(arg->Value, &count);
|
2020-03-18 23:59:12 +03:00
|
|
|
for (x = 0; (x < count) && (rc == 0); x++)
|
|
|
|
{
|
|
|
|
const char usesel[14] = "use-selection:";
|
|
|
|
|
2021-10-06 10:44:26 +03:00
|
|
|
const char* cur = ptr.pc[x];
|
2020-03-18 23:59:12 +03:00
|
|
|
if (_strnicmp(usesel, cur, sizeof(usesel)) == 0)
|
|
|
|
{
|
|
|
|
const char* val = &cur[sizeof(usesel)];
|
|
|
|
if (!copy_value(val, &settings->XSelectionAtom))
|
|
|
|
rc = COMMAND_LINE_ERROR_MEMORY;
|
|
|
|
settings->RedirectClipboard = TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
rc = COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
|
|
|
}
|
2021-10-06 10:44:26 +03:00
|
|
|
free(ptr.p);
|
2020-03-18 23:59:12 +03:00
|
|
|
|
|
|
|
if (rc)
|
|
|
|
return rc;
|
|
|
|
}
|
2012-11-21 04:34:52 +04:00
|
|
|
}
|
2012-11-07 07:08:09 +04:00
|
|
|
CommandLineSwitchCase(arg, "shell")
|
|
|
|
{
|
2022-02-02 11:41:25 +03:00
|
|
|
if (!freerdp_settings_set_string(settings, FreeRDP_AlternateShell, arg->Value))
|
2015-06-18 14:00:10 +03:00
|
|
|
return COMMAND_LINE_ERROR_MEMORY;
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "shell-dir")
|
|
|
|
{
|
2022-02-02 11:41:25 +03:00
|
|
|
if (!freerdp_settings_set_string(settings, FreeRDP_ShellWorkingDirectory, arg->Value))
|
2015-06-18 14:00:10 +03:00
|
|
|
return COMMAND_LINE_ERROR_MEMORY;
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
2012-11-26 23:31:31 +04:00
|
|
|
CommandLineSwitchCase(arg, "audio-mode")
|
|
|
|
{
|
2018-11-22 18:28:30 +03:00
|
|
|
LONGLONG val;
|
2017-11-14 18:10:52 +03:00
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
if (!value_to_int(arg->Value, &val, 0, UINT32_MAX))
|
2017-11-14 18:10:52 +03:00
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
2012-11-26 23:31:31 +04:00
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
switch (val)
|
2012-11-26 23:31:31 +04:00
|
|
|
{
|
2018-11-22 18:28:30 +03:00
|
|
|
case AUDIO_MODE_REDIRECT:
|
|
|
|
settings->AudioPlayback = TRUE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AUDIO_MODE_PLAY_ON_SERVER:
|
|
|
|
settings->RemoteConsoleAudio = TRUE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AUDIO_MODE_NONE:
|
|
|
|
settings->AudioPlayback = FALSE;
|
|
|
|
settings->RemoteConsoleAudio = FALSE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
2012-11-26 23:31:31 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "network")
|
|
|
|
{
|
2019-01-29 18:22:46 +03:00
|
|
|
UINT32 type = 0;
|
2012-11-26 23:31:31 +04:00
|
|
|
|
2018-05-02 13:57:34 +03:00
|
|
|
if (_stricmp(arg->Value, "modem") == 0)
|
|
|
|
type = CONNECTION_TYPE_MODEM;
|
|
|
|
else if (_stricmp(arg->Value, "broadband") == 0)
|
|
|
|
type = CONNECTION_TYPE_BROADBAND_HIGH;
|
|
|
|
else if (_stricmp(arg->Value, "broadband-low") == 0)
|
|
|
|
type = CONNECTION_TYPE_BROADBAND_LOW;
|
|
|
|
else if (_stricmp(arg->Value, "broadband-high") == 0)
|
|
|
|
type = CONNECTION_TYPE_BROADBAND_HIGH;
|
|
|
|
else if (_stricmp(arg->Value, "wan") == 0)
|
|
|
|
type = CONNECTION_TYPE_WAN;
|
|
|
|
else if (_stricmp(arg->Value, "lan") == 0)
|
|
|
|
type = CONNECTION_TYPE_LAN;
|
|
|
|
else if ((_stricmp(arg->Value, "autodetect") == 0) ||
|
2019-11-06 17:24:51 +03:00
|
|
|
(_stricmp(arg->Value, "auto") == 0) || (_stricmp(arg->Value, "detect") == 0))
|
2012-11-26 23:31:31 +04:00
|
|
|
{
|
2018-05-02 13:57:34 +03:00
|
|
|
type = CONNECTION_TYPE_AUTODETECT;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-11-22 18:28:30 +03:00
|
|
|
LONGLONG val;
|
2018-05-02 13:57:34 +03:00
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
if (!value_to_int(arg->Value, &val, 1, 7))
|
2018-05-02 13:57:34 +03:00
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
2018-11-22 18:28:30 +03:00
|
|
|
|
2019-01-29 18:22:46 +03:00
|
|
|
type = (UINT32)val;
|
2012-11-26 23:31:31 +04:00
|
|
|
}
|
|
|
|
|
2016-02-01 17:09:51 +03:00
|
|
|
if (!freerdp_set_connection_type(settings, type))
|
|
|
|
return COMMAND_LINE_ERROR;
|
2012-11-26 23:31:31 +04:00
|
|
|
}
|
2012-11-06 07:11:13 +04:00
|
|
|
CommandLineSwitchCase(arg, "fonts")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->AllowFontSmoothing = enable;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "wallpaper")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->DisableWallpaper = !enable;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "window-drag")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->DisableFullWindowDrag = !enable;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
2018-11-15 16:40:03 +03:00
|
|
|
CommandLineSwitchCase(arg, "window-position")
|
|
|
|
{
|
|
|
|
unsigned long x, y;
|
|
|
|
|
|
|
|
if (!arg->Value)
|
|
|
|
return COMMAND_LINE_ERROR_MISSING_ARGUMENT;
|
|
|
|
|
|
|
|
if (!parseSizeValue(arg->Value, &x, &y) || x > UINT16_MAX || y > UINT16_MAX)
|
|
|
|
{
|
|
|
|
WLog_ERR(TAG, "invalid window-position argument");
|
|
|
|
return COMMAND_LINE_ERROR_MISSING_ARGUMENT;
|
|
|
|
}
|
|
|
|
|
2019-01-29 18:22:46 +03:00
|
|
|
settings->DesktopPosX = (UINT32)x;
|
|
|
|
settings->DesktopPosY = (UINT32)y;
|
2018-11-15 16:40:03 +03:00
|
|
|
}
|
2012-11-06 07:11:13 +04:00
|
|
|
CommandLineSwitchCase(arg, "menu-anims")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->DisableMenuAnims = !enable;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "themes")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->DisableThemes = !enable;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
2020-03-23 10:51:35 +03:00
|
|
|
CommandLineSwitchCase(arg, "timeout")
|
|
|
|
{
|
|
|
|
ULONGLONG val;
|
|
|
|
if (!value_to_uint(arg->Value, &val, 1, 600000))
|
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
2022-03-24 13:07:11 +03:00
|
|
|
if (!freerdp_settings_set_uint32(settings, FreeRDP_TcpAckTimeout, (UINT32)val))
|
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
2020-03-23 10:51:35 +03:00
|
|
|
}
|
2012-11-06 07:11:13 +04:00
|
|
|
CommandLineSwitchCase(arg, "aero")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->AllowDesktopComposition = enable;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
2012-11-07 07:08:09 +04:00
|
|
|
CommandLineSwitchCase(arg, "gdi")
|
|
|
|
{
|
2013-12-10 21:30:25 +04:00
|
|
|
if (_stricmp(arg->Value, "sw") == 0)
|
2012-11-08 03:23:25 +04:00
|
|
|
settings->SoftwareGdi = TRUE;
|
2013-12-10 21:30:25 +04:00
|
|
|
else if (_stricmp(arg->Value, "hw") == 0)
|
2012-11-08 03:23:25 +04:00
|
|
|
settings->SoftwareGdi = FALSE;
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
2013-10-22 07:33:25 +04:00
|
|
|
CommandLineSwitchCase(arg, "gfx")
|
|
|
|
{
|
|
|
|
settings->SupportGraphicsPipeline = TRUE;
|
2016-08-04 17:13:37 +03:00
|
|
|
|
2016-03-24 18:25:22 +03:00
|
|
|
if (arg->Value)
|
|
|
|
{
|
2019-12-16 09:53:35 +03:00
|
|
|
int rc = CHANNEL_RC_OK;
|
2021-10-06 10:44:26 +03:00
|
|
|
union
|
|
|
|
{
|
|
|
|
char** p;
|
|
|
|
const char** pc;
|
|
|
|
} ptr;
|
2019-12-16 09:53:35 +03:00
|
|
|
size_t count, x;
|
2017-11-27 12:54:49 +03:00
|
|
|
|
2021-10-06 10:44:26 +03:00
|
|
|
ptr.p = CommandLineParseCommaSeparatedValues(arg->Value, &count);
|
|
|
|
if (!ptr.pc || (count == 0))
|
2019-12-16 09:53:35 +03:00
|
|
|
rc = COMMAND_LINE_ERROR;
|
2020-01-23 10:55:47 +03:00
|
|
|
else
|
2016-03-24 18:25:22 +03:00
|
|
|
{
|
2020-01-23 10:55:47 +03:00
|
|
|
for (x = 0; x < count; x++)
|
|
|
|
{
|
2021-10-06 10:44:26 +03:00
|
|
|
const char* val = ptr.pc[x];
|
2019-12-16 09:53:35 +03:00
|
|
|
#ifdef WITH_GFX_H264
|
2020-02-27 14:12:20 +03:00
|
|
|
if (_strnicmp("AVC444", val, 7) == 0)
|
|
|
|
{
|
|
|
|
settings->GfxH264 = TRUE;
|
|
|
|
settings->GfxAVC444 = TRUE;
|
|
|
|
}
|
|
|
|
else if (_strnicmp("AVC420", val, 7) == 0)
|
|
|
|
{
|
|
|
|
settings->GfxH264 = TRUE;
|
|
|
|
settings->GfxAVC444 = FALSE;
|
|
|
|
}
|
|
|
|
else
|
2017-07-17 10:00:57 +03:00
|
|
|
#endif
|
2020-02-27 14:12:20 +03:00
|
|
|
if (_strnicmp("RFX", val, 4) == 0)
|
|
|
|
{
|
|
|
|
settings->GfxAVC444 = FALSE;
|
|
|
|
settings->GfxH264 = FALSE;
|
|
|
|
settings->RemoteFxCodec = TRUE;
|
|
|
|
}
|
|
|
|
else if (_strnicmp("mask:", val, 5) == 0)
|
|
|
|
{
|
|
|
|
ULONGLONG v;
|
|
|
|
const char* uv = &val[5];
|
|
|
|
if (!value_to_uint(uv, &v, 0, UINT32_MAX))
|
|
|
|
rc = COMMAND_LINE_ERROR;
|
|
|
|
else
|
|
|
|
settings->GfxCapsFilter = (UINT32)v;
|
|
|
|
}
|
2019-12-16 09:53:35 +03:00
|
|
|
else
|
2020-02-27 14:12:20 +03:00
|
|
|
rc = COMMAND_LINE_ERROR;
|
2020-01-23 10:55:47 +03:00
|
|
|
}
|
2019-08-22 16:56:10 +03:00
|
|
|
}
|
2021-10-06 10:44:26 +03:00
|
|
|
free(ptr.p);
|
2019-12-16 09:53:35 +03:00
|
|
|
if (rc != CHANNEL_RC_OK)
|
|
|
|
return rc;
|
2016-03-24 18:25:22 +03:00
|
|
|
}
|
2014-07-03 22:35:03 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "gfx-thin-client")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->GfxThinClient = enable;
|
2017-11-27 12:54:49 +03:00
|
|
|
|
2017-10-10 18:12:16 +03:00
|
|
|
if (settings->GfxThinClient)
|
|
|
|
settings->GfxSmallCache = TRUE;
|
2017-11-27 12:54:49 +03:00
|
|
|
|
2014-07-03 22:35:03 +04:00
|
|
|
settings->SupportGraphicsPipeline = TRUE;
|
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "gfx-small-cache")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->GfxSmallCache = enable;
|
|
|
|
|
|
|
|
if (enable)
|
|
|
|
settings->SupportGraphicsPipeline = TRUE;
|
2014-07-03 22:35:03 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "gfx-progressive")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->GfxProgressive = enable;
|
|
|
|
settings->GfxThinClient = !enable;
|
|
|
|
|
|
|
|
if (enable)
|
|
|
|
settings->SupportGraphicsPipeline = TRUE;
|
2014-07-03 22:35:03 +04:00
|
|
|
}
|
2017-07-17 10:00:57 +03:00
|
|
|
#ifdef WITH_GFX_H264
|
2014-07-03 22:35:03 +04:00
|
|
|
CommandLineSwitchCase(arg, "gfx-h264")
|
|
|
|
{
|
|
|
|
settings->SupportGraphicsPipeline = TRUE;
|
2016-03-24 18:25:22 +03:00
|
|
|
settings->GfxH264 = TRUE;
|
2016-08-04 17:13:37 +03:00
|
|
|
|
2016-03-24 18:25:22 +03:00
|
|
|
if (arg->Value)
|
|
|
|
{
|
2019-12-16 09:53:35 +03:00
|
|
|
int rc = CHANNEL_RC_OK;
|
2021-10-06 10:44:26 +03:00
|
|
|
union
|
|
|
|
{
|
|
|
|
char** p;
|
|
|
|
const char** pc;
|
|
|
|
} ptr;
|
2019-12-16 09:53:35 +03:00
|
|
|
size_t count, x;
|
|
|
|
|
2021-10-06 10:44:26 +03:00
|
|
|
ptr.p = CommandLineParseCommaSeparatedValues(arg->Value, &count);
|
|
|
|
if (!ptr.pc || (count == 0))
|
2019-12-16 09:53:35 +03:00
|
|
|
rc = COMMAND_LINE_ERROR;
|
2020-01-23 10:55:47 +03:00
|
|
|
else
|
2016-03-24 18:25:22 +03:00
|
|
|
{
|
2020-01-23 10:55:47 +03:00
|
|
|
for (x = 0; x < count; x++)
|
2019-12-16 09:53:35 +03:00
|
|
|
{
|
2021-10-06 10:44:26 +03:00
|
|
|
const char* val = ptr.pc[x];
|
2020-01-23 10:55:47 +03:00
|
|
|
|
|
|
|
if (_strnicmp("AVC444", val, 7) == 0)
|
|
|
|
{
|
2020-03-15 12:33:34 +03:00
|
|
|
settings->GfxH264 = TRUE;
|
2020-01-23 10:55:47 +03:00
|
|
|
settings->GfxAVC444 = TRUE;
|
|
|
|
}
|
2020-03-15 12:33:34 +03:00
|
|
|
else if (_strnicmp("AVC420", val, 7) == 0)
|
|
|
|
{
|
|
|
|
settings->GfxH264 = TRUE;
|
|
|
|
settings->GfxAVC444 = FALSE;
|
|
|
|
}
|
2020-01-23 10:55:47 +03:00
|
|
|
else if (_strnicmp("mask:", val, 5) == 0)
|
|
|
|
{
|
|
|
|
ULONGLONG v;
|
|
|
|
const char* uv = &val[5];
|
|
|
|
if (!value_to_uint(uv, &v, 0, UINT32_MAX))
|
|
|
|
rc = COMMAND_LINE_ERROR;
|
|
|
|
else
|
|
|
|
settings->GfxCapsFilter = (UINT32)v;
|
|
|
|
}
|
2020-03-15 12:33:34 +03:00
|
|
|
else
|
|
|
|
rc = COMMAND_LINE_ERROR;
|
2019-12-16 09:53:35 +03:00
|
|
|
}
|
2016-03-24 18:25:22 +03:00
|
|
|
}
|
2021-10-06 10:44:26 +03:00
|
|
|
free(ptr.p);
|
2019-12-16 09:53:35 +03:00
|
|
|
if (rc != CHANNEL_RC_OK)
|
|
|
|
return rc;
|
2016-03-24 18:25:22 +03:00
|
|
|
}
|
2013-10-22 07:33:25 +04:00
|
|
|
}
|
2017-07-17 10:00:57 +03:00
|
|
|
#endif
|
2012-11-07 07:08:09 +04:00
|
|
|
CommandLineSwitchCase(arg, "rfx")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->RemoteFxCodec = enable;
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "rfx-mode")
|
|
|
|
{
|
2020-01-23 11:09:35 +03:00
|
|
|
if (!arg->Value)
|
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
2019-01-29 19:24:29 +03:00
|
|
|
|
2012-11-07 07:08:09 +04:00
|
|
|
if (strcmp(arg->Value, "video") == 0)
|
2012-11-08 00:13:14 +04:00
|
|
|
settings->RemoteFxCodecMode = 0x00;
|
2012-11-07 07:08:09 +04:00
|
|
|
else if (strcmp(arg->Value, "image") == 0)
|
2012-11-08 00:13:14 +04:00
|
|
|
settings->RemoteFxCodecMode = 0x02;
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "frame-ack")
|
|
|
|
{
|
2018-11-22 18:28:30 +03:00
|
|
|
LONGLONG val;
|
2017-11-14 18:10:52 +03:00
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
if (!value_to_int(arg->Value, &val, 0, UINT32_MAX))
|
2017-11-14 18:10:52 +03:00
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
settings->FrameAcknowledge = (UINT32)val;
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "nsc")
|
|
|
|
{
|
2021-07-01 12:40:41 +03:00
|
|
|
freerdp_settings_set_bool(settings, FreeRDP_NSCodec, enable);
|
2012-11-07 07:08:09 +04:00
|
|
|
}
|
2017-07-24 16:23:36 +03:00
|
|
|
#if defined(WITH_JPEG)
|
2012-11-27 01:49:12 +04:00
|
|
|
CommandLineSwitchCase(arg, "jpeg")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->JpegCodec = enable;
|
2012-11-27 01:49:12 +04:00
|
|
|
settings->JpegQuality = 75;
|
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "jpeg-quality")
|
|
|
|
{
|
2018-11-22 18:28:30 +03:00
|
|
|
LONGLONG val;
|
2017-11-14 18:10:52 +03:00
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
if (!value_to_int(arg->Value, &val, 0, 100))
|
2017-11-14 18:10:52 +03:00
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
settings->JpegQuality = (UINT32)val;
|
2012-11-27 01:49:12 +04:00
|
|
|
}
|
2017-07-24 16:23:36 +03:00
|
|
|
#endif
|
2012-11-06 07:11:13 +04:00
|
|
|
CommandLineSwitchCase(arg, "nego")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->NegotiateSecurityLayer = enable;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
2013-01-09 02:18:34 +04:00
|
|
|
CommandLineSwitchCase(arg, "pcb")
|
2012-11-06 07:11:13 +04:00
|
|
|
{
|
2012-11-08 00:13:14 +04:00
|
|
|
settings->SendPreconnectionPdu = TRUE;
|
2016-08-04 17:13:37 +03:00
|
|
|
|
2022-02-02 11:41:25 +03:00
|
|
|
if (!freerdp_settings_set_string(settings, FreeRDP_PreconnectionBlob, arg->Value))
|
2015-06-18 14:00:10 +03:00
|
|
|
return COMMAND_LINE_ERROR_MEMORY;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
2013-01-09 02:18:34 +04:00
|
|
|
CommandLineSwitchCase(arg, "pcid")
|
2012-11-06 07:11:13 +04:00
|
|
|
{
|
2018-11-22 18:28:30 +03:00
|
|
|
LONGLONG val;
|
2017-11-14 18:10:52 +03:00
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
if (!value_to_int(arg->Value, &val, 0, UINT32_MAX))
|
2017-11-14 18:10:52 +03:00
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
2017-11-27 12:54:49 +03:00
|
|
|
|
2012-11-08 00:13:14 +04:00
|
|
|
settings->SendPreconnectionPdu = TRUE;
|
2018-11-22 18:28:30 +03:00
|
|
|
settings->PreconnectionId = (UINT32)val;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "sec")
|
|
|
|
{
|
2020-01-23 11:09:35 +03:00
|
|
|
if (!arg->Value)
|
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
2019-01-29 19:24:29 +03:00
|
|
|
|
2012-11-06 07:11:13 +04:00
|
|
|
if (strcmp("rdp", arg->Value) == 0) /* Standard RDP */
|
|
|
|
{
|
2012-11-07 20:02:46 +04:00
|
|
|
settings->RdpSecurity = TRUE;
|
|
|
|
settings->TlsSecurity = FALSE;
|
|
|
|
settings->NlaSecurity = FALSE;
|
|
|
|
settings->ExtSecurity = FALSE;
|
Standard RDP Security Layer Levels/Method Overhaul
[MS-RDPBCGR] Section 5.3 describes the encryption level and method values for
standard RDP security.
Looking at the current usage of these values in the FreeRDP code gives me
reason to believe that there is a certain lack of understanding of how these
values should be handled.
The encryption level is only configured on the server side in the "Encryption
Level" setting found in the Remote Desktop Session Host Configuration RDP-Tcp
properties dialog and this value is never transferred from the client to the
server over the wire.
The possible options are "None", "Low", "Client Compatible", "High" and
"FIPS Compliant". The client receices this value in the Server Security Data
block (TS_UD_SC_SEC1), probably only for informational purposes and maybe to
give the client the possibility to verify if the server's decision for the
encryption method confirms to the server's encryption level.
The possible encryption methods are "NONE", "40BIT", "56BIT", "128BIT" and
"FIPS" and the RDP client advertises the ones it supports to the server in the
Client Security Data block (TS_UD_CS_SEC).
The server's configured encryption level value restricts the possible final
encryption method.
Something that I was not able to find in the documentation is the priority
level of the individual encryption methods based on which the server makes its
final method decision if there are several options.
My analysis with Windows Servers reveiled that the order is 128, 56, 40, FIPS.
The server only chooses FIPS if the level is "FIPS Comliant" or if it is the
only method advertised by the client.
Bottom line:
* FreeRDP's client side does not need to set settings->EncryptionLevel
(which was done quite frequently).
* FreeRDP's server side does not have to set the supported encryption methods
list in settings->EncryptionMethods
Changes in this commit:
Removed unnecessary/confusing changes of EncryptionLevel/Methods settings
Refactor settings->DisableEncryption
* This value actually means "Advanced RDP Encryption (NLA/TLS) is NOT used"
* The old name caused lots of confusion among developers
* Renamed it to "UseRdpSecurityLayer" (the compare logic stays untouched)
Any client's setting of settings->EncryptionMethods were annihilated
* All clients "want" to set all supported methods
* Some clients forgot 56bit because 56bit was not supported at the time the
code was written
* settings->EncryptionMethods was overwritten anyways in nego_connect()
* Removed all client side settings of settings->EncryptionMethods
The default is "None" (0)
* Changed nego_connect() to advertise all supported methods if
settings->EncryptionMethods is 0 (None)
* Added a commandline option /encryption-methods:comma separated list of the
values "40", "56", "128", "FIPS". E.g. /encryption-methods:56,128
* Print warning if server chooses non-advertised method
Verify received level and method in client's gcc_read_server_security_data
* Only accept valid/known encryption methods
* Verify encryption level/method combinations according to MS-RDPBCGR 5.3.2
Server implementations can now set settings->EncryptionLevel
* The default for settings->EncryptionLevel is 0 (None)
* nego_send_negotiation_response() changes it to ClientCompatible in that case
* default to ClientCompatible if the server implementation set an invalid level
Fix server's gcc_write_server_security_data
* Verify server encryption level value set by server implementations
* Choose rdp encryption method based on level and supported client methods
* Moved FIPS to the lowest priority (only used if other methods are possible)
Updated sample server
* Support RDP Security (RdpKeyFile was not set)
* Added commented sample code for setting the security level
2014-12-12 04:17:12 +03:00
|
|
|
settings->UseRdpSecurityLayer = TRUE;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
|
|
|
else if (strcmp("tls", arg->Value) == 0) /* TLS */
|
|
|
|
{
|
2012-11-07 20:02:46 +04:00
|
|
|
settings->RdpSecurity = FALSE;
|
|
|
|
settings->TlsSecurity = TRUE;
|
|
|
|
settings->NlaSecurity = FALSE;
|
|
|
|
settings->ExtSecurity = FALSE;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
|
|
|
else if (strcmp("nla", arg->Value) == 0) /* NLA */
|
|
|
|
{
|
2012-11-07 20:02:46 +04:00
|
|
|
settings->RdpSecurity = FALSE;
|
|
|
|
settings->TlsSecurity = FALSE;
|
|
|
|
settings->NlaSecurity = TRUE;
|
|
|
|
settings->ExtSecurity = FALSE;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
|
|
|
else if (strcmp("ext", arg->Value) == 0) /* NLA Extended */
|
|
|
|
{
|
2012-11-07 20:02:46 +04:00
|
|
|
settings->RdpSecurity = FALSE;
|
|
|
|
settings->TlsSecurity = FALSE;
|
|
|
|
settings->NlaSecurity = FALSE;
|
|
|
|
settings->ExtSecurity = TRUE;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-06-15 10:47:16 +03:00
|
|
|
WLog_ERR(TAG, "unknown protocol security: %s", arg->Value);
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
|
|
|
}
|
Standard RDP Security Layer Levels/Method Overhaul
[MS-RDPBCGR] Section 5.3 describes the encryption level and method values for
standard RDP security.
Looking at the current usage of these values in the FreeRDP code gives me
reason to believe that there is a certain lack of understanding of how these
values should be handled.
The encryption level is only configured on the server side in the "Encryption
Level" setting found in the Remote Desktop Session Host Configuration RDP-Tcp
properties dialog and this value is never transferred from the client to the
server over the wire.
The possible options are "None", "Low", "Client Compatible", "High" and
"FIPS Compliant". The client receices this value in the Server Security Data
block (TS_UD_SC_SEC1), probably only for informational purposes and maybe to
give the client the possibility to verify if the server's decision for the
encryption method confirms to the server's encryption level.
The possible encryption methods are "NONE", "40BIT", "56BIT", "128BIT" and
"FIPS" and the RDP client advertises the ones it supports to the server in the
Client Security Data block (TS_UD_CS_SEC).
The server's configured encryption level value restricts the possible final
encryption method.
Something that I was not able to find in the documentation is the priority
level of the individual encryption methods based on which the server makes its
final method decision if there are several options.
My analysis with Windows Servers reveiled that the order is 128, 56, 40, FIPS.
The server only chooses FIPS if the level is "FIPS Comliant" or if it is the
only method advertised by the client.
Bottom line:
* FreeRDP's client side does not need to set settings->EncryptionLevel
(which was done quite frequently).
* FreeRDP's server side does not have to set the supported encryption methods
list in settings->EncryptionMethods
Changes in this commit:
Removed unnecessary/confusing changes of EncryptionLevel/Methods settings
Refactor settings->DisableEncryption
* This value actually means "Advanced RDP Encryption (NLA/TLS) is NOT used"
* The old name caused lots of confusion among developers
* Renamed it to "UseRdpSecurityLayer" (the compare logic stays untouched)
Any client's setting of settings->EncryptionMethods were annihilated
* All clients "want" to set all supported methods
* Some clients forgot 56bit because 56bit was not supported at the time the
code was written
* settings->EncryptionMethods was overwritten anyways in nego_connect()
* Removed all client side settings of settings->EncryptionMethods
The default is "None" (0)
* Changed nego_connect() to advertise all supported methods if
settings->EncryptionMethods is 0 (None)
* Added a commandline option /encryption-methods:comma separated list of the
values "40", "56", "128", "FIPS". E.g. /encryption-methods:56,128
* Print warning if server chooses non-advertised method
Verify received level and method in client's gcc_read_server_security_data
* Only accept valid/known encryption methods
* Verify encryption level/method combinations according to MS-RDPBCGR 5.3.2
Server implementations can now set settings->EncryptionLevel
* The default for settings->EncryptionLevel is 0 (None)
* nego_send_negotiation_response() changes it to ClientCompatible in that case
* default to ClientCompatible if the server implementation set an invalid level
Fix server's gcc_write_server_security_data
* Verify server encryption level value set by server implementations
* Choose rdp encryption method based on level and supported client methods
* Moved FIPS to the lowest priority (only used if other methods are possible)
Updated sample server
* Support RDP Security (RdpKeyFile was not set)
* Added commented sample code for setting the security level
2014-12-12 04:17:12 +03:00
|
|
|
CommandLineSwitchCase(arg, "encryption-methods")
|
|
|
|
{
|
|
|
|
if (arg->Flags & COMMAND_LINE_VALUE_PRESENT)
|
|
|
|
{
|
|
|
|
UINT32 i;
|
2021-10-06 10:44:26 +03:00
|
|
|
union
|
|
|
|
{
|
|
|
|
char** p;
|
|
|
|
const char** pc;
|
|
|
|
} ptr;
|
2017-11-30 18:56:45 +03:00
|
|
|
size_t count = 0;
|
2021-10-06 10:44:26 +03:00
|
|
|
ptr.p = CommandLineParseCommaSeparatedValues(arg->Value, &count);
|
Standard RDP Security Layer Levels/Method Overhaul
[MS-RDPBCGR] Section 5.3 describes the encryption level and method values for
standard RDP security.
Looking at the current usage of these values in the FreeRDP code gives me
reason to believe that there is a certain lack of understanding of how these
values should be handled.
The encryption level is only configured on the server side in the "Encryption
Level" setting found in the Remote Desktop Session Host Configuration RDP-Tcp
properties dialog and this value is never transferred from the client to the
server over the wire.
The possible options are "None", "Low", "Client Compatible", "High" and
"FIPS Compliant". The client receices this value in the Server Security Data
block (TS_UD_SC_SEC1), probably only for informational purposes and maybe to
give the client the possibility to verify if the server's decision for the
encryption method confirms to the server's encryption level.
The possible encryption methods are "NONE", "40BIT", "56BIT", "128BIT" and
"FIPS" and the RDP client advertises the ones it supports to the server in the
Client Security Data block (TS_UD_CS_SEC).
The server's configured encryption level value restricts the possible final
encryption method.
Something that I was not able to find in the documentation is the priority
level of the individual encryption methods based on which the server makes its
final method decision if there are several options.
My analysis with Windows Servers reveiled that the order is 128, 56, 40, FIPS.
The server only chooses FIPS if the level is "FIPS Comliant" or if it is the
only method advertised by the client.
Bottom line:
* FreeRDP's client side does not need to set settings->EncryptionLevel
(which was done quite frequently).
* FreeRDP's server side does not have to set the supported encryption methods
list in settings->EncryptionMethods
Changes in this commit:
Removed unnecessary/confusing changes of EncryptionLevel/Methods settings
Refactor settings->DisableEncryption
* This value actually means "Advanced RDP Encryption (NLA/TLS) is NOT used"
* The old name caused lots of confusion among developers
* Renamed it to "UseRdpSecurityLayer" (the compare logic stays untouched)
Any client's setting of settings->EncryptionMethods were annihilated
* All clients "want" to set all supported methods
* Some clients forgot 56bit because 56bit was not supported at the time the
code was written
* settings->EncryptionMethods was overwritten anyways in nego_connect()
* Removed all client side settings of settings->EncryptionMethods
The default is "None" (0)
* Changed nego_connect() to advertise all supported methods if
settings->EncryptionMethods is 0 (None)
* Added a commandline option /encryption-methods:comma separated list of the
values "40", "56", "128", "FIPS". E.g. /encryption-methods:56,128
* Print warning if server chooses non-advertised method
Verify received level and method in client's gcc_read_server_security_data
* Only accept valid/known encryption methods
* Verify encryption level/method combinations according to MS-RDPBCGR 5.3.2
Server implementations can now set settings->EncryptionLevel
* The default for settings->EncryptionLevel is 0 (None)
* nego_send_negotiation_response() changes it to ClientCompatible in that case
* default to ClientCompatible if the server implementation set an invalid level
Fix server's gcc_write_server_security_data
* Verify server encryption level value set by server implementations
* Choose rdp encryption method based on level and supported client methods
* Moved FIPS to the lowest priority (only used if other methods are possible)
Updated sample server
* Support RDP Security (RdpKeyFile was not set)
* Added commented sample code for setting the security level
2014-12-12 04:17:12 +03:00
|
|
|
|
|
|
|
for (i = 0; i < count; i++)
|
|
|
|
{
|
2021-10-06 10:44:26 +03:00
|
|
|
if (!strcmp(ptr.pc[i], "40"))
|
Standard RDP Security Layer Levels/Method Overhaul
[MS-RDPBCGR] Section 5.3 describes the encryption level and method values for
standard RDP security.
Looking at the current usage of these values in the FreeRDP code gives me
reason to believe that there is a certain lack of understanding of how these
values should be handled.
The encryption level is only configured on the server side in the "Encryption
Level" setting found in the Remote Desktop Session Host Configuration RDP-Tcp
properties dialog and this value is never transferred from the client to the
server over the wire.
The possible options are "None", "Low", "Client Compatible", "High" and
"FIPS Compliant". The client receices this value in the Server Security Data
block (TS_UD_SC_SEC1), probably only for informational purposes and maybe to
give the client the possibility to verify if the server's decision for the
encryption method confirms to the server's encryption level.
The possible encryption methods are "NONE", "40BIT", "56BIT", "128BIT" and
"FIPS" and the RDP client advertises the ones it supports to the server in the
Client Security Data block (TS_UD_CS_SEC).
The server's configured encryption level value restricts the possible final
encryption method.
Something that I was not able to find in the documentation is the priority
level of the individual encryption methods based on which the server makes its
final method decision if there are several options.
My analysis with Windows Servers reveiled that the order is 128, 56, 40, FIPS.
The server only chooses FIPS if the level is "FIPS Comliant" or if it is the
only method advertised by the client.
Bottom line:
* FreeRDP's client side does not need to set settings->EncryptionLevel
(which was done quite frequently).
* FreeRDP's server side does not have to set the supported encryption methods
list in settings->EncryptionMethods
Changes in this commit:
Removed unnecessary/confusing changes of EncryptionLevel/Methods settings
Refactor settings->DisableEncryption
* This value actually means "Advanced RDP Encryption (NLA/TLS) is NOT used"
* The old name caused lots of confusion among developers
* Renamed it to "UseRdpSecurityLayer" (the compare logic stays untouched)
Any client's setting of settings->EncryptionMethods were annihilated
* All clients "want" to set all supported methods
* Some clients forgot 56bit because 56bit was not supported at the time the
code was written
* settings->EncryptionMethods was overwritten anyways in nego_connect()
* Removed all client side settings of settings->EncryptionMethods
The default is "None" (0)
* Changed nego_connect() to advertise all supported methods if
settings->EncryptionMethods is 0 (None)
* Added a commandline option /encryption-methods:comma separated list of the
values "40", "56", "128", "FIPS". E.g. /encryption-methods:56,128
* Print warning if server chooses non-advertised method
Verify received level and method in client's gcc_read_server_security_data
* Only accept valid/known encryption methods
* Verify encryption level/method combinations according to MS-RDPBCGR 5.3.2
Server implementations can now set settings->EncryptionLevel
* The default for settings->EncryptionLevel is 0 (None)
* nego_send_negotiation_response() changes it to ClientCompatible in that case
* default to ClientCompatible if the server implementation set an invalid level
Fix server's gcc_write_server_security_data
* Verify server encryption level value set by server implementations
* Choose rdp encryption method based on level and supported client methods
* Moved FIPS to the lowest priority (only used if other methods are possible)
Updated sample server
* Support RDP Security (RdpKeyFile was not set)
* Added commented sample code for setting the security level
2014-12-12 04:17:12 +03:00
|
|
|
settings->EncryptionMethods |= ENCRYPTION_METHOD_40BIT;
|
2021-10-06 10:44:26 +03:00
|
|
|
else if (!strcmp(ptr.pc[i], "56"))
|
Standard RDP Security Layer Levels/Method Overhaul
[MS-RDPBCGR] Section 5.3 describes the encryption level and method values for
standard RDP security.
Looking at the current usage of these values in the FreeRDP code gives me
reason to believe that there is a certain lack of understanding of how these
values should be handled.
The encryption level is only configured on the server side in the "Encryption
Level" setting found in the Remote Desktop Session Host Configuration RDP-Tcp
properties dialog and this value is never transferred from the client to the
server over the wire.
The possible options are "None", "Low", "Client Compatible", "High" and
"FIPS Compliant". The client receices this value in the Server Security Data
block (TS_UD_SC_SEC1), probably only for informational purposes and maybe to
give the client the possibility to verify if the server's decision for the
encryption method confirms to the server's encryption level.
The possible encryption methods are "NONE", "40BIT", "56BIT", "128BIT" and
"FIPS" and the RDP client advertises the ones it supports to the server in the
Client Security Data block (TS_UD_CS_SEC).
The server's configured encryption level value restricts the possible final
encryption method.
Something that I was not able to find in the documentation is the priority
level of the individual encryption methods based on which the server makes its
final method decision if there are several options.
My analysis with Windows Servers reveiled that the order is 128, 56, 40, FIPS.
The server only chooses FIPS if the level is "FIPS Comliant" or if it is the
only method advertised by the client.
Bottom line:
* FreeRDP's client side does not need to set settings->EncryptionLevel
(which was done quite frequently).
* FreeRDP's server side does not have to set the supported encryption methods
list in settings->EncryptionMethods
Changes in this commit:
Removed unnecessary/confusing changes of EncryptionLevel/Methods settings
Refactor settings->DisableEncryption
* This value actually means "Advanced RDP Encryption (NLA/TLS) is NOT used"
* The old name caused lots of confusion among developers
* Renamed it to "UseRdpSecurityLayer" (the compare logic stays untouched)
Any client's setting of settings->EncryptionMethods were annihilated
* All clients "want" to set all supported methods
* Some clients forgot 56bit because 56bit was not supported at the time the
code was written
* settings->EncryptionMethods was overwritten anyways in nego_connect()
* Removed all client side settings of settings->EncryptionMethods
The default is "None" (0)
* Changed nego_connect() to advertise all supported methods if
settings->EncryptionMethods is 0 (None)
* Added a commandline option /encryption-methods:comma separated list of the
values "40", "56", "128", "FIPS". E.g. /encryption-methods:56,128
* Print warning if server chooses non-advertised method
Verify received level and method in client's gcc_read_server_security_data
* Only accept valid/known encryption methods
* Verify encryption level/method combinations according to MS-RDPBCGR 5.3.2
Server implementations can now set settings->EncryptionLevel
* The default for settings->EncryptionLevel is 0 (None)
* nego_send_negotiation_response() changes it to ClientCompatible in that case
* default to ClientCompatible if the server implementation set an invalid level
Fix server's gcc_write_server_security_data
* Verify server encryption level value set by server implementations
* Choose rdp encryption method based on level and supported client methods
* Moved FIPS to the lowest priority (only used if other methods are possible)
Updated sample server
* Support RDP Security (RdpKeyFile was not set)
* Added commented sample code for setting the security level
2014-12-12 04:17:12 +03:00
|
|
|
settings->EncryptionMethods |= ENCRYPTION_METHOD_56BIT;
|
2021-10-06 10:44:26 +03:00
|
|
|
else if (!strcmp(ptr.pc[i], "128"))
|
Standard RDP Security Layer Levels/Method Overhaul
[MS-RDPBCGR] Section 5.3 describes the encryption level and method values for
standard RDP security.
Looking at the current usage of these values in the FreeRDP code gives me
reason to believe that there is a certain lack of understanding of how these
values should be handled.
The encryption level is only configured on the server side in the "Encryption
Level" setting found in the Remote Desktop Session Host Configuration RDP-Tcp
properties dialog and this value is never transferred from the client to the
server over the wire.
The possible options are "None", "Low", "Client Compatible", "High" and
"FIPS Compliant". The client receices this value in the Server Security Data
block (TS_UD_SC_SEC1), probably only for informational purposes and maybe to
give the client the possibility to verify if the server's decision for the
encryption method confirms to the server's encryption level.
The possible encryption methods are "NONE", "40BIT", "56BIT", "128BIT" and
"FIPS" and the RDP client advertises the ones it supports to the server in the
Client Security Data block (TS_UD_CS_SEC).
The server's configured encryption level value restricts the possible final
encryption method.
Something that I was not able to find in the documentation is the priority
level of the individual encryption methods based on which the server makes its
final method decision if there are several options.
My analysis with Windows Servers reveiled that the order is 128, 56, 40, FIPS.
The server only chooses FIPS if the level is "FIPS Comliant" or if it is the
only method advertised by the client.
Bottom line:
* FreeRDP's client side does not need to set settings->EncryptionLevel
(which was done quite frequently).
* FreeRDP's server side does not have to set the supported encryption methods
list in settings->EncryptionMethods
Changes in this commit:
Removed unnecessary/confusing changes of EncryptionLevel/Methods settings
Refactor settings->DisableEncryption
* This value actually means "Advanced RDP Encryption (NLA/TLS) is NOT used"
* The old name caused lots of confusion among developers
* Renamed it to "UseRdpSecurityLayer" (the compare logic stays untouched)
Any client's setting of settings->EncryptionMethods were annihilated
* All clients "want" to set all supported methods
* Some clients forgot 56bit because 56bit was not supported at the time the
code was written
* settings->EncryptionMethods was overwritten anyways in nego_connect()
* Removed all client side settings of settings->EncryptionMethods
The default is "None" (0)
* Changed nego_connect() to advertise all supported methods if
settings->EncryptionMethods is 0 (None)
* Added a commandline option /encryption-methods:comma separated list of the
values "40", "56", "128", "FIPS". E.g. /encryption-methods:56,128
* Print warning if server chooses non-advertised method
Verify received level and method in client's gcc_read_server_security_data
* Only accept valid/known encryption methods
* Verify encryption level/method combinations according to MS-RDPBCGR 5.3.2
Server implementations can now set settings->EncryptionLevel
* The default for settings->EncryptionLevel is 0 (None)
* nego_send_negotiation_response() changes it to ClientCompatible in that case
* default to ClientCompatible if the server implementation set an invalid level
Fix server's gcc_write_server_security_data
* Verify server encryption level value set by server implementations
* Choose rdp encryption method based on level and supported client methods
* Moved FIPS to the lowest priority (only used if other methods are possible)
Updated sample server
* Support RDP Security (RdpKeyFile was not set)
* Added commented sample code for setting the security level
2014-12-12 04:17:12 +03:00
|
|
|
settings->EncryptionMethods |= ENCRYPTION_METHOD_128BIT;
|
2021-10-06 10:44:26 +03:00
|
|
|
else if (!strcmp(ptr.pc[i], "FIPS"))
|
Standard RDP Security Layer Levels/Method Overhaul
[MS-RDPBCGR] Section 5.3 describes the encryption level and method values for
standard RDP security.
Looking at the current usage of these values in the FreeRDP code gives me
reason to believe that there is a certain lack of understanding of how these
values should be handled.
The encryption level is only configured on the server side in the "Encryption
Level" setting found in the Remote Desktop Session Host Configuration RDP-Tcp
properties dialog and this value is never transferred from the client to the
server over the wire.
The possible options are "None", "Low", "Client Compatible", "High" and
"FIPS Compliant". The client receices this value in the Server Security Data
block (TS_UD_SC_SEC1), probably only for informational purposes and maybe to
give the client the possibility to verify if the server's decision for the
encryption method confirms to the server's encryption level.
The possible encryption methods are "NONE", "40BIT", "56BIT", "128BIT" and
"FIPS" and the RDP client advertises the ones it supports to the server in the
Client Security Data block (TS_UD_CS_SEC).
The server's configured encryption level value restricts the possible final
encryption method.
Something that I was not able to find in the documentation is the priority
level of the individual encryption methods based on which the server makes its
final method decision if there are several options.
My analysis with Windows Servers reveiled that the order is 128, 56, 40, FIPS.
The server only chooses FIPS if the level is "FIPS Comliant" or if it is the
only method advertised by the client.
Bottom line:
* FreeRDP's client side does not need to set settings->EncryptionLevel
(which was done quite frequently).
* FreeRDP's server side does not have to set the supported encryption methods
list in settings->EncryptionMethods
Changes in this commit:
Removed unnecessary/confusing changes of EncryptionLevel/Methods settings
Refactor settings->DisableEncryption
* This value actually means "Advanced RDP Encryption (NLA/TLS) is NOT used"
* The old name caused lots of confusion among developers
* Renamed it to "UseRdpSecurityLayer" (the compare logic stays untouched)
Any client's setting of settings->EncryptionMethods were annihilated
* All clients "want" to set all supported methods
* Some clients forgot 56bit because 56bit was not supported at the time the
code was written
* settings->EncryptionMethods was overwritten anyways in nego_connect()
* Removed all client side settings of settings->EncryptionMethods
The default is "None" (0)
* Changed nego_connect() to advertise all supported methods if
settings->EncryptionMethods is 0 (None)
* Added a commandline option /encryption-methods:comma separated list of the
values "40", "56", "128", "FIPS". E.g. /encryption-methods:56,128
* Print warning if server chooses non-advertised method
Verify received level and method in client's gcc_read_server_security_data
* Only accept valid/known encryption methods
* Verify encryption level/method combinations according to MS-RDPBCGR 5.3.2
Server implementations can now set settings->EncryptionLevel
* The default for settings->EncryptionLevel is 0 (None)
* nego_send_negotiation_response() changes it to ClientCompatible in that case
* default to ClientCompatible if the server implementation set an invalid level
Fix server's gcc_write_server_security_data
* Verify server encryption level value set by server implementations
* Choose rdp encryption method based on level and supported client methods
* Moved FIPS to the lowest priority (only used if other methods are possible)
Updated sample server
* Support RDP Security (RdpKeyFile was not set)
* Added commented sample code for setting the security level
2014-12-12 04:17:12 +03:00
|
|
|
settings->EncryptionMethods |= ENCRYPTION_METHOD_FIPS;
|
|
|
|
else
|
2021-10-06 10:44:26 +03:00
|
|
|
WLog_ERR(TAG, "unknown encryption method '%s'", ptr.pc[i]);
|
Standard RDP Security Layer Levels/Method Overhaul
[MS-RDPBCGR] Section 5.3 describes the encryption level and method values for
standard RDP security.
Looking at the current usage of these values in the FreeRDP code gives me
reason to believe that there is a certain lack of understanding of how these
values should be handled.
The encryption level is only configured on the server side in the "Encryption
Level" setting found in the Remote Desktop Session Host Configuration RDP-Tcp
properties dialog and this value is never transferred from the client to the
server over the wire.
The possible options are "None", "Low", "Client Compatible", "High" and
"FIPS Compliant". The client receices this value in the Server Security Data
block (TS_UD_SC_SEC1), probably only for informational purposes and maybe to
give the client the possibility to verify if the server's decision for the
encryption method confirms to the server's encryption level.
The possible encryption methods are "NONE", "40BIT", "56BIT", "128BIT" and
"FIPS" and the RDP client advertises the ones it supports to the server in the
Client Security Data block (TS_UD_CS_SEC).
The server's configured encryption level value restricts the possible final
encryption method.
Something that I was not able to find in the documentation is the priority
level of the individual encryption methods based on which the server makes its
final method decision if there are several options.
My analysis with Windows Servers reveiled that the order is 128, 56, 40, FIPS.
The server only chooses FIPS if the level is "FIPS Comliant" or if it is the
only method advertised by the client.
Bottom line:
* FreeRDP's client side does not need to set settings->EncryptionLevel
(which was done quite frequently).
* FreeRDP's server side does not have to set the supported encryption methods
list in settings->EncryptionMethods
Changes in this commit:
Removed unnecessary/confusing changes of EncryptionLevel/Methods settings
Refactor settings->DisableEncryption
* This value actually means "Advanced RDP Encryption (NLA/TLS) is NOT used"
* The old name caused lots of confusion among developers
* Renamed it to "UseRdpSecurityLayer" (the compare logic stays untouched)
Any client's setting of settings->EncryptionMethods were annihilated
* All clients "want" to set all supported methods
* Some clients forgot 56bit because 56bit was not supported at the time the
code was written
* settings->EncryptionMethods was overwritten anyways in nego_connect()
* Removed all client side settings of settings->EncryptionMethods
The default is "None" (0)
* Changed nego_connect() to advertise all supported methods if
settings->EncryptionMethods is 0 (None)
* Added a commandline option /encryption-methods:comma separated list of the
values "40", "56", "128", "FIPS". E.g. /encryption-methods:56,128
* Print warning if server chooses non-advertised method
Verify received level and method in client's gcc_read_server_security_data
* Only accept valid/known encryption methods
* Verify encryption level/method combinations according to MS-RDPBCGR 5.3.2
Server implementations can now set settings->EncryptionLevel
* The default for settings->EncryptionLevel is 0 (None)
* nego_send_negotiation_response() changes it to ClientCompatible in that case
* default to ClientCompatible if the server implementation set an invalid level
Fix server's gcc_write_server_security_data
* Verify server encryption level value set by server implementations
* Choose rdp encryption method based on level and supported client methods
* Moved FIPS to the lowest priority (only used if other methods are possible)
Updated sample server
* Support RDP Security (RdpKeyFile was not set)
* Added commented sample code for setting the security level
2014-12-12 04:17:12 +03:00
|
|
|
}
|
|
|
|
|
2021-10-06 10:44:26 +03:00
|
|
|
free(ptr.p);
|
Standard RDP Security Layer Levels/Method Overhaul
[MS-RDPBCGR] Section 5.3 describes the encryption level and method values for
standard RDP security.
Looking at the current usage of these values in the FreeRDP code gives me
reason to believe that there is a certain lack of understanding of how these
values should be handled.
The encryption level is only configured on the server side in the "Encryption
Level" setting found in the Remote Desktop Session Host Configuration RDP-Tcp
properties dialog and this value is never transferred from the client to the
server over the wire.
The possible options are "None", "Low", "Client Compatible", "High" and
"FIPS Compliant". The client receices this value in the Server Security Data
block (TS_UD_SC_SEC1), probably only for informational purposes and maybe to
give the client the possibility to verify if the server's decision for the
encryption method confirms to the server's encryption level.
The possible encryption methods are "NONE", "40BIT", "56BIT", "128BIT" and
"FIPS" and the RDP client advertises the ones it supports to the server in the
Client Security Data block (TS_UD_CS_SEC).
The server's configured encryption level value restricts the possible final
encryption method.
Something that I was not able to find in the documentation is the priority
level of the individual encryption methods based on which the server makes its
final method decision if there are several options.
My analysis with Windows Servers reveiled that the order is 128, 56, 40, FIPS.
The server only chooses FIPS if the level is "FIPS Comliant" or if it is the
only method advertised by the client.
Bottom line:
* FreeRDP's client side does not need to set settings->EncryptionLevel
(which was done quite frequently).
* FreeRDP's server side does not have to set the supported encryption methods
list in settings->EncryptionMethods
Changes in this commit:
Removed unnecessary/confusing changes of EncryptionLevel/Methods settings
Refactor settings->DisableEncryption
* This value actually means "Advanced RDP Encryption (NLA/TLS) is NOT used"
* The old name caused lots of confusion among developers
* Renamed it to "UseRdpSecurityLayer" (the compare logic stays untouched)
Any client's setting of settings->EncryptionMethods were annihilated
* All clients "want" to set all supported methods
* Some clients forgot 56bit because 56bit was not supported at the time the
code was written
* settings->EncryptionMethods was overwritten anyways in nego_connect()
* Removed all client side settings of settings->EncryptionMethods
The default is "None" (0)
* Changed nego_connect() to advertise all supported methods if
settings->EncryptionMethods is 0 (None)
* Added a commandline option /encryption-methods:comma separated list of the
values "40", "56", "128", "FIPS". E.g. /encryption-methods:56,128
* Print warning if server chooses non-advertised method
Verify received level and method in client's gcc_read_server_security_data
* Only accept valid/known encryption methods
* Verify encryption level/method combinations according to MS-RDPBCGR 5.3.2
Server implementations can now set settings->EncryptionLevel
* The default for settings->EncryptionLevel is 0 (None)
* nego_send_negotiation_response() changes it to ClientCompatible in that case
* default to ClientCompatible if the server implementation set an invalid level
Fix server's gcc_write_server_security_data
* Verify server encryption level value set by server implementations
* Choose rdp encryption method based on level and supported client methods
* Moved FIPS to the lowest priority (only used if other methods are possible)
Updated sample server
* Support RDP Security (RdpKeyFile was not set)
* Added commented sample code for setting the security level
2014-12-12 04:17:12 +03:00
|
|
|
}
|
|
|
|
}
|
2015-06-23 15:59:54 +03:00
|
|
|
CommandLineSwitchCase(arg, "from-stdin")
|
|
|
|
{
|
|
|
|
settings->CredentialsFromStdin = TRUE;
|
2017-11-27 12:54:49 +03:00
|
|
|
|
2017-11-10 13:52:23 +03:00
|
|
|
if (arg->Flags & COMMAND_LINE_VALUE_PRESENT)
|
|
|
|
{
|
2020-01-23 11:09:35 +03:00
|
|
|
if (!arg->Value)
|
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
2020-03-06 12:06:36 +03:00
|
|
|
promptForPassword = (_strnicmp(arg->Value, "force", 6) == 0);
|
2017-11-10 13:52:23 +03:00
|
|
|
|
|
|
|
if (!promptForPassword)
|
|
|
|
return COMMAND_LINE_ERROR;
|
|
|
|
}
|
2015-06-23 15:59:54 +03:00
|
|
|
}
|
2016-01-23 17:16:13 +03:00
|
|
|
CommandLineSwitchCase(arg, "log-level")
|
|
|
|
{
|
|
|
|
wLog* root = WLog_GetRoot();
|
2016-08-04 17:13:37 +03:00
|
|
|
|
2016-01-23 17:16:13 +03:00
|
|
|
if (!WLog_SetStringLogLevel(root, arg->Value))
|
|
|
|
return COMMAND_LINE_ERROR;
|
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "log-filters")
|
|
|
|
{
|
|
|
|
if (!WLog_AddStringLogFilters(arg->Value))
|
|
|
|
return COMMAND_LINE_ERROR;
|
|
|
|
}
|
2012-11-06 07:11:13 +04:00
|
|
|
CommandLineSwitchCase(arg, "sec-rdp")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->RdpSecurity = enable;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "sec-tls")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->TlsSecurity = enable;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "sec-nla")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->NlaSecurity = enable;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "sec-ext")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->ExtSecurity = enable;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
2014-07-17 16:59:06 +04:00
|
|
|
CommandLineSwitchCase(arg, "tls-ciphers")
|
|
|
|
{
|
2022-02-02 11:41:25 +03:00
|
|
|
const char* ciphers = NULL;
|
2020-01-23 11:09:35 +03:00
|
|
|
if (!arg->Value)
|
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
2016-08-04 17:13:37 +03:00
|
|
|
|
2015-02-06 22:21:26 +03:00
|
|
|
if (strcmp(arg->Value, "netmon") == 0)
|
|
|
|
{
|
2022-08-16 11:40:32 +03:00
|
|
|
ciphers = "ALL:!ECDH:!ADH:!DHE";
|
2015-02-06 22:21:26 +03:00
|
|
|
}
|
|
|
|
else if (strcmp(arg->Value, "ma") == 0)
|
|
|
|
{
|
2022-02-02 11:41:25 +03:00
|
|
|
ciphers = "AES128-SHA";
|
2015-02-06 22:21:26 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-02-02 11:41:25 +03:00
|
|
|
ciphers = arg->Value;
|
2015-02-06 22:21:26 +03:00
|
|
|
}
|
2022-02-02 11:41:25 +03:00
|
|
|
|
|
|
|
if (!freerdp_settings_set_string(settings, FreeRDP_AllowedTlsCiphers, ciphers))
|
|
|
|
return COMMAND_LINE_ERROR_MEMORY;
|
2014-07-17 16:59:06 +04:00
|
|
|
}
|
2018-11-08 13:01:56 +03:00
|
|
|
CommandLineSwitchCase(arg, "tls-seclevel")
|
|
|
|
{
|
2018-11-22 18:28:30 +03:00
|
|
|
LONGLONG val;
|
2018-11-08 13:01:56 +03:00
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
if (!value_to_int(arg->Value, &val, 0, 5))
|
2018-11-08 13:01:56 +03:00
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
settings->TlsSecLevel = (UINT32)val;
|
2018-11-08 13:01:56 +03:00
|
|
|
}
|
2022-08-16 11:40:32 +03:00
|
|
|
CommandLineSwitchCase(arg, "tls-secrets-file")
|
|
|
|
{
|
|
|
|
if (!arg->Value)
|
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
|
|
|
|
|
|
|
if (!freerdp_settings_set_string(settings, FreeRDP_TlsSecretsFile, arg->Value))
|
|
|
|
return COMMAND_LINE_ERROR_MEMORY;
|
|
|
|
}
|
2022-06-23 03:17:43 +03:00
|
|
|
CommandLineSwitchCase(arg, "enforce-tlsv1_2")
|
|
|
|
{
|
2022-07-05 16:57:55 +03:00
|
|
|
if (!(freerdp_settings_set_uint16(settings, FreeRDP_TLSMinVersion, TLS1_2_VERSION) &&
|
|
|
|
freerdp_settings_set_uint16(settings, FreeRDP_TLSMaxVersion, TLS1_2_VERSION)))
|
2022-06-23 09:36:25 +03:00
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
2022-06-23 03:17:43 +03:00
|
|
|
}
|
2020-02-12 14:03:43 +03:00
|
|
|
CommandLineSwitchCase(arg, "cert")
|
|
|
|
{
|
|
|
|
int rc = 0;
|
2021-10-06 10:44:26 +03:00
|
|
|
union
|
|
|
|
{
|
|
|
|
char** p;
|
|
|
|
const char** pc;
|
|
|
|
} ptr;
|
2020-02-12 14:03:43 +03:00
|
|
|
size_t count, x;
|
2021-10-06 10:44:26 +03:00
|
|
|
ptr.p = CommandLineParseCommaSeparatedValues(arg->Value, &count);
|
2020-02-12 14:03:43 +03:00
|
|
|
for (x = 0; (x < count) && (rc == 0); x++)
|
|
|
|
{
|
|
|
|
const char deny[] = "deny";
|
|
|
|
const char ignore[] = "ignore";
|
|
|
|
const char tofu[] = "tofu";
|
|
|
|
const char name[5] = "name:";
|
|
|
|
const char fingerprints[12] = "fingerprint:";
|
|
|
|
|
2021-10-06 10:44:26 +03:00
|
|
|
const char* cur = ptr.pc[x];
|
2020-03-06 12:06:36 +03:00
|
|
|
if (_strnicmp(deny, cur, sizeof(deny)) == 0)
|
2020-02-12 14:03:43 +03:00
|
|
|
settings->AutoDenyCertificate = TRUE;
|
2020-03-06 12:06:36 +03:00
|
|
|
else if (_strnicmp(ignore, cur, sizeof(ignore)) == 0)
|
2020-02-12 14:03:43 +03:00
|
|
|
settings->IgnoreCertificate = TRUE;
|
2020-03-06 12:06:36 +03:00
|
|
|
else if (_strnicmp(tofu, cur, 4) == 0)
|
2020-02-12 14:03:43 +03:00
|
|
|
settings->AutoAcceptCertificate = TRUE;
|
2020-03-06 12:06:36 +03:00
|
|
|
else if (_strnicmp(name, cur, sizeof(name)) == 0)
|
2020-02-12 14:03:43 +03:00
|
|
|
{
|
|
|
|
const char* val = &cur[sizeof(name)];
|
2022-02-02 11:41:25 +03:00
|
|
|
if (!freerdp_settings_set_string(settings, FreeRDP_CertificateName, val))
|
2020-02-12 14:03:43 +03:00
|
|
|
rc = COMMAND_LINE_ERROR_MEMORY;
|
|
|
|
}
|
2020-03-06 12:06:36 +03:00
|
|
|
else if (_strnicmp(fingerprints, cur, sizeof(fingerprints)) == 0)
|
2020-02-12 14:03:43 +03:00
|
|
|
{
|
|
|
|
const char* val = &cur[sizeof(fingerprints)];
|
|
|
|
if (!append_value(val, &settings->CertificateAcceptedFingerprints))
|
|
|
|
rc = COMMAND_LINE_ERROR_MEMORY;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
rc = COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
|
|
|
}
|
2021-10-06 10:44:26 +03:00
|
|
|
free(ptr.p);
|
2020-02-12 14:03:43 +03:00
|
|
|
|
|
|
|
if (rc)
|
|
|
|
return rc;
|
|
|
|
}
|
2012-11-06 07:11:13 +04:00
|
|
|
CommandLineSwitchCase(arg, "cert-name")
|
|
|
|
{
|
2022-02-02 11:41:25 +03:00
|
|
|
if (!freerdp_settings_set_string(settings, FreeRDP_CertificateName, arg->Value))
|
2015-06-18 14:00:10 +03:00
|
|
|
return COMMAND_LINE_ERROR_MEMORY;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "cert-ignore")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->IgnoreCertificate = enable;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
2016-03-31 13:16:55 +03:00
|
|
|
CommandLineSwitchCase(arg, "cert-tofu")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->AutoAcceptCertificate = enable;
|
2018-12-14 12:17:52 +03:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "cert-deny")
|
|
|
|
{
|
|
|
|
settings->AutoDenyCertificate = enable;
|
2016-03-31 13:16:55 +03:00
|
|
|
}
|
2012-11-15 08:06:56 +04:00
|
|
|
CommandLineSwitchCase(arg, "authentication")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->Authentication = enable;
|
2012-11-15 08:06:56 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "encryption")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->UseRdpSecurityLayer = !enable;
|
2012-11-15 08:06:56 +04:00
|
|
|
}
|
2012-11-15 19:00:07 +04:00
|
|
|
CommandLineSwitchCase(arg, "grab-keyboard")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->GrabKeyboard = enable;
|
2012-11-15 19:00:07 +04:00
|
|
|
}
|
2020-06-29 22:05:12 +03:00
|
|
|
CommandLineSwitchCase(arg, "grab-mouse")
|
|
|
|
{
|
|
|
|
settings->GrabMouse = enable;
|
|
|
|
}
|
2022-01-18 18:06:25 +03:00
|
|
|
CommandLineSwitchCase(arg, "mouse-relative")
|
|
|
|
{
|
|
|
|
settings->MouseUseRelativeMove = enable;
|
|
|
|
}
|
2015-07-14 02:03:33 +03:00
|
|
|
CommandLineSwitchCase(arg, "unmap-buttons")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->UnmapButtons = enable;
|
2015-07-14 02:03:33 +03:00
|
|
|
}
|
2013-02-28 20:32:46 +04:00
|
|
|
CommandLineSwitchCase(arg, "toggle-fullscreen")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->ToggleFullscreen = enable;
|
2013-02-28 20:32:46 +04:00
|
|
|
}
|
2018-09-18 22:25:51 +03:00
|
|
|
CommandLineSwitchCase(arg, "floatbar")
|
|
|
|
{
|
2018-11-15 16:42:31 +03:00
|
|
|
/* Defaults are enabled, visible, sticky, fullscreen */
|
2022-03-24 13:07:11 +03:00
|
|
|
UINT32 Floatbar = 0x0017;
|
2018-11-15 16:42:31 +03:00
|
|
|
|
|
|
|
if (arg->Value)
|
|
|
|
{
|
|
|
|
char* start = arg->Value;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
char* cur = start;
|
|
|
|
start = strchr(start, ',');
|
|
|
|
|
|
|
|
if (start)
|
|
|
|
{
|
|
|
|
*start = '\0';
|
|
|
|
start = start + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* sticky:[on|off] */
|
2018-11-16 12:33:29 +03:00
|
|
|
if (_strnicmp(cur, "sticky:", 7) == 0)
|
2018-11-15 16:42:31 +03:00
|
|
|
{
|
|
|
|
const char* val = cur + 7;
|
2022-03-24 13:07:11 +03:00
|
|
|
Floatbar &= ~0x02u;
|
2018-11-15 16:42:31 +03:00
|
|
|
|
2018-11-16 12:33:29 +03:00
|
|
|
if (_strnicmp(val, "on", 3) == 0)
|
2022-03-24 13:07:11 +03:00
|
|
|
Floatbar |= 0x02u;
|
2018-11-16 12:33:29 +03:00
|
|
|
else if (_strnicmp(val, "off", 4) == 0)
|
2022-03-24 13:07:11 +03:00
|
|
|
Floatbar &= ~0x02u;
|
2018-11-15 16:42:31 +03:00
|
|
|
else
|
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
|
|
|
}
|
|
|
|
/* default:[visible|hidden] */
|
2018-11-16 12:33:29 +03:00
|
|
|
else if (_strnicmp(cur, "default:", 8) == 0)
|
2018-11-15 16:42:31 +03:00
|
|
|
{
|
|
|
|
const char* val = cur + 8;
|
2022-03-24 13:07:11 +03:00
|
|
|
Floatbar &= ~0x04u;
|
2018-11-15 16:42:31 +03:00
|
|
|
|
2018-11-16 12:33:29 +03:00
|
|
|
if (_strnicmp(val, "visible", 8) == 0)
|
2022-03-24 13:07:11 +03:00
|
|
|
Floatbar |= 0x04u;
|
2018-11-16 12:33:29 +03:00
|
|
|
else if (_strnicmp(val, "hidden", 7) == 0)
|
2022-03-24 13:07:11 +03:00
|
|
|
Floatbar &= ~0x04u;
|
2018-11-15 16:42:31 +03:00
|
|
|
else
|
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
|
|
|
}
|
|
|
|
/* show:[always|fullscreen|window] */
|
2018-11-16 12:33:29 +03:00
|
|
|
else if (_strnicmp(cur, "show:", 5) == 0)
|
2018-11-15 16:42:31 +03:00
|
|
|
{
|
|
|
|
const char* val = cur + 5;
|
2022-03-24 13:07:11 +03:00
|
|
|
Floatbar &= ~0x30u;
|
2018-11-15 16:42:31 +03:00
|
|
|
|
2018-11-16 12:33:29 +03:00
|
|
|
if (_strnicmp(val, "always", 7) == 0)
|
2022-03-24 13:07:11 +03:00
|
|
|
Floatbar |= 0x30u;
|
2018-11-16 12:33:29 +03:00
|
|
|
else if (_strnicmp(val, "fullscreen", 11) == 0)
|
2022-03-24 13:07:11 +03:00
|
|
|
Floatbar |= 0x10u;
|
2018-11-16 12:33:29 +03:00
|
|
|
else if (_strnicmp(val, "window", 7) == 0)
|
2022-03-24 13:07:11 +03:00
|
|
|
Floatbar |= 0x20u;
|
2018-11-15 16:42:31 +03:00
|
|
|
else
|
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
2019-11-06 17:24:51 +03:00
|
|
|
} while (start);
|
2022-03-24 13:07:11 +03:00
|
|
|
if (!freerdp_settings_set_uint32(settings, FreeRDP_Floatbar, Floatbar))
|
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
2018-11-15 16:42:31 +03:00
|
|
|
}
|
2018-09-18 22:25:51 +03:00
|
|
|
}
|
2012-11-27 01:49:12 +04:00
|
|
|
CommandLineSwitchCase(arg, "mouse-motion")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->MouseMotion = enable;
|
2012-11-27 01:49:12 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "parent-window")
|
|
|
|
{
|
2018-11-22 18:28:30 +03:00
|
|
|
ULONGLONG val;
|
2017-11-14 18:10:52 +03:00
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
if (!value_to_uint(arg->Value, &val, 0, UINT64_MAX))
|
2017-11-14 18:10:52 +03:00
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
settings->ParentWindowId = (UINT64)val;
|
2012-11-27 01:49:12 +04:00
|
|
|
}
|
2020-01-13 12:50:14 +03:00
|
|
|
CommandLineSwitchCase(arg, "client-build-number")
|
|
|
|
{
|
|
|
|
ULONGLONG val;
|
|
|
|
|
|
|
|
if (!value_to_uint(arg->Value, &val, 0, UINT32_MAX))
|
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
|
|
|
if (!freerdp_settings_set_uint32(settings, FreeRDP_ClientBuild, (UINT32)val))
|
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
|
|
|
}
|
2012-11-26 23:31:31 +04:00
|
|
|
CommandLineSwitchCase(arg, "bitmap-cache")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->BitmapCacheEnabled = enable;
|
2012-11-26 23:31:31 +04:00
|
|
|
}
|
2022-05-30 23:32:23 +03:00
|
|
|
CommandLineSwitchCase(arg, "persist-cache")
|
|
|
|
{
|
|
|
|
settings->BitmapCachePersistEnabled = enable;
|
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "persist-cache-file")
|
|
|
|
{
|
|
|
|
if (!freerdp_settings_set_string(settings, FreeRDP_BitmapCachePersistFile, arg->Value))
|
|
|
|
return COMMAND_LINE_ERROR_MEMORY;
|
|
|
|
|
|
|
|
settings->BitmapCachePersistEnabled = TRUE;
|
|
|
|
}
|
2012-11-26 23:31:31 +04:00
|
|
|
CommandLineSwitchCase(arg, "offscreen-cache")
|
|
|
|
{
|
2019-01-29 18:22:46 +03:00
|
|
|
settings->OffscreenSupportLevel = (UINT32)enable;
|
2012-11-27 01:49:12 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "glyph-cache")
|
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
settings->GlyphSupportLevel = arg->Value ? GLYPH_SUPPORT_FULL : GLYPH_SUPPORT_NONE;
|
2012-11-27 01:49:12 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "codec-cache")
|
|
|
|
{
|
2020-01-23 11:09:35 +03:00
|
|
|
if (!arg->Value)
|
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
2012-11-27 01:49:12 +04:00
|
|
|
settings->BitmapCacheV3Enabled = TRUE;
|
2019-01-29 19:24:29 +03:00
|
|
|
|
2012-11-27 01:49:12 +04:00
|
|
|
if (strcmp(arg->Value, "rfx") == 0)
|
|
|
|
{
|
|
|
|
settings->RemoteFxCodec = TRUE;
|
|
|
|
}
|
|
|
|
else if (strcmp(arg->Value, "nsc") == 0)
|
|
|
|
{
|
2021-07-01 12:40:41 +03:00
|
|
|
freerdp_settings_set_bool(settings, FreeRDP_NSCodec, TRUE);
|
2012-11-27 01:49:12 +04:00
|
|
|
}
|
2017-11-27 12:54:49 +03:00
|
|
|
|
2017-07-24 16:23:36 +03:00
|
|
|
#if defined(WITH_JPEG)
|
2012-11-27 01:49:12 +04:00
|
|
|
else if (strcmp(arg->Value, "jpeg") == 0)
|
|
|
|
{
|
|
|
|
settings->JpegCodec = TRUE;
|
|
|
|
|
|
|
|
if (settings->JpegQuality == 0)
|
|
|
|
settings->JpegQuality = 75;
|
|
|
|
}
|
2017-11-27 12:54:49 +03:00
|
|
|
|
2017-07-24 16:23:36 +03:00
|
|
|
#endif
|
2012-11-26 23:31:31 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "fast-path")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->FastPathInput = enable;
|
|
|
|
settings->FastPathOutput = enable;
|
2012-11-26 23:31:31 +04:00
|
|
|
}
|
2013-05-14 12:24:05 +04:00
|
|
|
CommandLineSwitchCase(arg, "max-fast-path-size")
|
|
|
|
{
|
2018-11-22 18:28:30 +03:00
|
|
|
LONGLONG val;
|
2017-11-14 18:10:52 +03:00
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
if (!value_to_int(arg->Value, &val, 0, UINT32_MAX))
|
2017-11-14 18:10:52 +03:00
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
settings->MultifragMaxRequestSize = (UINT32)val;
|
2013-05-14 12:24:05 +04:00
|
|
|
}
|
2016-10-17 19:56:52 +03:00
|
|
|
CommandLineSwitchCase(arg, "max-loop-time")
|
|
|
|
{
|
2018-11-22 18:28:30 +03:00
|
|
|
LONGLONG val;
|
2017-11-14 18:10:52 +03:00
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
if (!value_to_int(arg->Value, &val, -1, UINT32_MAX))
|
2017-11-14 18:10:52 +03:00
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
if (val < 0)
|
2019-11-06 17:24:51 +03:00
|
|
|
settings->MaxTimeInCheckLoop =
|
|
|
|
10 * 60 * 60 * 1000; /* 10 hours can be considered as infinite */
|
2018-11-22 18:28:30 +03:00
|
|
|
else
|
|
|
|
settings->MaxTimeInCheckLoop = (UINT32)val;
|
2016-10-17 19:56:52 +03:00
|
|
|
}
|
2019-11-25 11:54:56 +03:00
|
|
|
CommandLineSwitchCase(arg, "auto-request-control")
|
|
|
|
{
|
|
|
|
if (!freerdp_settings_set_bool(settings, FreeRDP_RemoteAssistanceRequestControl,
|
|
|
|
enable))
|
|
|
|
return COMMAND_LINE_ERROR;
|
|
|
|
}
|
2013-01-28 03:22:46 +04:00
|
|
|
CommandLineSwitchCase(arg, "async-update")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->AsyncUpdate = enable;
|
2013-01-28 03:22:46 +04:00
|
|
|
}
|
2013-02-19 21:29:15 +04:00
|
|
|
CommandLineSwitchCase(arg, "async-channels")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->AsyncChannels = enable;
|
2013-02-19 21:29:15 +04:00
|
|
|
}
|
2013-03-26 18:47:39 +04:00
|
|
|
CommandLineSwitchCase(arg, "wm-class")
|
|
|
|
{
|
2022-02-02 11:41:25 +03:00
|
|
|
if (!freerdp_settings_set_string(settings, FreeRDP_WmClass, arg->Value))
|
2015-06-18 14:00:10 +03:00
|
|
|
return COMMAND_LINE_ERROR_MEMORY;
|
2013-03-26 18:47:39 +04:00
|
|
|
}
|
2013-05-27 17:28:08 +04:00
|
|
|
CommandLineSwitchCase(arg, "play-rfx")
|
|
|
|
{
|
2022-02-02 11:41:25 +03:00
|
|
|
if (!freerdp_settings_set_string(settings, FreeRDP_PlayRemoteFxFile, arg->Value))
|
2015-06-18 14:00:10 +03:00
|
|
|
return COMMAND_LINE_ERROR_MEMORY;
|
2016-08-04 17:13:37 +03:00
|
|
|
|
2013-05-27 17:28:08 +04:00
|
|
|
settings->PlayRemoteFx = TRUE;
|
|
|
|
}
|
2013-05-27 17:35:25 +04:00
|
|
|
CommandLineSwitchCase(arg, "auth-only")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->AuthenticationOnly = enable;
|
2013-05-27 17:35:25 +04:00
|
|
|
}
|
2014-02-28 01:55:07 +04:00
|
|
|
CommandLineSwitchCase(arg, "auto-reconnect")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->AutoReconnectionEnabled = enable;
|
2014-02-28 01:55:07 +04:00
|
|
|
}
|
2016-12-16 14:56:17 +03:00
|
|
|
CommandLineSwitchCase(arg, "auto-reconnect-max-retries")
|
|
|
|
{
|
2018-11-22 18:28:30 +03:00
|
|
|
LONGLONG val;
|
2017-11-14 18:10:52 +03:00
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
if (!value_to_int(arg->Value, &val, 0, 1000))
|
2017-11-14 18:10:52 +03:00
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
settings->AutoReconnectMaxRetries = (UINT32)val;
|
2016-12-16 14:56:17 +03:00
|
|
|
}
|
2013-10-22 19:14:29 +04:00
|
|
|
CommandLineSwitchCase(arg, "reconnect-cookie")
|
|
|
|
{
|
2018-08-17 15:45:07 +03:00
|
|
|
BYTE* base64 = NULL;
|
2021-04-13 12:01:43 +03:00
|
|
|
size_t length;
|
2020-01-23 11:09:35 +03:00
|
|
|
if (!arg->Value)
|
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
|
|
|
|
2021-04-13 12:01:43 +03:00
|
|
|
crypto_base64_decode((const char*)(arg->Value), strlen(arg->Value), &base64, &length);
|
2016-08-04 17:13:37 +03:00
|
|
|
|
2013-10-22 19:14:29 +04:00
|
|
|
if ((base64 != NULL) && (length == sizeof(ARC_SC_PRIVATE_PACKET)))
|
|
|
|
{
|
2021-04-13 12:01:43 +03:00
|
|
|
memcpy(settings->ServerAutoReconnectCookie, base64, length);
|
2013-10-22 19:14:29 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-06-15 10:47:16 +03:00
|
|
|
WLog_ERR(TAG, "reconnect-cookie: invalid base64 '%s'", arg->Value);
|
2013-10-22 19:14:29 +04:00
|
|
|
}
|
2018-08-17 15:45:07 +03:00
|
|
|
|
|
|
|
free(base64);
|
2013-10-22 19:14:29 +04:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "print-reconnect-cookie")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->PrintReconnectCookie = enable;
|
2013-10-22 19:14:29 +04:00
|
|
|
}
|
2015-03-04 17:37:25 +03:00
|
|
|
CommandLineSwitchCase(arg, "pwidth")
|
|
|
|
{
|
2018-11-22 18:28:30 +03:00
|
|
|
LONGLONG val;
|
2017-11-14 18:10:52 +03:00
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
if (!value_to_int(arg->Value, &val, 0, UINT32_MAX))
|
2017-11-14 18:10:52 +03:00
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
settings->DesktopPhysicalWidth = (UINT32)val;
|
2015-03-04 17:37:25 +03:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "pheight")
|
|
|
|
{
|
2018-11-22 18:28:30 +03:00
|
|
|
LONGLONG val;
|
2017-11-14 18:10:52 +03:00
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
if (!value_to_int(arg->Value, &val, 0, UINT32_MAX))
|
2017-11-14 18:10:52 +03:00
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
settings->DesktopPhysicalHeight = (UINT32)val;
|
2015-03-04 17:37:25 +03:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "orientation")
|
|
|
|
{
|
2018-11-22 18:28:30 +03:00
|
|
|
LONGLONG val;
|
2017-11-14 18:10:52 +03:00
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
if (!value_to_int(arg->Value, &val, 0, UINT16_MAX))
|
2017-11-14 18:10:52 +03:00
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
settings->DesktopOrientation = (UINT16)val;
|
2015-03-04 17:37:25 +03:00
|
|
|
}
|
2018-10-31 12:27:31 +03:00
|
|
|
CommandLineSwitchCase(arg, "old-license")
|
|
|
|
{
|
|
|
|
settings->OldLicenseBehaviour = TRUE;
|
|
|
|
}
|
2015-03-04 17:37:25 +03:00
|
|
|
CommandLineSwitchCase(arg, "scale")
|
|
|
|
{
|
2018-11-22 18:28:30 +03:00
|
|
|
LONGLONG val;
|
2017-11-14 18:10:52 +03:00
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
if (!value_to_int(arg->Value, &val, 100, 180))
|
2017-11-14 18:10:52 +03:00
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
2016-08-04 17:13:37 +03:00
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
switch (val)
|
2016-08-04 17:13:37 +03:00
|
|
|
{
|
2018-11-22 18:28:30 +03:00
|
|
|
case 100:
|
|
|
|
case 140:
|
|
|
|
case 180:
|
2019-07-30 13:03:23 +03:00
|
|
|
settings->DesktopScaleFactor = (UINT32)val;
|
2018-11-22 18:28:30 +03:00
|
|
|
settings->DeviceScaleFactor = (UINT32)val;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
2015-03-04 17:37:25 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "scale-desktop")
|
|
|
|
{
|
2018-11-22 18:28:30 +03:00
|
|
|
LONGLONG val;
|
2017-11-14 18:10:52 +03:00
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
if (!value_to_int(arg->Value, &val, 100, 500))
|
|
|
|
return FALSE;
|
2016-08-04 17:13:37 +03:00
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
settings->DesktopScaleFactor = (UINT32)val;
|
2015-03-04 17:37:25 +03:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "scale-device")
|
|
|
|
{
|
2018-11-22 18:28:30 +03:00
|
|
|
LONGLONG val;
|
2017-11-14 18:10:52 +03:00
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
if (!value_to_int(arg->Value, &val, 100, 180))
|
2017-11-14 18:10:52 +03:00
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
2016-08-04 17:13:37 +03:00
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
switch (val)
|
2015-03-04 17:37:25 +03:00
|
|
|
{
|
2018-11-22 18:28:30 +03:00
|
|
|
case 100:
|
|
|
|
case 140:
|
|
|
|
case 180:
|
|
|
|
settings->DeviceScaleFactor = (UINT32)val;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
2015-03-04 17:37:25 +03:00
|
|
|
}
|
|
|
|
}
|
2017-02-06 07:54:54 +03:00
|
|
|
CommandLineSwitchCase(arg, "action-script")
|
|
|
|
{
|
2022-02-02 11:41:25 +03:00
|
|
|
if (!freerdp_settings_set_string(settings, FreeRDP_ActionScript, arg->Value))
|
2017-02-06 07:54:54 +03:00
|
|
|
return COMMAND_LINE_ERROR_MEMORY;
|
|
|
|
}
|
2021-08-25 11:02:46 +03:00
|
|
|
CommandLineSwitchCase(arg, RDP2TCP_DVC_CHANNEL_NAME)
|
2019-05-14 21:02:31 +03:00
|
|
|
{
|
2022-02-02 11:41:25 +03:00
|
|
|
if (!freerdp_settings_set_string(settings, FreeRDP_RDP2TCPArgs, arg->Value))
|
2019-05-14 21:02:31 +03:00
|
|
|
return COMMAND_LINE_ERROR_MEMORY;
|
|
|
|
}
|
2017-04-08 00:54:08 +03:00
|
|
|
CommandLineSwitchCase(arg, "fipsmode")
|
|
|
|
{
|
2018-10-15 12:51:16 +03:00
|
|
|
settings->FIPSMode = enable;
|
2017-04-08 00:54:08 +03:00
|
|
|
}
|
2018-09-04 16:49:21 +03:00
|
|
|
CommandLineSwitchCase(arg, "smartcard-logon")
|
|
|
|
{
|
2021-11-24 15:33:37 +03:00
|
|
|
size_t count;
|
|
|
|
union
|
|
|
|
{
|
|
|
|
char** p;
|
|
|
|
const char** pc;
|
|
|
|
} ptr;
|
|
|
|
|
2022-01-23 19:28:49 +03:00
|
|
|
settings->SmartcardLogon = TRUE;
|
2022-02-02 01:23:34 +03:00
|
|
|
|
2021-11-24 15:33:37 +03:00
|
|
|
ptr.p = CommandLineParseCommaSeparatedValuesEx("smartcard-logon", arg->Value, &count);
|
|
|
|
if (ptr.pc)
|
|
|
|
{
|
|
|
|
size_t x;
|
2022-02-23 18:31:12 +03:00
|
|
|
const CmdLineSubOptions opts[] = {
|
|
|
|
{ "cert:", FreeRDP_SmartcardCertificate, CMDLINE_SUBOPTION_FILE,
|
|
|
|
setSmartcardEmulation },
|
|
|
|
{ "key:", FreeRDP_SmartcardPrivateKey, CMDLINE_SUBOPTION_FILE,
|
|
|
|
setSmartcardEmulation },
|
2022-03-09 11:09:53 +03:00
|
|
|
{ "pin:", FreeRDP_Password, CMDLINE_SUBOPTION_STRING, NULL },
|
2022-02-05 01:59:16 +03:00
|
|
|
{ "csp:", FreeRDP_CspName, CMDLINE_SUBOPTION_STRING, NULL },
|
|
|
|
{ "reader:", FreeRDP_ReaderName, CMDLINE_SUBOPTION_STRING, NULL },
|
|
|
|
{ "card:", FreeRDP_CardName, CMDLINE_SUBOPTION_STRING, NULL },
|
2022-02-23 18:31:12 +03:00
|
|
|
{ "container:", FreeRDP_ContainerName, CMDLINE_SUBOPTION_STRING, NULL }
|
2022-02-05 01:59:16 +03:00
|
|
|
};
|
|
|
|
|
2021-11-24 15:33:37 +03:00
|
|
|
for (x = 1; x < count; x++)
|
|
|
|
{
|
|
|
|
const char* cur = ptr.pc[x];
|
2022-02-23 18:31:12 +03:00
|
|
|
if (!parseSubOptions(settings, opts, ARRAYSIZE(opts), cur))
|
2021-11-24 15:33:37 +03:00
|
|
|
{
|
|
|
|
free(ptr.p);
|
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
free(ptr.p);
|
2018-09-04 16:49:21 +03:00
|
|
|
}
|
2020-04-11 12:55:11 +03:00
|
|
|
CommandLineSwitchCase(arg, "tune")
|
|
|
|
{
|
|
|
|
size_t x, count;
|
2021-10-06 10:44:26 +03:00
|
|
|
union
|
|
|
|
{
|
|
|
|
char** p;
|
|
|
|
const char** pc;
|
|
|
|
} ptr;
|
|
|
|
ptr.p = CommandLineParseCommaSeparatedValuesEx("tune", arg->Value, &count);
|
|
|
|
if (!ptr.pc)
|
2020-04-11 12:55:11 +03:00
|
|
|
return COMMAND_LINE_ERROR;
|
|
|
|
for (x = 1; x < count; x++)
|
|
|
|
{
|
2021-10-06 10:44:26 +03:00
|
|
|
const char* cur = ptr.pc[x];
|
2020-04-11 12:55:11 +03:00
|
|
|
char* sep = strchr(cur, ':');
|
|
|
|
if (!sep)
|
|
|
|
{
|
2021-10-06 10:44:26 +03:00
|
|
|
free(ptr.p);
|
2020-04-11 12:55:11 +03:00
|
|
|
return COMMAND_LINE_ERROR;
|
|
|
|
}
|
|
|
|
*sep++ = '\0';
|
|
|
|
if (!freerdp_settings_set_value_for_name(settings, cur, sep))
|
|
|
|
{
|
2021-10-06 10:44:26 +03:00
|
|
|
free(ptr.p);
|
2020-04-11 12:55:11 +03:00
|
|
|
return COMMAND_LINE_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-06 10:44:26 +03:00
|
|
|
free(ptr.p);
|
2020-04-11 12:55:11 +03:00
|
|
|
}
|
|
|
|
CommandLineSwitchCase(arg, "tune-list")
|
|
|
|
{
|
|
|
|
size_t x;
|
|
|
|
SSIZE_T type = 0;
|
|
|
|
|
|
|
|
printf("%s\t%50s\t%s\t%s", "<index>", "<key>", "<type>", "<default value>\n");
|
|
|
|
for (x = 0; x < FreeRDP_Settings_StableAPI_MAX; x++)
|
|
|
|
{
|
|
|
|
const char* name = freerdp_settings_get_name_for_key(x);
|
|
|
|
type = freerdp_settings_get_type_for_key(x);
|
|
|
|
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case RDP_SETTINGS_TYPE_BOOL:
|
|
|
|
printf("%" PRIuz "\t%50s\tBOOL\t%s\n", x, name,
|
|
|
|
freerdp_settings_get_bool(settings, x) ? "TRUE" : "FALSE");
|
|
|
|
break;
|
|
|
|
case RDP_SETTINGS_TYPE_UINT16:
|
|
|
|
printf("%" PRIuz "\t%50s\tUINT16\t%" PRIu16 "\n", x, name,
|
|
|
|
freerdp_settings_get_uint16(settings, x));
|
|
|
|
break;
|
|
|
|
case RDP_SETTINGS_TYPE_INT16:
|
|
|
|
printf("%" PRIuz "\t%50s\tINT16\t%" PRId16 "\n", x, name,
|
|
|
|
freerdp_settings_get_int16(settings, x));
|
|
|
|
break;
|
|
|
|
case RDP_SETTINGS_TYPE_UINT32:
|
|
|
|
printf("%" PRIuz "\t%50s\tUINT32\t%" PRIu32 "\n", x, name,
|
|
|
|
freerdp_settings_get_uint32(settings, x));
|
|
|
|
break;
|
|
|
|
case RDP_SETTINGS_TYPE_INT32:
|
|
|
|
printf("%" PRIuz "\t%50s\tINT32\t%" PRId32 "\n", x, name,
|
|
|
|
freerdp_settings_get_int32(settings, x));
|
|
|
|
break;
|
|
|
|
case RDP_SETTINGS_TYPE_UINT64:
|
|
|
|
printf("%" PRIuz "\t%50s\tUINT64\t%" PRIu64 "\n", x, name,
|
|
|
|
freerdp_settings_get_uint64(settings, x));
|
|
|
|
break;
|
|
|
|
case RDP_SETTINGS_TYPE_INT64:
|
|
|
|
printf("%" PRIuz "\t%50s\tINT64\t%" PRId64 "\n", x, name,
|
|
|
|
freerdp_settings_get_int64(settings, x));
|
|
|
|
break;
|
|
|
|
case RDP_SETTINGS_TYPE_STRING:
|
|
|
|
printf("%" PRIuz "\t%50s\tSTRING\t%s"
|
|
|
|
"\n",
|
|
|
|
x, name, freerdp_settings_get_string(settings, x));
|
|
|
|
break;
|
|
|
|
case RDP_SETTINGS_TYPE_POINTER:
|
|
|
|
printf("%" PRIuz "\t%50s\tPOINTER\t%p"
|
|
|
|
"\n",
|
|
|
|
x, name, freerdp_settings_get_pointer(settings, x));
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return COMMAND_LINE_STATUS_PRINT;
|
|
|
|
}
|
2012-11-06 07:11:13 +04:00
|
|
|
CommandLineSwitchDefault(arg)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
CommandLineSwitchEnd(arg)
|
2019-11-06 17:24:51 +03:00
|
|
|
} while ((arg = CommandLineFindNextArgumentA(arg)) != NULL);
|
2012-11-06 07:11:13 +04:00
|
|
|
|
2017-02-16 22:16:56 +03:00
|
|
|
if (user)
|
2015-06-18 12:35:22 +03:00
|
|
|
{
|
2017-02-10 23:38:52 +03:00
|
|
|
free(settings->Username);
|
2017-05-15 14:43:51 +03:00
|
|
|
|
2017-02-10 23:38:52 +03:00
|
|
|
if (!settings->Domain && user)
|
|
|
|
{
|
|
|
|
BOOL ret;
|
|
|
|
free(settings->Domain);
|
|
|
|
ret = freerdp_parse_username(user, &settings->Username, &settings->Domain);
|
|
|
|
free(user);
|
2017-05-15 14:43:51 +03:00
|
|
|
|
2017-02-10 23:38:52 +03:00
|
|
|
if (!ret)
|
|
|
|
return COMMAND_LINE_ERROR;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
settings->Username = user;
|
2015-06-18 12:35:22 +03:00
|
|
|
}
|
|
|
|
|
2017-02-17 13:53:57 +03:00
|
|
|
if (gwUser)
|
2015-06-18 12:35:22 +03:00
|
|
|
{
|
2017-02-17 13:53:57 +03:00
|
|
|
free(settings->GatewayUsername);
|
|
|
|
|
|
|
|
if (!settings->GatewayDomain && gwUser)
|
|
|
|
{
|
|
|
|
BOOL ret;
|
|
|
|
free(settings->GatewayDomain);
|
|
|
|
ret = freerdp_parse_username(gwUser, &settings->GatewayUsername,
|
2017-05-15 14:43:51 +03:00
|
|
|
&settings->GatewayDomain);
|
2017-02-17 13:53:57 +03:00
|
|
|
free(gwUser);
|
|
|
|
|
|
|
|
if (!ret)
|
|
|
|
return COMMAND_LINE_ERROR;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
settings->GatewayUsername = gwUser;
|
2015-06-18 12:35:22 +03:00
|
|
|
}
|
|
|
|
|
2017-11-10 13:52:23 +03:00
|
|
|
if (promptForPassword)
|
|
|
|
{
|
|
|
|
const size_t size = 512;
|
|
|
|
|
|
|
|
if (!settings->Password)
|
|
|
|
{
|
|
|
|
settings->Password = calloc(size, sizeof(char));
|
|
|
|
|
|
|
|
if (!settings->Password)
|
|
|
|
return COMMAND_LINE_ERROR;
|
|
|
|
|
|
|
|
if (!freerdp_passphrase_read("Password: ", settings->Password, size, 1))
|
|
|
|
return COMMAND_LINE_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (settings->GatewayEnabled && !settings->GatewayUseSameCredentials)
|
|
|
|
{
|
|
|
|
if (!settings->GatewayPassword)
|
|
|
|
{
|
|
|
|
settings->GatewayPassword = calloc(size, sizeof(char));
|
|
|
|
|
|
|
|
if (!settings->GatewayPassword)
|
|
|
|
return COMMAND_LINE_ERROR;
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
if (!freerdp_passphrase_read("Gateway Password: ", settings->GatewayPassword, size,
|
|
|
|
1))
|
2017-11-10 13:52:23 +03:00
|
|
|
return COMMAND_LINE_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-17 22:56:23 +04:00
|
|
|
freerdp_performance_flags_make(settings);
|
2012-11-06 07:11:13 +04:00
|
|
|
|
2021-07-01 12:40:41 +03:00
|
|
|
if (settings->RemoteFxCodec || freerdp_settings_get_bool(settings, FreeRDP_NSCodec) ||
|
|
|
|
settings->SupportGraphicsPipeline)
|
2014-07-03 22:35:03 +04:00
|
|
|
{
|
|
|
|
settings->FastPathOutput = TRUE;
|
|
|
|
settings->FrameMarkerCommandEnabled = TRUE;
|
2016-08-04 17:13:37 +03:00
|
|
|
settings->ColorDepth = 32;
|
2014-07-03 22:35:03 +04:00
|
|
|
}
|
|
|
|
|
2019-10-28 12:10:14 +03:00
|
|
|
arg = CommandLineFindArgumentA(largs, "port");
|
2014-02-05 20:54:42 +04:00
|
|
|
if (arg->Flags & COMMAND_LINE_ARGUMENT_PRESENT)
|
|
|
|
{
|
2018-11-22 18:28:30 +03:00
|
|
|
LONGLONG val;
|
2017-11-14 18:10:52 +03:00
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
if (!value_to_int(arg->Value, &val, 1, UINT16_MAX))
|
2017-11-14 18:10:52 +03:00
|
|
|
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
|
|
|
|
2018-11-22 18:28:30 +03:00
|
|
|
settings->ServerPort = (UINT32)val;
|
2014-02-05 20:54:42 +04:00
|
|
|
}
|
|
|
|
|
2019-10-28 12:10:14 +03:00
|
|
|
arg = CommandLineFindArgumentA(largs, "p");
|
2022-02-02 01:23:34 +03:00
|
|
|
if (arg->Flags & COMMAND_LINE_ARGUMENT_PRESENT)
|
|
|
|
{
|
|
|
|
FillMemory(arg->Value, strlen(arg->Value), '*');
|
|
|
|
}
|
2012-12-06 01:04:01 +04:00
|
|
|
|
2022-02-05 01:59:16 +03:00
|
|
|
arg = CommandLineFindArgumentA(largs, "smartcard-logon");
|
2012-12-06 01:04:01 +04:00
|
|
|
if (arg->Flags & COMMAND_LINE_ARGUMENT_PRESENT)
|
|
|
|
{
|
2022-04-27 18:46:31 +03:00
|
|
|
if (arg->Flags & COMMAND_LINE_VALUE_PRESENT)
|
|
|
|
FillMemory(arg->Value, strlen(arg->Value), '*');
|
2012-12-06 01:04:01 +04:00
|
|
|
}
|
|
|
|
|
2019-10-28 12:10:14 +03:00
|
|
|
arg = CommandLineFindArgumentA(largs, "gp");
|
2012-12-06 01:04:01 +04:00
|
|
|
if (arg->Flags & COMMAND_LINE_ARGUMENT_PRESENT)
|
|
|
|
{
|
|
|
|
FillMemory(arg->Value, strlen(arg->Value), '*');
|
|
|
|
}
|
|
|
|
|
2013-07-03 18:41:26 +04:00
|
|
|
return status;
|
2012-11-06 07:11:13 +04:00
|
|
|
}
|
2012-11-09 04:01:52 +04:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
static BOOL freerdp_client_load_static_channel_addin(rdpChannels* channels, rdpSettings* settings,
|
2021-04-22 13:55:41 +03:00
|
|
|
const char* name, void* data)
|
2012-11-09 04:01:52 +04:00
|
|
|
{
|
2016-11-15 18:58:38 +03:00
|
|
|
PVIRTUALCHANNELENTRY entry = NULL;
|
|
|
|
PVIRTUALCHANNELENTRYEX entryEx = NULL;
|
2019-11-06 17:24:51 +03:00
|
|
|
entryEx = (PVIRTUALCHANNELENTRYEX)(void*)freerdp_load_channel_addin_entry(
|
|
|
|
name, NULL, NULL, FREERDP_ADDIN_CHANNEL_STATIC | FREERDP_ADDIN_CHANNEL_ENTRYEX);
|
2012-11-19 22:26:56 +04:00
|
|
|
|
2016-11-16 17:52:24 +03:00
|
|
|
if (!entryEx)
|
|
|
|
entry = freerdp_load_channel_addin_entry(name, NULL, NULL, FREERDP_ADDIN_CHANNEL_STATIC);
|
2016-11-15 18:58:38 +03:00
|
|
|
|
|
|
|
if (entryEx)
|
|
|
|
{
|
|
|
|
if (freerdp_channels_client_load_ex(channels, settings, entryEx, data) == 0)
|
|
|
|
{
|
2022-03-03 12:48:15 +03:00
|
|
|
WLog_DBG(TAG, "loading channelEx %s", name);
|
2016-11-15 18:58:38 +03:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (entry)
|
2012-11-21 18:30:06 +04:00
|
|
|
{
|
|
|
|
if (freerdp_channels_client_load(channels, settings, entry, data) == 0)
|
2012-11-19 22:26:56 +04:00
|
|
|
{
|
2022-03-03 12:48:15 +03:00
|
|
|
WLog_DBG(TAG, "loading channel %s", name);
|
2016-02-01 17:09:51 +03:00
|
|
|
return TRUE;
|
2012-11-19 22:26:56 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-01 17:09:51 +03:00
|
|
|
return FALSE;
|
2012-11-21 18:30:06 +04:00
|
|
|
}
|
|
|
|
|
2022-09-14 14:53:27 +03:00
|
|
|
typedef struct
|
2012-11-21 18:30:06 +04:00
|
|
|
{
|
2022-09-14 14:53:27 +03:00
|
|
|
size_t settingId;
|
|
|
|
const char* channelName;
|
|
|
|
void* args;
|
|
|
|
} ChannelToLoad;
|
2012-11-21 18:30:06 +04:00
|
|
|
|
2022-09-14 14:53:27 +03:00
|
|
|
BOOL freerdp_client_load_addins(rdpChannels* channels, rdpSettings* settings)
|
|
|
|
{
|
|
|
|
ChannelToLoad dynChannels[] = {
|
2022-01-17 16:21:17 +03:00
|
|
|
#if defined(CHANNEL_AINPUT_CLIENT)
|
2022-09-14 14:53:27 +03:00
|
|
|
{ 0, AINPUT_CHANNEL_NAME, NULL }, /* always loaded */
|
2022-01-17 16:21:17 +03:00
|
|
|
#endif
|
2022-09-14 14:53:27 +03:00
|
|
|
{ FreeRDP_AudioCapture, "audin", NULL },
|
|
|
|
{ FreeRDP_AudioPlayback, RDPSND_CHANNEL_NAME, NULL },
|
|
|
|
#ifdef CHANNEL_RDPEI_CLIENT
|
|
|
|
{ FreeRDP_MultiTouchInput, "rdpei", NULL },
|
|
|
|
#endif
|
|
|
|
{ FreeRDP_SupportGraphicsPipeline, "rdpgfx", NULL },
|
|
|
|
{ FreeRDP_SupportEchoChannel, "echo", NULL },
|
|
|
|
{ FreeRDP_SupportSSHAgentChannel, "sshagent", NULL },
|
|
|
|
{ FreeRDP_SupportDisplayControl, DISP_CHANNEL_NAME, NULL },
|
|
|
|
{ FreeRDP_SupportGeometryTracking, "geometry", NULL },
|
|
|
|
{ FreeRDP_SupportSSHAgentChannel, "sshagent", NULL },
|
|
|
|
{ FreeRDP_SupportSSHAgentChannel, "sshagent", NULL },
|
|
|
|
{ FreeRDP_SupportVideoOptimized, "video", NULL },
|
|
|
|
};
|
|
|
|
|
|
|
|
ChannelToLoad staticChannels[] = {
|
|
|
|
{ FreeRDP_AudioPlayback, RDPSND_CHANNEL_NAME, NULL },
|
|
|
|
{ FreeRDP_RedirectClipboard, CLIPRDR_SVC_CHANNEL_NAME, NULL },
|
|
|
|
#if defined(CHANNEL_ENCOMSP_CLIENT)
|
|
|
|
{ FreeRDP_EncomspVirtualChannel, ENCOMSP_SVC_CHANNEL_NAME, settings },
|
|
|
|
#endif
|
|
|
|
{ FreeRDP_RemdeskVirtualChannel, REMDESK_SVC_CHANNEL_NAME, settings },
|
|
|
|
{ FreeRDP_RemoteApplicationMode, RAIL_SVC_CHANNEL_NAME, settings }
|
|
|
|
};
|
|
|
|
size_t i;
|
2022-01-17 16:21:17 +03:00
|
|
|
|
2022-09-14 14:53:27 +03:00
|
|
|
/**
|
|
|
|
* Step 1: first load dynamic channels according to the settings
|
|
|
|
*/
|
|
|
|
for (i = 0; i < ARRAYSIZE(dynChannels); i++)
|
2019-07-30 13:30:15 +03:00
|
|
|
{
|
2022-09-14 14:53:27 +03:00
|
|
|
if ((dynChannels[i].settingId == 0) ||
|
|
|
|
freerdp_settings_get_bool(settings, dynChannels[i].settingId))
|
|
|
|
{
|
|
|
|
const char* p[] = { dynChannels[i].channelName };
|
2019-07-30 13:30:15 +03:00
|
|
|
|
2022-09-14 14:53:27 +03:00
|
|
|
if (!freerdp_client_add_dynamic_channel(settings, ARRAYSIZE(p), p))
|
|
|
|
return FALSE;
|
|
|
|
}
|
2019-07-30 13:30:15 +03:00
|
|
|
}
|
|
|
|
|
2022-09-14 14:53:27 +03:00
|
|
|
/**
|
|
|
|
* step 2: do various adjustements in the settings, to handle channels and settings dependencies
|
|
|
|
*/
|
2021-08-25 13:10:48 +03:00
|
|
|
if ((freerdp_static_channel_collection_find(settings, RDPSND_CHANNEL_NAME)) ||
|
|
|
|
(freerdp_dynamic_channel_collection_find(settings, RDPSND_CHANNEL_NAME))
|
2020-02-25 17:21:16 +03:00
|
|
|
#if defined(CHANNEL_TSMF_CLIENT)
|
|
|
|
|| (freerdp_dynamic_channel_collection_find(settings, "tsmf"))
|
|
|
|
#endif
|
|
|
|
)
|
2012-11-26 10:34:40 +04:00
|
|
|
{
|
2013-05-11 00:39:16 +04:00
|
|
|
settings->DeviceRedirection = TRUE; /* rdpsnd requires rdpdr to be registered */
|
2019-11-06 17:24:51 +03:00
|
|
|
settings->AudioPlayback = TRUE; /* Both rdpsnd and tsmf require this flag to be set */
|
2012-11-26 10:34:40 +04:00
|
|
|
}
|
2012-11-26 10:15:11 +04:00
|
|
|
|
2013-05-17 17:29:53 +04:00
|
|
|
if (freerdp_dynamic_channel_collection_find(settings, "audin"))
|
|
|
|
{
|
|
|
|
settings->AudioCapture = TRUE;
|
|
|
|
}
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
if (settings->NetworkAutoDetect || settings->SupportHeartbeatPdu ||
|
2016-02-01 17:09:51 +03:00
|
|
|
settings->SupportMultitransport)
|
2014-01-30 07:53:32 +04:00
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
settings->DeviceRedirection = TRUE; /* these RDP8 features require rdpdr to be registered */
|
2014-01-30 07:53:32 +04:00
|
|
|
}
|
|
|
|
|
2019-08-23 12:47:31 +03:00
|
|
|
if (settings->DrivesToRedirect && (strlen(settings->DrivesToRedirect) != 0))
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Drives to redirect:
|
|
|
|
*
|
|
|
|
* Very similar to DevicesToRedirect, but can contain a
|
|
|
|
* comma-separated list of drive letters to redirect.
|
|
|
|
*/
|
|
|
|
char* value;
|
|
|
|
char* tok;
|
|
|
|
char* context = NULL;
|
|
|
|
|
|
|
|
value = _strdup(settings->DrivesToRedirect);
|
|
|
|
if (!value)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
tok = strtok_s(value, ";", &context);
|
|
|
|
if (!tok)
|
|
|
|
{
|
2021-07-28 10:49:17 +03:00
|
|
|
WLog_ERR(TAG, "DrivesToRedirect contains invalid data: '%s'",
|
|
|
|
settings->DrivesToRedirect);
|
2019-08-23 12:47:31 +03:00
|
|
|
free(value);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
while (tok)
|
2019-08-23 12:47:31 +03:00
|
|
|
{
|
|
|
|
/* Syntax: Comma seperated list of the following entries:
|
|
|
|
* '*' ... Redirect all drives, including hotplug
|
|
|
|
* 'DynamicDrives' ... hotplug
|
2021-03-09 14:09:58 +03:00
|
|
|
* '%' ... user home directory
|
2019-08-23 12:47:31 +03:00
|
|
|
* <label>(<path>) ... One or more paths to redirect.
|
|
|
|
* <path>(<label>) ... One or more paths to redirect.
|
|
|
|
* <path> ... One or more paths to redirect.
|
|
|
|
*/
|
|
|
|
/* TODO: Need to properly escape labels and paths */
|
|
|
|
BOOL success;
|
|
|
|
const char* name = NULL;
|
|
|
|
const char* drive = tok;
|
2020-05-18 12:18:55 +03:00
|
|
|
char* subcontext = NULL;
|
|
|
|
char* start = strtok_s(tok, "(", &subcontext);
|
|
|
|
char* end = strtok_s(NULL, ")", &subcontext);
|
2019-11-20 11:16:12 +03:00
|
|
|
if (start && end)
|
2019-08-23 12:47:31 +03:00
|
|
|
name = end;
|
|
|
|
|
|
|
|
if (freerdp_path_valid(name, NULL) && freerdp_path_valid(drive, NULL))
|
|
|
|
{
|
|
|
|
success = freerdp_client_add_drive(settings, name, NULL);
|
|
|
|
if (success)
|
|
|
|
success = freerdp_client_add_drive(settings, drive, NULL);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
success = freerdp_client_add_drive(settings, drive, name);
|
|
|
|
|
|
|
|
if (!success)
|
|
|
|
{
|
|
|
|
free(value);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
tok = strtok_s(NULL, ";", &context);
|
|
|
|
}
|
|
|
|
free(value);
|
|
|
|
|
|
|
|
if (!freerdp_settings_set_bool(settings, FreeRDP_DeviceRedirection, TRUE))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
settings->DeviceRedirection = TRUE;
|
|
|
|
}
|
2019-10-01 16:38:31 +03:00
|
|
|
else if (settings->RedirectDrives)
|
2014-04-28 05:29:44 +04:00
|
|
|
{
|
2013-02-15 04:38:45 +04:00
|
|
|
if (!freerdp_device_collection_find(settings, "drive"))
|
|
|
|
{
|
2021-10-06 10:44:26 +03:00
|
|
|
const char* params[] = { "drive", "media", "*" };
|
2013-02-15 04:38:45 +04:00
|
|
|
|
2021-10-06 10:44:26 +03:00
|
|
|
if (!freerdp_client_add_device_channel(settings, ARRAYSIZE(params), params))
|
2016-02-01 17:09:51 +03:00
|
|
|
return FALSE;
|
2013-02-15 04:38:45 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
if (settings->RedirectDrives || settings->RedirectHomeDrive || settings->RedirectSerialPorts ||
|
|
|
|
settings->RedirectSmartCards || settings->RedirectPrinters)
|
2019-10-01 16:38:31 +03:00
|
|
|
{
|
|
|
|
settings->DeviceRedirection = TRUE; /* All of these features require rdpdr */
|
|
|
|
}
|
|
|
|
|
2013-02-15 04:38:45 +04:00
|
|
|
if (settings->RedirectHomeDrive)
|
|
|
|
{
|
|
|
|
if (!freerdp_device_collection_find(settings, "drive"))
|
|
|
|
{
|
2021-10-06 10:44:26 +03:00
|
|
|
const char* params[] = { "drive", "home", "%" };
|
2013-02-15 04:38:45 +04:00
|
|
|
|
2021-10-06 10:44:26 +03:00
|
|
|
if (!freerdp_client_add_device_channel(settings, ARRAYSIZE(params), params))
|
2016-02-01 17:09:51 +03:00
|
|
|
return FALSE;
|
2013-02-15 04:38:45 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-11-09 04:01:52 +04:00
|
|
|
if (settings->DeviceRedirection)
|
|
|
|
{
|
2021-09-22 15:27:21 +03:00
|
|
|
if (!freerdp_client_load_static_channel_addin(channels, settings, RDPDR_SVC_CHANNEL_NAME,
|
|
|
|
settings))
|
2016-02-01 17:09:51 +03:00
|
|
|
return FALSE;
|
2012-11-09 04:01:52 +04:00
|
|
|
|
2021-08-25 13:10:48 +03:00
|
|
|
if (!freerdp_static_channel_collection_find(settings, RDPSND_CHANNEL_NAME) &&
|
|
|
|
!freerdp_dynamic_channel_collection_find(settings, RDPSND_CHANNEL_NAME))
|
2012-11-09 04:01:52 +04:00
|
|
|
{
|
2021-10-06 10:44:26 +03:00
|
|
|
const char* params[] = { RDPSND_CHANNEL_NAME, "sys:fake" };
|
2012-11-21 18:30:06 +04:00
|
|
|
|
2021-10-06 10:44:26 +03:00
|
|
|
if (!freerdp_client_add_static_channel(settings, ARRAYSIZE(params), params))
|
2016-02-01 17:09:51 +03:00
|
|
|
return FALSE;
|
2012-11-09 04:01:52 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-28 05:29:44 +04:00
|
|
|
if (settings->RedirectSmartCards)
|
|
|
|
{
|
2016-02-26 16:50:27 +03:00
|
|
|
if (!freerdp_device_collection_find_type(settings, RDPDR_DTYP_SMARTCARD))
|
|
|
|
{
|
2021-10-07 11:43:16 +03:00
|
|
|
RDPDR_DEVICE* smartcard = freerdp_device_new(RDPDR_DTYP_SMARTCARD, 0, NULL);
|
2014-04-28 05:29:44 +04:00
|
|
|
|
2016-02-26 16:50:27 +03:00
|
|
|
if (!smartcard)
|
|
|
|
return FALSE;
|
2014-04-28 05:29:44 +04:00
|
|
|
|
2021-10-07 11:43:16 +03:00
|
|
|
if (!freerdp_device_collection_add(settings, smartcard))
|
|
|
|
{
|
|
|
|
freerdp_device_free(smartcard);
|
2016-02-26 16:50:27 +03:00
|
|
|
return FALSE;
|
2021-10-07 11:43:16 +03:00
|
|
|
}
|
2016-02-26 16:50:27 +03:00
|
|
|
}
|
2014-04-28 05:29:44 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (settings->RedirectPrinters)
|
|
|
|
{
|
2016-02-26 16:50:27 +03:00
|
|
|
if (!freerdp_device_collection_find_type(settings, RDPDR_DTYP_PRINT))
|
|
|
|
{
|
2021-10-07 11:43:16 +03:00
|
|
|
RDPDR_DEVICE* printer = freerdp_device_new(RDPDR_DTYP_PRINT, 0, NULL);
|
2014-04-28 05:29:44 +04:00
|
|
|
|
2016-02-26 16:50:27 +03:00
|
|
|
if (!printer)
|
|
|
|
return FALSE;
|
2014-04-28 05:29:44 +04:00
|
|
|
|
2021-10-07 11:43:16 +03:00
|
|
|
if (!freerdp_device_collection_add(settings, printer))
|
|
|
|
{
|
|
|
|
freerdp_device_free(printer);
|
2016-02-26 16:50:27 +03:00
|
|
|
return FALSE;
|
2021-10-07 11:43:16 +03:00
|
|
|
}
|
2016-02-26 16:50:27 +03:00
|
|
|
}
|
2014-04-28 05:29:44 +04:00
|
|
|
}
|
|
|
|
|
2014-11-21 23:10:39 +03:00
|
|
|
if (settings->LyncRdpMode)
|
|
|
|
{
|
|
|
|
settings->EncomspVirtualChannel = TRUE;
|
|
|
|
settings->RemdeskVirtualChannel = TRUE;
|
|
|
|
settings->CompressionEnabled = FALSE;
|
|
|
|
}
|
|
|
|
|
2014-06-29 02:33:46 +04:00
|
|
|
if (settings->RemoteAssistanceMode)
|
|
|
|
{
|
2014-11-21 23:10:39 +03:00
|
|
|
settings->EncomspVirtualChannel = TRUE;
|
|
|
|
settings->RemdeskVirtualChannel = TRUE;
|
2018-11-12 12:34:21 +03:00
|
|
|
settings->NlaSecurity = FALSE;
|
2014-11-21 23:10:39 +03:00
|
|
|
}
|
|
|
|
|
2022-09-14 14:53:27 +03:00
|
|
|
/* step 3: schedule some static channels to load depending on the settings */
|
|
|
|
for (i = 0; i < ARRAYSIZE(staticChannels); i++)
|
2016-02-01 17:09:51 +03:00
|
|
|
{
|
2022-09-14 14:53:27 +03:00
|
|
|
if ((staticChannels[i].settingId == 0) ||
|
|
|
|
freerdp_settings_get_bool(settings, staticChannels[i].settingId))
|
|
|
|
{
|
|
|
|
if (staticChannels[i].args)
|
|
|
|
{
|
|
|
|
if (!freerdp_client_load_static_channel_addin(
|
|
|
|
channels, settings, staticChannels[i].channelName, staticChannels[i].args))
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const char* p[] = { staticChannels[i].channelName };
|
|
|
|
if (!freerdp_client_add_static_channel(settings, ARRAYSIZE(p), p))
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
2019-05-14 21:02:31 +03:00
|
|
|
}
|
|
|
|
|
2022-09-21 11:55:53 +03:00
|
|
|
if (settings->RDP2TCPArgs)
|
|
|
|
{
|
|
|
|
if (!freerdp_client_load_static_channel_addin(channels, settings, RDP2TCP_DVC_CHANNEL_NAME,
|
|
|
|
settings->RDP2TCPArgs))
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2022-09-14 14:53:27 +03:00
|
|
|
/* step 4: do the static channels loading and init */
|
|
|
|
for (i = 0; i < settings->StaticChannelCount; i++)
|
2012-11-21 18:30:06 +04:00
|
|
|
{
|
2022-09-14 14:53:27 +03:00
|
|
|
ADDIN_ARGV* _args = settings->StaticChannelArray[i];
|
2016-08-04 17:13:37 +03:00
|
|
|
|
2021-07-28 17:27:59 +03:00
|
|
|
if (!freerdp_client_load_static_channel_addin(channels, settings, _args->argv[0], _args))
|
2016-02-01 17:09:51 +03:00
|
|
|
return FALSE;
|
2012-11-21 04:34:52 +04:00
|
|
|
}
|
|
|
|
|
2022-03-24 13:07:11 +03:00
|
|
|
if (freerdp_settings_get_uint32(settings, FreeRDP_DynamicChannelCount) > 0)
|
|
|
|
{
|
|
|
|
if (!freerdp_settings_set_bool(settings, FreeRDP_SupportDynamicChannels, TRUE))
|
|
|
|
return FALSE;
|
|
|
|
}
|
2014-08-15 03:23:48 +04:00
|
|
|
|
2022-03-24 13:07:11 +03:00
|
|
|
if (freerdp_settings_get_bool(settings, FreeRDP_SupportDynamicChannels))
|
2012-11-19 02:32:18 +04:00
|
|
|
{
|
2021-08-25 11:02:46 +03:00
|
|
|
if (!freerdp_client_load_static_channel_addin(channels, settings, DRDYNVC_SVC_CHANNEL_NAME,
|
|
|
|
settings))
|
2016-02-01 17:09:51 +03:00
|
|
|
return FALSE;
|
2012-11-19 02:32:18 +04:00
|
|
|
}
|
|
|
|
|
2016-02-01 17:09:51 +03:00
|
|
|
return TRUE;
|
2012-11-09 04:01:52 +04:00
|
|
|
}
|