[gtk-vnc] Clear out more fields when closing a vnc connection
- From: Daniel P. Berrange <dberrange src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-vnc] Clear out more fields when closing a vnc connection
- Date: Thu, 28 Oct 2010 15:40:58 +0000 (UTC)
commit 612db9c8d3a0ae0025117f2adb28eb469952e3c0
Author: Daniel P. Berrange <berrange redhat com>
Date: Mon Oct 25 12:28:07 2010 +0100
Clear out more fields when closing a vnc connection
Be more paranoid about reseting internal fields when closing
a VNC connection, to prevent surprises when reconnecting
* src/vncconnection.c: Clear out more fields when closing
a connection
src/vncconnection.c | 21 +++++++++++++++++++--
1 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/src/vncconnection.c b/src/vncconnection.c
index 009b30a..571cb3a 100644
--- a/src/vncconnection.c
+++ b/src/vncconnection.c
@@ -4360,8 +4360,11 @@ static void vnc_connection_close(VncConnection *conn)
priv->tls_session = NULL;
}
#if HAVE_SASL
- if (priv->saslconn)
+ if (priv->saslconn) {
sasl_dispose (&priv->saslconn);
+ priv->saslconn = NULL;
+ priv->saslDecodedOffset = priv->saslDecodedLength = 0;
+ }
#endif
if (priv->sock) {
@@ -4393,6 +4396,14 @@ static void vnc_connection_close(VncConnection *conn)
priv->xmit_buffer_capacity = 0;
}
+ priv->read_offset = priv->read_size = 0;
+ priv->write_offset = 0;
+ priv->uncompressed_length = 0;
+ priv->compressed_length = 0;
+
+ priv->width = priv->height = 0;
+ priv->major = priv->minor = 0;
+
if (priv->cred_username) {
g_free(priv->cred_username);
priv->cred_username = NULL;
@@ -4419,13 +4430,19 @@ static void vnc_connection_close(VncConnection *conn)
priv->cred_x509_key = NULL;
}
+ priv->want_cred_x509 = priv->want_cred_username =
+ priv->want_cred_password = FALSE;
+
for (i = 0; i < 5; i++)
inflateEnd(&priv->streams[i]);
priv->auth_type = VNC_CONNECTION_AUTH_INVALID;
priv->auth_subtype = VNC_CONNECTION_AUTH_INVALID;
priv->sharedFlag = FALSE;
- priv->has_error = 0;
+
+ memset(&priv->fmt, 0, sizeof(priv->fmt));
+
+ priv->has_error = FALSE;
}
void vnc_connection_shutdown(VncConnection *conn)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]