예제 #1
0
int __connman_session_destroy(DBusMessage *msg)
{
    const char *owner, *session_path;
    struct connman_session *session;

    owner = dbus_message_get_sender(msg);

    DBG("owner %s", owner);

    dbus_message_get_args(msg, NULL, DBUS_TYPE_OBJECT_PATH, &session_path,
                          DBUS_TYPE_INVALID);
    if (!session_path)
        return -EINVAL;

    session = g_hash_table_lookup(session_hash, session_path);
    if (!session)
        return -EINVAL;

    if (g_strcmp0(owner, session->owner) != 0)
        return -EACCES;

    connman_session_destroy(session);

    return 0;
}
예제 #2
0
int connman_session_config_update(struct connman_session *session)
{
    struct session_info *info = session->info;
    GSList *allowed_bearers;
    int err;

    DBG("session %p", session);

    /*
     * We update all configuration even though only one entry
     * might have changed. We can still optimize this later.
     */

    if (session->id_type != session->policy_config->id_type) {
        cleanup_firewall_session(session);
        err = init_firewall_session(session);
        if (err < 0) {
            connman_session_destroy(session);
            return err;
        }

        session->id_type = session->policy_config->id_type;
    }

    apply_policy_on_bearers(
        session->policy_config->allowed_bearers,
        session->user_allowed_bearers,
        &allowed_bearers);

    if (session->active)
        set_active_session(session, false);

    session->active = false;
    session_deactivate(session);

    g_slist_free(info->config.allowed_bearers);
    info->config.allowed_bearers = allowed_bearers;

    session_activate(session);

    info->config.type = apply_policy_on_type(
                            session->policy_config->type,
                            info->config.type);

    info->config.roaming_policy = session->policy_config->roaming_policy;

    info->config.ecall = session->policy_config->ecall;
    if (info->config.ecall)
        ecall_session = session;

    info->config.priority = session->policy_config->priority;

    session_notify(session);

    return 0;
}
예제 #3
0
static void update_session(struct policy_config *policy)
{
	DBG("policy %p session %p", policy, policy->session);

	if (!policy->session)
		return;

	if (connman_session_config_update(policy->session) < 0)
		connman_session_destroy(policy->session);
}