summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--gst/librfb/rfbdecoder.c50
-rw-r--r--gst/librfb/rfbdecoder.h6
3 files changed, 55 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 67d3eb98..a28ec9e1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-09-18 Thijs Vermeir <thijsvermeir@gmail.com>
+
+ * gst/librfb/rfbdecoder.c:
+ * gst/librfb/rfbdecoder.h:
+ Added some documentation about security handling
+ start implementing security handling for rfb 3.3
+
2007-09-18 Stefan Kost <ensonic@users.sf.net>
* gst/spectrum/demo-audiotest.c:
diff --git a/gst/librfb/rfbdecoder.c b/gst/librfb/rfbdecoder.c
index 19d051b1..eedfefce 100644
--- a/gst/librfb/rfbdecoder.c
+++ b/gst/librfb/rfbdecoder.c
@@ -253,21 +253,55 @@ rfb_decoder_state_wait_for_protocol_version (RfbDecoder * decoder)
return TRUE;
}
+/**
+ * a string describing the reason (where a string is specified as a length followed
+ * by that many ASCII characters)
+ **/
+static gboolean
+rfb_decoder_state_reason (RfbDecoder * decoder)
+{
+ /* \TODO Read the reason from the server why he quits */
+ return TRUE;
+}
+
static gboolean
rfb_decoder_state_wait_for_security (RfbDecoder * decoder)
{
RfbBuffer *buffer;
gint ret;
- ret = rfb_bytestream_read (decoder->bytestream, &buffer, 4);
- if (ret < 4)
- return FALSE;
-
- decoder->security_type = RFB_GET_UINT32 (buffer->data);
- // g_print ("security = %d\n", decoder->security_type);
-
- rfb_buffer_free (buffer);
+ /**
+ * Version 3.3 The server decides the security type and sends a single word
+ *
+ * The security-type may only take the value 0, 1 or 2. A value of 0 means that the
+ * connection has failed and is followed by a string giving the reason, as described
+ * above.
+ */
+ if (decoder->protocol_major == 3 && decoder->protocol_minor == 3) {
+ ret = rfb_bytestream_read (decoder->bytestream, &buffer, 4);
+ if (ret < 4)
+ return FALSE;
+
+ decoder->security_type = RFB_GET_UINT32 (buffer->data);
+ GST_DEBUG ("security = %d", decoder->security_type);
+
+ g_return_val_if_fail (decoder->security_type < 3, FALSE);
+ g_return_val_if_fail (decoder->security_type != SECURITY_FAIL,
+ rfb_decoder_state_reason (decoder));
+ rfb_buffer_free (buffer);
+ }
+ switch (decoder->security_type) {
+ case SECURITY_NONE:
+ GST_DEBUG ("Security type is None");
+ break;
+ case SECURITY_VNC:
+ GST_DEBUG ("Security type is VNC Authentication");
+ /* \TODO Check if for the correct password */
+ break;
+ default:
+ break;
+ }
decoder->state = rfb_decoder_state_send_client_initialisation;
return TRUE;
}
diff --git a/gst/librfb/rfbdecoder.h b/gst/librfb/rfbdecoder.h
index 193e7995..1a0c2831 100644
--- a/gst/librfb/rfbdecoder.h
+++ b/gst/librfb/rfbdecoder.h
@@ -6,6 +6,12 @@
G_BEGIN_DECLS
+enum {
+ SECURITY_FAIL = 0,
+ SECURITY_NONE,
+ SECURITY_VNC,
+};
+
typedef struct _RfbDecoder RfbDecoder;
struct _RfbDecoder