GUAC-346: Add support for specifying the client hostname.

This commit is contained in:
Michael Jumper 2015-04-14 12:39:08 -07:00
parent 358d41e277
commit be0e1d9b12
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-dir",
"remote-app-args", "remote-app-args",
"static-channels", "static-channels",
"client-name",
NULL NULL
}; };
@ -144,6 +145,7 @@ enum RDP_ARGS_IDX {
IDX_REMOTE_APP_DIR, IDX_REMOTE_APP_DIR,
IDX_REMOTE_APP_ARGS, IDX_REMOTE_APP_ARGS,
IDX_STATIC_CHANNELS, IDX_STATIC_CHANNELS,
IDX_CLIENT_NAME,
RDP_ARGS_COUNT RDP_ARGS_COUNT
}; };
@ -666,6 +668,11 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
if (argv[IDX_PASSWORD][0] != '\0') if (argv[IDX_PASSWORD][0] != '\0')
settings->password = strdup(argv[IDX_PASSWORD]); 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 */ /* Initial program */
settings->initial_program = NULL; settings->initial_program = NULL;
if (argv[IDX_INITIAL_PROGRAM][0] != '\0') if (argv[IDX_INITIAL_PROGRAM][0] != '\0')

View File

@ -33,6 +33,7 @@
#endif #endif
#include <stddef.h> #include <stddef.h>
#include <string.h>
int guac_rdp_get_width(freerdp* rdp) { int guac_rdp_get_width(freerdp* rdp) {
#ifdef LEGACY_RDPSETTINGS #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; rdp_settings->KeyboardLayout = guac_settings->server_layout->freerdp_keyboard_layout;
#endif #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 */ /* Console */
#ifdef LEGACY_RDPSETTINGS #ifdef LEGACY_RDPSETTINGS
rdp_settings->console_session = guac_settings->console; rdp_settings->console_session = guac_settings->console;

View File

@ -30,6 +30,12 @@
#include <freerdp/freerdp.h> #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. * The default RDP port.
*/ */
@ -169,6 +175,12 @@ typedef struct guac_rdp_settings {
*/ */
char* initial_program; 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. * The type of security to use for the connection.
*/ */