diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2012-03-02 13:45:15 +0100 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2012-03-05 18:19:07 +0100 |
commit | 36d8da628380e7a63df893846f96ee608b2e1af8 (patch) | |
tree | 4503e1737ec75f895f7aee1561ca166087939d52 /server/reds.c | |
parent | f0ff2e383efba62e4f0368facd855d54ae915821 (diff) | |
download | spice-36d8da628380e7a63df893846f96ee608b2e1af8.tar.gz spice-36d8da628380e7a63df893846f96ee608b2e1af8.tar.xz spice-36d8da628380e7a63df893846f96ee608b2e1af8.zip |
Send name & uuid to capable clients
Add spice_server_set_name() and spice_server_set_uuid() that allows
the client to identify a Spice server (useful to associate settings
with a particular server)
The SPICE_MSG_MAIN_NAME and SPICE_MSG_MAIN_UUID messages are only sent
to capable clients, announcing SPICE_MAIN_CAP_NAME_AND_UUID.
Diffstat (limited to 'server/reds.c')
-rw-r--r-- | server/reds.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/server/reds.c b/server/reds.c index 9d7521a7..5fc03ea2 100644 --- a/server/reds.c +++ b/server/reds.c @@ -35,6 +35,7 @@ #include <fcntl.h> #include <errno.h> #include <ctype.h> +#include <stdbool.h> #include <openssl/bio.h> #include <openssl/pem.h> @@ -100,6 +101,9 @@ static int sasl_enabled = 0; // sasl disabled by default #if HAVE_SASL static char *sasl_appname = NULL; // default to "spice" if NULL #endif +static char *spice_name = NULL; +static bool spice_uuid_is_set = FALSE; +static uint8_t spice_uuid[16] = { 0, }; static int ticketing_enabled = 1; //Ticketing is enabled by default static pthread_mutex_t *lock_cs; @@ -1668,6 +1672,10 @@ static void reds_handle_main_link(RedLinkInfo *link) reds->mouse_mode, reds->is_client_mouse_allowed, reds_get_mm_time() - MM_TIME_DELTA, red_dispatcher_qxl_ram_size()); + if (spice_name) + main_channel_push_name(mcc, spice_name); + if (spice_uuid_is_set) + main_channel_push_uuid(mcc, spice_uuid); main_channel_client_start_net_test(mcc); /* Now that we have a client, forward any pending agent data */ @@ -3810,6 +3818,18 @@ SPICE_GNUC_VISIBLE int spice_server_set_sasl_appname(SpiceServer *s, const char #endif } +SPICE_GNUC_VISIBLE void spice_server_set_name(SpiceServer *s, const char *name) +{ + free(spice_name); + spice_name = strdup(name); +} + +SPICE_GNUC_VISIBLE void spice_server_set_uuid(SpiceServer *s, const uint8_t uuid[16]) +{ + memcpy(spice_uuid, uuid, sizeof(spice_uuid)); + spice_uuid_is_set = TRUE; +} + SPICE_GNUC_VISIBLE int spice_server_set_ticket(SpiceServer *s, const char *passwd, int lifetime, int fail_if_connected, |