summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathon Jongsma <jjongsma@redhat.com>2015-01-27 13:41:33 -0600
committerFabiano FidĂȘncio <fidencio@redhat.com>2015-02-23 23:00:45 +0100
commit65f08cc5f9b7998ff893fcbd2a140215bac9e287 (patch)
treea575f106fafec0a64085b3c855a54e20e4d062a7
parenta86a36a45f0ab251d5e5003f14130f828aee17e3 (diff)
downloadspice-65f08cc5f9b7998ff893fcbd2a140215bac9e287.tar.gz
spice-65f08cc5f9b7998ff893fcbd2a140215bac9e287.tar.xz
spice-65f08cc5f9b7998ff893fcbd2a140215bac9e287.zip
Move taTicket to RedsState struct
Removing more global variables
-rw-r--r--server/reds-private.h2
-rw-r--r--server/reds.c20
2 files changed, 11 insertions, 11 deletions
diff --git a/server/reds-private.h b/server/reds-private.h
index b7b57932..8435d03e 100644
--- a/server/reds-private.h
+++ b/server/reds-private.h
@@ -189,6 +189,8 @@ struct RedsState {
int spice_listen_socket_fd;
char spice_addr[256];
int spice_family;
+ TicketAuthentication taTicket;
+
};
#endif
diff --git a/server/reds.c b/server/reds.c
index 2b6602fa..6da85813 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -89,8 +89,6 @@ SpiceCoreInterface *core = NULL;
#define REDS_TOKENS_TO_SEND 5
#define REDS_VDI_PORT_NUM_RECEIVE_BUFFS 5
-static TicketAuthentication taTicket;
-
static int sasl_enabled = 0; // sasl disabled by default
#if HAVE_SASL
static char *sasl_appname = NULL; // default to "spice" if NULL
@@ -1883,15 +1881,15 @@ static void reds_handle_ticket(void *opaque)
password[password_size] = '\0';
if (ticketing_enabled && !link->skip_auth) {
- int expired = taTicket.expiration_time < ltime;
+ int expired = reds->taTicket.expiration_time < ltime;
- if (strlen(taTicket.password) == 0) {
+ if (strlen(reds->taTicket.password) == 0) {
spice_warning("Ticketing is enabled, but no password is set. "
"please set a ticket first");
goto error;
}
- if (expired || strcmp(password, taTicket.password) != 0) {
+ if (expired || strcmp(password, reds->taTicket.password) != 0) {
if (expired) {
spice_warning("Ticket has expired");
} else {
@@ -3437,7 +3435,7 @@ SPICE_GNUC_VISIBLE int spice_server_set_exit_on_disconnect(SpiceServer *s, int f
SPICE_GNUC_VISIBLE int spice_server_set_noauth(SpiceServer *s)
{
spice_assert(reds == s);
- memset(taTicket.password, 0, sizeof(taTicket.password));
+ memset(s->taTicket.password, 0, sizeof(s->taTicket.password));
ticketing_enabled = 0;
return 0;
}
@@ -3496,16 +3494,16 @@ SPICE_GNUC_VISIBLE int spice_server_set_ticket(SpiceServer *s,
on_activating_ticketing(s);
ticketing_enabled = 1;
if (lifetime == 0) {
- taTicket.expiration_time = INT_MAX;
+ s->taTicket.expiration_time = INT_MAX;
} else {
time_t now = time(NULL);
- taTicket.expiration_time = now + lifetime;
+ s->taTicket.expiration_time = now + lifetime;
}
if (passwd != NULL) {
- g_strlcpy(taTicket.password, passwd, sizeof(taTicket.password));
+ g_strlcpy(s->taTicket.password, passwd, sizeof(s->taTicket.password));
} else {
- memset(taTicket.password, 0, sizeof(taTicket.password));
- taTicket.expiration_time = 0;
+ memset(s->taTicket.password, 0, sizeof(s->taTicket.password));
+ s->taTicket.expiration_time = 0;
}
return 0;
}