| Index: src/manager.c
|
| diff --git a/src/manager.c b/src/manager.c
|
| index e0801ab097f1c77aebd3c8ed284f614ff9b65852..e14701ad14b78a2577c8a285353e48cedf0cf19e 100644
|
| --- a/src/manager.c
|
| +++ b/src/manager.c
|
| @@ -173,12 +173,6 @@ static DBusMessage *set_property(DBusConnection *conn,
|
| __connman_profile_set_offlinemode(offlinemode);
|
|
|
| __connman_profile_save_default();
|
| - } else if (g_str_equal(name, "ActiveProfile") == TRUE) {
|
| - const char *str;
|
| -
|
| - dbus_message_iter_get_basic(&value, &str);
|
| -
|
| - return __connman_error_not_supported(msg);
|
| } else
|
| return __connman_error_invalid_property(msg);
|
|
|
| @@ -227,25 +221,84 @@ static DBusMessage *create_profile(DBusConnection *conn,
|
| static DBusMessage *remove_profile(DBusConnection *conn,
|
| DBusMessage *msg, void *data)
|
| {
|
| - const char *path;
|
| + const char *ident;
|
| int err;
|
|
|
| _DBG_MANAGER("conn %p", conn);
|
|
|
| - dbus_message_get_args(msg, NULL, DBUS_TYPE_OBJECT_PATH, &path,
|
| + dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &ident,
|
| + DBUS_TYPE_INVALID);
|
| +
|
| + if (__connman_security_check_privilege(msg,
|
| + CONNMAN_SECURITY_PRIVILEGE_MODIFY) < 0)
|
| + return __connman_error_permission_denied(msg);
|
| +
|
| + err = __connman_profile_remove(ident);
|
| + if (err < 0)
|
| + return __connman_error_failed(msg, -err);
|
| +
|
| + return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
|
| +}
|
| +
|
| +static DBusMessage *push_profile(DBusConnection *conn,
|
| + DBusMessage *msg, void *data)
|
| +{
|
| + const char *ident, *path;
|
| + int err;
|
| +
|
| + _DBG_MANAGER("conn %p", conn);
|
| +
|
| + dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &ident,
|
| + DBUS_TYPE_INVALID);
|
| +
|
| + if (__connman_security_check_privilege(msg,
|
| + CONNMAN_SECURITY_PRIVILEGE_MODIFY) < 0)
|
| + return __connman_error_permission_denied(msg);
|
| +
|
| + err = __connman_profile_push(ident, NULL, &path);
|
| + if (err < 0)
|
| + return __connman_error_failed(msg, -err);
|
| +
|
| + return g_dbus_create_reply(msg, DBUS_TYPE_OBJECT_PATH, &path,
|
| DBUS_TYPE_INVALID);
|
| +}
|
| +
|
| +static DBusMessage *__pop_profile(DBusMessage *msg, const char *ident)
|
| +{
|
| + int err;
|
|
|
| if (__connman_security_check_privilege(msg,
|
| CONNMAN_SECURITY_PRIVILEGE_MODIFY) < 0)
|
| return __connman_error_permission_denied(msg);
|
|
|
| - err = __connman_profile_remove(path);
|
| + err = __connman_profile_pop(ident);
|
| if (err < 0)
|
| return __connman_error_failed(msg, -err);
|
|
|
| return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
|
| }
|
|
|
| +static DBusMessage *pop_profile(DBusConnection *conn,
|
| + DBusMessage *msg, void *data)
|
| +{
|
| + const char *ident;
|
| +
|
| + dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &ident,
|
| + DBUS_TYPE_INVALID);
|
| +
|
| + _DBG_MANAGER("ident %s", ident);
|
| +
|
| + return __pop_profile(msg, ident);
|
| +}
|
| +
|
| +static DBusMessage *pop_any_profile(DBusConnection *conn,
|
| + DBusMessage *msg, void *data)
|
| +{
|
| + _DBG_MANAGER("");
|
| +
|
| + return __pop_profile(msg, NULL);
|
| +}
|
| +
|
| static DBusMessage *request_scan(DBusConnection *conn,
|
| DBusMessage *msg, void *data)
|
| {
|
| @@ -658,7 +711,10 @@ static GDBusMethodTable manager_methods[] = {
|
| { "SetProperty", "sv", "", set_property },
|
| { "GetState", "", "s", get_state },
|
| { "CreateProfile", "s", "o", create_profile },
|
| - { "RemoveProfile", "o", "", remove_profile },
|
| + { "RemoveProfile", "s", "", remove_profile },
|
| + { "PushProfile", "s", "o", push_profile },
|
| + { "PopProfile", "s", "", pop_profile },
|
| + { "PopAnyProfile", "", "", pop_any_profile },
|
| { "RequestScan", "s", "", request_scan },
|
| { "EnableTechnology", "s", "", enable_technology,
|
| G_DBUS_METHOD_FLAG_ASYNC },
|
|
|