Merge pull request #35 from glyptodon/client-name

GUAC-346: Add support for specifying the client hostname.
This commit is contained in:
James Muehlner 2015-04-14 14:02:30 -07:00
commit bd22c6e383
3 changed files with 31 additions and 0 deletions

View File

@ -115,6 +115,7 @@ const char* GUAC_CLIENT_ARGS[] = {
"remote-app-dir",
"remote-app-args",
"static-channels",
"client-name",
NULL
};
@ -144,6 +145,7 @@ enum RDP_ARGS_IDX {
IDX_REMOTE_APP_DIR,
IDX_REMOTE_APP_ARGS,
IDX_STATIC_CHANNELS,
IDX_CLIENT_NAME,
RDP_ARGS_COUNT
};
@ -666,6 +668,11 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
if (argv[IDX_PASSWORD][0] != '\0')
settings->password = strdup(argv[IDX_PASSWORD]);
/* Client name */
settings->client_name = NULL;
if (argv[IDX_CLIENT_NAME][0] != '\0')
settings->client_name = strdup(argv[IDX_CLIENT_NAME]);
/* Initial program */
settings->initial_program = NULL;
if (argv[IDX_INITIAL_PROGRAM][0] != '\0')

View File

@ -33,6 +33,7 @@
#endif
#include <stddef.h>
#include <string.h>
int guac_rdp_get_width(freerdp* rdp) {
#ifdef LEGACY_RDPSETTINGS
@ -98,6 +99,17 @@ void guac_rdp_push_settings(guac_rdp_settings* guac_settings, freerdp* rdp) {
rdp_settings->KeyboardLayout = guac_settings->server_layout->freerdp_keyboard_layout;
#endif
/* Client name */
if (guac_settings->client_name != NULL) {
#ifdef LEGACY_RDPSETTINGS
strncpy(rdp_settings->client_hostname, guac_settings->client_name,
RDP_CLIENT_HOSTNAME_SIZE - 1);
#else
strncpy(rdp_settings->ClientHostname, guac_settings->client_name,
RDP_CLIENT_HOSTNAME_SIZE - 1);
#endif
}
/* Console */
#ifdef LEGACY_RDPSETTINGS
rdp_settings->console_session = guac_settings->console;

View File

@ -30,6 +30,12 @@
#include <freerdp/freerdp.h>
/**
* The maximum number of bytes in the client hostname claimed during
* connection.
*/
#define RDP_CLIENT_HOSTNAME_SIZE 32
/**
* The default RDP port.
*/
@ -169,6 +175,12 @@ typedef struct guac_rdp_settings {
*/
char* initial_program;
/**
* The name of the client to submit to the RDP server upon connection, or
* NULL if the name is not specified.
*/
char* client_name;
/**
* The type of security to use for the connection.
*/