[PATCH 05/18] Move ticketing_enabled to RedsState struct

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Jonathon Jongsma <jjongsma@xxxxxxxxxx>

Removing more global variables
---
 server/reds-private.h |  1 +
 server/reds.c         | 10 +++++-----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/server/reds-private.h b/server/reds-private.h
index bc790e8..c76f3b0 100644
--- a/server/reds-private.h
+++ b/server/reds-private.h
@@ -215,6 +215,7 @@ struct RedsState {
     bool spice_uuid_is_set;
     uint8_t spice_uuid[16];
 
+    int ticketing_enabled;
     SpiceImageCompression image_compression;
     spice_wan_compression_t jpeg_state;
 };
diff --git a/server/reds.c b/server/reds.c
index 2e24c0e..4de7b60 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -144,7 +144,6 @@ static SpiceCoreInterfaceInternal core_interface_adapter = {
 #define REDS_TOKENS_TO_SEND 5
 #define REDS_VDI_PORT_NUM_RECEIVE_BUFFS 5
 
-static int ticketing_enabled = 1; //Ticketing is enabled by default
 static pthread_mutex_t *lock_cs;
 static long *lock_count;
 uint32_t streaming_video = SPICE_STREAM_VIDEO_FILTER;
@@ -1938,7 +1937,7 @@ static void reds_handle_ticket(void *opaque)
     }
     password[password_size] = '\0';
 
-    if (ticketing_enabled && !link->skip_auth) {
+    if (reds->ticketing_enabled && !link->skip_auth) {
         int expired =  reds->taTicket.expiration_time < ltime;
 
         if (strlen(reds->taTicket.password) == 0) {
@@ -2764,7 +2763,7 @@ static void reds_exit(void)
 
 static inline void on_activating_ticketing(RedsState *reds)
 {
-    if (!ticketing_enabled && reds_main_channel_connected(reds)) {
+    if (!reds->ticketing_enabled && reds_main_channel_connected(reds)) {
         spice_warning("disconnecting");
         reds_disconnect(reds);
     }
@@ -3426,6 +3425,7 @@ SPICE_GNUC_VISIBLE SpiceServer *spice_server_new(void)
 #endif
     reds->spice_uuid_is_set = FALSE;
     memset(reds->spice_uuid, 0, sizeof(reds->spice_uuid));
+    reds->ticketing_enabled = TRUE; /* ticketing enabled by default */
     reds->image_compression = SPICE_IMAGE_COMPRESSION_AUTO_GLZ;
     reds->jpeg_state = SPICE_WAN_COMPRESSION_AUTO;
     return reds;
@@ -3548,7 +3548,7 @@ SPICE_GNUC_VISIBLE int spice_server_set_noauth(SpiceServer *s)
 {
     spice_assert(reds == s);
     memset(s->taTicket.password, 0, sizeof(s->taTicket.password));
-    ticketing_enabled = 0;
+    s->ticketing_enabled = 0;
     return 0;
 }
 
@@ -3602,7 +3602,7 @@ SPICE_GNUC_VISIBLE int spice_server_set_ticket(SpiceServer *reds,
     }
 
     on_activating_ticketing(reds);
-    ticketing_enabled = 1;
+    reds->ticketing_enabled = 1;
     if (lifetime == 0) {
         reds->taTicket.expiration_time = INT_MAX;
     } else {
-- 
2.4.3

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]