summaryrefslogtreecommitdiff
path: root/lib/ephy-dbus-util.c
diff options
context:
space:
mode:
authorMichael Catanzaro <mcatanzaro@igalia.com>2016-02-07 21:35:02 -0600
committerMichael Catanzaro <mcatanzaro@igalia.com>2016-02-08 13:53:38 -0600
commitb8b391393aca52274063653b2d6e4b3c00e960fd (patch)
tree04bfd33858c1fc66ac4d2d98f582c0f81c942ad5 /lib/ephy-dbus-util.c
parent36272511be7e9c54ce35bf54ec4980d4a403d43e (diff)
downloadepiphany-b8b391393aca52274063653b2d6e4b3c00e960fd.tar.gz
Switch web extensions to using private D-Bus connections
Instead of using the session bus. There's no point in advertising the web extension D-Bus interface as if it could be meaningfully used by anything other than the Epiphany UI process. EphyEmbedShell will run the D-Bus server, and the web extensions will connect to it. https://bugzilla.gnome.org/show_bug.cgi?id=761009
Diffstat (limited to 'lib/ephy-dbus-util.c')
-rw-r--r--lib/ephy-dbus-util.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/lib/ephy-dbus-util.c b/lib/ephy-dbus-util.c
new file mode 100644
index 000000000..961c805b0
--- /dev/null
+++ b/lib/ephy-dbus-util.c
@@ -0,0 +1,37 @@
+/*
+ * Copyright © 2016 Igalia S.L.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "ephy-dbus-util.h"
+
+gboolean
+ephy_dbus_peer_is_authorized (GCredentials *peer_credentials)
+{
+ static GCredentials *own_credentials = NULL;
+ GError *error = NULL;
+
+ if (!own_credentials)
+ own_credentials = g_credentials_new ();
+
+ if (peer_credentials && g_credentials_is_same_user (peer_credentials, own_credentials, &error))
+ return TRUE;
+
+ if (error) {
+ g_warning ("Failed to authorize web extension connection: %s", error->message);
+ g_error_free (error);
+ }
+ return FALSE;
+}