diff options
author | Daniel Wagner <daniel.wagner@bmw-carit.de> | 2012-11-02 17:26:17 +0100 |
---|---|---|
committer | Daniel Wagner <daniel.wagner@bmw-carit.de> | 2012-11-23 13:47:24 +0100 |
commit | 23c22db2e95243d2431c8b493ef134cfacaead91 (patch) | |
tree | b41cc12d0f9e600ecebeb7825a5f1a2fb725aeb6 /src/session.c | |
parent | 2882f67ff02adbb2ce64b74cb4fe25e834b2021e (diff) | |
download | connman-23c22db2e95243d2431c8b493ef134cfacaead91.tar.gz connman-23c22db2e95243d2431c8b493ef134cfacaead91.tar.bz2 connman-23c22db2e95243d2431c8b493ef134cfacaead91.zip |
session: Store user AllowedBearers configuration
Don't overwrite the user provided AllowedBearers
configuration. Instead just store it at session level. So we always
will apply the bearer filter on the user input.
Obviously, this might need some more improvements on how we want
to handle the AllowedBearers behavior when the policy plugin and
the application provide a configuration. For exmaple should
we update the AllowedBearers if the policy changes or just always
show only the user input. This patch is not perfect but it
improves the situation clearly.
Diffstat (limited to 'src/session.c')
-rw-r--r-- | src/session.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/session.c b/src/session.c index c2327886..688237b3 100644 --- a/src/session.c +++ b/src/session.c @@ -89,6 +89,7 @@ struct connman_session { struct session_info *info; struct session_info *info_last; struct connman_session_config *policy_config; + GSList *user_allowed_bearers; connman_bool_t ecall; @@ -877,6 +878,7 @@ static void cleanup_session(gpointer user_data) DBG("remove %s", session->session_path); + g_slist_free(session->user_allowed_bearers); g_hash_table_destroy(session->service_hash); g_sequence_free(session->service_list); @@ -1392,7 +1394,7 @@ int connman_session_config_update(struct connman_session *session) err = apply_policy_on_bearers( session->policy_config->allowed_bearers, - info->config.allowed_bearers, + session->user_allowed_bearers, &allowed_bearers); if (err < 0) return err; @@ -1489,12 +1491,13 @@ static DBusMessage *change_session(DBusConnection *conn, return __connman_error_failed(msg, err); g_slist_free(info->config.allowed_bearers); + session->user_allowed_bearers = allowed_bearers; + err = apply_policy_on_bearers( session->policy_config->allowed_bearers, - allowed_bearers, + session->user_allowed_bearers, &info->config.allowed_bearers); - g_slist_free(allowed_bearers); if (err < 0) return __connman_error_failed(msg, err); } else { @@ -1636,9 +1639,11 @@ static void session_create_cb(struct connman_session *session, info->config.roaming_policy = session->policy_config->roaming_policy; info->entry = NULL; + session->user_allowed_bearers = user_config->allowed_bearers; + err = apply_policy_on_bearers( session->policy_config->allowed_bearers, - user_config->allowed_bearers, + session->user_allowed_bearers, &info->config.allowed_bearers); if (err < 0) goto out; @@ -1681,7 +1686,6 @@ out: } dbus_message_unref(user_config->pending); - g_slist_free(user_config->allowed_bearers); g_free(user_config); } |