diff options
Diffstat (limited to 'plugins/mcp-dbus-aegis-acl.c')
-rw-r--r-- | plugins/mcp-dbus-aegis-acl.c | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/plugins/mcp-dbus-aegis-acl.c b/plugins/mcp-dbus-aegis-acl.c index e53ca8bc..ad2ad3cd 100644 --- a/plugins/mcp-dbus-aegis-acl.c +++ b/plugins/mcp-dbus-aegis-acl.c @@ -27,6 +27,7 @@ #define CREATE_CHANNEL TP_IFACE_CONNECTION_INTERFACE_REQUESTS ".CreateChannel" #define ENSURE_CHANNEL TP_IFACE_CONNECTION_INTERFACE_REQUESTS ".EnsureChannel" +#define SEND_MESSAGE TP_IFACE_CHANNEL_DISPATCHER ".Interface.Messages.DRAFT" #define AEGIS_CALL_TOKEN "Cellular" @@ -42,6 +43,14 @@ static gboolean token_initialised = FALSE; static creds_value_t aegis_token = CREDS_BAD; static creds_type_t aegis_type = CREDS_BAD; +static gchar *restricted[] = + { + CREATE_CHANNEL, + ENSURE_CHANNEL, + SEND_MESSAGE, + NULL + }; + static void dbus_acl_iface_init (McpDBusAclIface *, gpointer); @@ -79,7 +88,22 @@ dbus_aegis_acl_class_init (DBusAegisAclClass *cls) aegis_type = creds_str2creds (AEGIS_CALL_TOKEN, &aegis_token); } -static gboolean is_filtered (DBusAclType type, +static gboolean +method_is_filtered (const gchar *method) +{ + guint i; + + for (i = 0; restricted[i] != NULL; i++) + { + if (!tp_strdiff (method, restricted[i])) + return TRUE; + } + + return FALSE; +} + +static gboolean +is_filtered (DBusAclType type, const gchar *name, const GHashTable *params) { @@ -90,9 +114,8 @@ static gboolean is_filtered (DBusAclType type, if (type != DBUS_ACL_TYPE_METHOD) return FALSE; - /* only create/ensure channel concern us*/ - if (!g_str_equal (name, CREATE_CHANNEL) && - !g_str_equal (name, ENSURE_CHANNEL)) + /* only create/ensure channel concern us (and send message, now): */ + if (!method_is_filtered (name)) return FALSE; /* must have at least the account-path to check */ |