[gtk-vnc-devel] [patch] Signal for unsupported auth method
- From: Jonh Wendell <jwendell gnome org>
- To: gtk-vnc-devel List <gtk-vnc-devel lists sourceforge net>
- Subject: [gtk-vnc-devel] [patch] Signal for unsupported auth method
- Date: Wed, 03 Oct 2007 11:55:52 -0300
Hi, folks.
I've made that patch in order to use it on vinagre. The user gets a
message when the server reports an auth type not supported by gtk-vnc.
In my tests with vinagre, it worked as expected.
Ok to commit?
--
Jonh Wendell
jonh wendell gmail com (MSN / Google Talk)
Linux User #114432
https://launchpad.net/~wendell
diff -r 082f2cb50661 src/gvnc.c
--- a/src/gvnc.c Tue Oct 02 17:57:50 2007 -0300
+++ b/src/gvnc.c Wed Oct 03 11:50:43 2007 -0300
@@ -1771,7 +1771,7 @@ static gboolean gvnc_perform_auth(struct
}
for (i = 0 ; i < nauth ; i++) {
- GVNC_DEBUG("Possible auth %d\n", auth[i]);
+ GVNC_DEBUG("Possible auth %u\n", auth[i]);
}
if (gvnc->has_error || !gvnc->ops.auth_type)
@@ -1787,7 +1787,7 @@ static gboolean gvnc_perform_auth(struct
if (gvnc->has_error)
return FALSE;
- GVNC_DEBUG("Choose auth %d\n", gvnc->auth_type);
+ GVNC_DEBUG("Choose auth %u\n", gvnc->auth_type);
if (!gvnc_gather_credentials(gvnc))
return FALSE;
@@ -1813,6 +1813,10 @@ static gboolean gvnc_perform_auth(struct
return gvnc_perform_auth_vencrypt(gvnc);
default:
+ if (gvnc->ops.auth_unsupported)
+ gvnc->ops.auth_unsupported (gvnc->ops_data, gvnc->auth_type);
+ gvnc->has_error = TRUE;
+
return FALSE;
}
@@ -2096,7 +2100,7 @@ gboolean gvnc_open_host(struct gvnc *gvn
gboolean gvnc_set_auth_type(struct gvnc *gvnc, unsigned int type)
{
- GVNC_DEBUG("Requested auth type %d\n", type);
+ GVNC_DEBUG("Requested auth type %u\n", type);
if (gvnc->auth_type != GVNC_AUTH_INVALID) {
gvnc->has_error = TRUE;
return !gvnc_has_error(gvnc);
@@ -2105,6 +2109,9 @@ gboolean gvnc_set_auth_type(struct gvnc
type != GVNC_AUTH_VNC &&
type != GVNC_AUTH_TLS &&
type != GVNC_AUTH_VENCRYPT) {
+ if (gvnc->ops.auth_unsupported)
+ gvnc->ops.auth_unsupported (gvnc->ops_data, type);
+
gvnc->has_error = TRUE;
return !gvnc_has_error(gvnc);
}
diff -r 082f2cb50661 src/gvnc.h
--- a/src/gvnc.h Tue Oct 02 17:57:50 2007 -0300
+++ b/src/gvnc.h Wed Oct 03 11:50:43 2007 -0300
@@ -20,6 +20,7 @@ struct gvnc_ops
gboolean (*pointer_type_change)(void *, int);
gboolean (*shared_memory_rmid)(void *, int);
gboolean (*local_cursor)(void *, int, int, int, int, uint8_t *);
+ gboolean (*auth_unsupported)(void *, unsigned int);
};
struct gvnc_pixel_format
diff -r 082f2cb50661 src/vncdisplay.c
--- a/src/vncdisplay.c Tue Oct 02 17:57:50 2007 -0300
+++ b/src/vncdisplay.c Wed Oct 03 11:50:43 2007 -0300
@@ -76,13 +76,14 @@ typedef enum
VNC_DESKTOP_RESIZE,
VNC_AUTH_FAILURE,
+ VNC_AUTH_UNSUPPORTED,
LAST_SIGNAL
} vnc_display_signals;
static guint signals[LAST_SIGNAL] = { 0, 0, 0, 0,
0, 0, 0, 0,
- 0, 0, };
+ 0, 0, 0, };
static GParamSpec *signalCredParam;
GtkWidget *vnc_display_new(void)
@@ -602,6 +603,18 @@ static gboolean on_auth_failure(void *op
return TRUE;
}
+static gboolean on_auth_unsupported(void *opaque, unsigned int auth_type)
+{
+ VncDisplay *obj = VNC_DISPLAY(opaque);
+
+ g_signal_emit (G_OBJECT (obj),
+ signals[VNC_AUTH_UNSUPPORTED],
+ 0,
+ auth_type);
+
+ return TRUE;
+}
+
static gboolean on_local_cursor(void *opaque, int x, int y, int width, int height, uint8_t *image)
{
VncDisplay *obj = VNC_DISPLAY(opaque);
@@ -643,6 +656,7 @@ static const struct gvnc_ops vnc_display
.pointer_type_change = on_pointer_type_change,
.shared_memory_rmid = on_shared_memory_rmid,
.local_cursor = on_local_cursor,
+ .auth_unsupported = on_auth_unsupported
};
static void *vnc_coroutine(void *opaque)
@@ -948,6 +962,18 @@ static void vnc_display_class_init(VncDi
G_TYPE_NONE,
1,
G_TYPE_STRING);
+
+ signals[VNC_AUTH_UNSUPPORTED] =
+ g_signal_new("vnc-auth-unsupported",
+ G_TYPE_FROM_CLASS(klass),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_NO_HOOKS,
+ 0,
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__UINT,
+ G_TYPE_NONE,
+ 1,
+ G_TYPE_UINT);
g_type_class_add_private(klass, sizeof(VncDisplayPrivate));
}
[Date Prev][
Date Next] [Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]