diff options
author | Vivek Dasmohapatra <vivek@collabora.co.uk> | 2011-04-01 14:34:28 +0100 |
---|---|---|
committer | Vivek Dasmohapatra <vivek@collabora.co.uk> | 2011-04-05 14:19:11 +0100 |
commit | 46fd73820ee21652c815205d6e3d6f6538c538b6 (patch) | |
tree | 1cfd1a4087996a5cb25ed41c739699bf3fd14505 | |
parent | 409f6fa7427b51aed3ebbe9c349f5799de493928 (diff) | |
download | telepathy-mission-control-46fd73820ee21652c815205d6e3d6f6538c538b6.tar.gz |
Update the libcreds/cellular ACL to include the new message API call
-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 */ |