From: Daniel Wagner <daniel.wag...@bmw-carit.de>

---
 plugins/session_policy_local.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/plugins/session_policy_local.c b/plugins/session_policy_local.c
index 0e4d256..c0e7138 100644
--- a/plugins/session_policy_local.c
+++ b/plugins/session_policy_local.c
@@ -83,6 +83,7 @@ static void free_policy(gpointer user_data)
        if (policy->config != NULL)
                g_slist_free(policy->config->allowed_bearers);
 
+       g_free(policy->config->id);
        g_free(policy->filename);
        g_free(policy->lsm_ctx);
        g_free(policy->user);
@@ -239,6 +240,18 @@ static void selinux_context_reply(int error,
        policy->gid = data->gid;
        policy->session = data->session;
 
+       if (g_strcmp0(policy->filename, policy->lsm_ctx) == 0) {
+               policy->config->id_type = CONNMAN_SESSION_ID_TYPE_LSM;
+               policy->config->id = ctx;
+               ctx = NULL;
+       } else if (g_strcmp0(policy->filename, policy->user) == 0) {
+               policy->config->id_type = CONNMAN_SESSION_ID_TYPE_UID;
+               policy->config->id = g_strdup(policy->user);
+       } else if (g_strcmp0(policy->filename, policy->group) == 0) {
+               policy->config->id_type = CONNMAN_SESSION_ID_TYPE_GID;
+               policy->config->id = g_strdup(policy->group);
+       }
+
        g_hash_table_replace(session_hash, data->session, policy);
        config = policy->config;
 
@@ -316,6 +329,14 @@ static void get_uid_reply(int error, unsigned int uid, 
void *user_data)
        policy->gid = data->gid;
        policy->session = data->session;
 
+       if (g_strcmp0(policy->filename, policy->user) == 0) {
+               policy->config->id_type = CONNMAN_SESSION_ID_TYPE_UID;
+               policy->config->id = g_strdup(policy->user);
+       } else if (g_strcmp0(policy->filename, policy->group) == 0) {
+               policy->config->id_type = CONNMAN_SESSION_ID_TYPE_GID;
+               policy->config->id = g_strdup(policy->group);
+       }
+
        g_hash_table_replace(session_hash, data->session, policy);
 
        config = policy->config;
-- 
1.8.1.3.566.gaa39828

_______________________________________________
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman

Reply via email to