summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2009-07-27 22:00:51 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2010-02-22 15:16:49 +0000
commitfc0009487dd166ef76edb1923f471e6cd65aa70b (patch)
tree5ddf9444b7b44a11a4c6ba806c2f9f4621c66f71
parent529c332a1d005dc1ea33a9eee5d09e2e3d34c7cd (diff)
fd.o#22968: GibberUnixTransport: make credential-passing support optional and detectable
Our implementation only works for Linux so far, so we need to be able to avoid advertising credential-passing on e.g. Darwin.
-rw-r--r--lib/gibber/gibber-unix-transport.c47
-rw-r--r--lib/gibber/gibber-unix-transport.h2
2 files changed, 49 insertions, 0 deletions
diff --git a/lib/gibber/gibber-unix-transport.c b/lib/gibber/gibber-unix-transport.c
index 244f4683f..7c800d8c0 100644
--- a/lib/gibber/gibber-unix-transport.c
+++ b/lib/gibber/gibber-unix-transport.c
@@ -194,6 +194,17 @@ gibber_unix_transport_new_from_fd (int fd)
return transport;
}
+/* Patches that reimplement these functions for non-Linux would be welcome
+ * (please file a bug) */
+
+#if defined(__linux__)
+
+gboolean
+gibber_unix_transport_supports_credentials (void)
+{
+ return TRUE;
+}
+
gboolean
gibber_unix_transport_send_credentials (GibberUnixTransport *transport,
const guint8 *data,
@@ -356,3 +367,39 @@ gibber_unix_transport_recv_credentials (GibberUnixTransport *self,
priv->recv_creds_data = user_data;
return TRUE;
}
+
+#else /* OSs where we have no implementation */
+
+gboolean
+gibber_unix_transport_supports_credentials (void)
+{
+ return FALSE;
+}
+
+gboolean
+gibber_unix_transport_recv_credentials (GibberUnixTransport *self,
+ GibberUnixTransportRecvCredentialsCb callback,
+ gpointer user_data)
+{
+ DEBUG ("stub implementation, failing");
+ return FALSE;
+}
+
+gboolean
+gibber_unix_transport_send_credentials (GibberUnixTransport *transport,
+ const guint8 *data,
+ gsize size)
+{
+ DEBUG ("stub implementation, failing");
+ return FALSE;
+}
+
+static GibberFdIOResult
+gibber_unix_transport_read (GibberFdTransport *transport,
+ GIOChannel *channel,
+ GError **error)
+{
+ return gibber_fd_transport_read (transport, channel, error);
+}
+
+#endif
diff --git a/lib/gibber/gibber-unix-transport.h b/lib/gibber/gibber-unix-transport.h
index b89a0dd5f..3aad8d476 100644
--- a/lib/gibber/gibber-unix-transport.h
+++ b/lib/gibber/gibber-unix-transport.h
@@ -79,6 +79,8 @@ GType gibber_unix_transport_get_type (void);
(G_TYPE_INSTANCE_GET_CLASS ((obj), GIBBER_TYPE_UNIX_TRANSPORT, \
GibberUnixTransportClass))
+gboolean gibber_unix_transport_supports_credentials (void);
+
GibberUnixTransport * gibber_unix_transport_new (void);
GibberUnixTransport * gibber_unix_transport_new_from_fd (int fd);