DA: Skip initializing failed_bssids list when eapol failure case
[platform/upstream/connman.git] / plugins / session_policy_local.c
old mode 100644 (file)
new mode 100755 (executable)
index 4e8b5f2..32b9c69
@@ -2,7 +2,7 @@
  *
  *  Connection Manager
  *
- *  Copyright (C) 2012  BMW Car IT GbmH. All rights reserved.
+ *  Copyright (C) 2012-2014  BMW Car IT GmbH.
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License version 2 as
@@ -66,7 +66,7 @@ static GHashTable *gid_hash;     /* (gid, policy_group) */
 struct policy_file {
        /*
         * A valid file is a keyfile with one ore more groups. All
-        * groups are keept in this list.
+        * groups are kept in this list.
         */
        GSList *groups;
 };
@@ -134,7 +134,7 @@ static char *parse_selinux_type(const char *context)
 
        /*
         * SELinux combines Role-Based Access Control (RBAC), Type
-        * Enforcment (TE) and optionally Multi-Level Security (MLS).
+        * Enforcement (TE) and optionally Multi-Level Security (MLS).
         *
         * When SELinux is enabled all processes and files are labeled
         * with a contex that contains information such as user, role
@@ -145,7 +145,7 @@ static char *parse_selinux_type(const char *context)
         *
         * For identifyng application we (ab)using the type
         * information. In the above example the haifux_exec_t type
-        * will be transfered to haifux_t as defined in the domain
+        * will be transferred to haifux_t as defined in the domain
         * transition and thus we are able to identify the application
         * as haifux_t.
         */
@@ -271,10 +271,8 @@ static void get_uid_reply(unsigned int uid, void *user_data, int err)
 
        DBG("session %p uid %d", policy->session, uid);
 
-       if (err < 0) {
-               cleanup_config(policy);
+       if (err < 0)
                goto err;
-       }
 
        pwd = getpwuid((uid_t)uid);
        if (!pwd) {
@@ -333,7 +331,7 @@ static void get_uid_reply(unsigned int uid, void *user_data, int err)
        return;
 
 err:
-       failed_create(NULL, cb, cbd->user_data, err);
+       failed_create(policy, cb, cbd->user_data, err);
        g_free(cbd);
        g_free(groups);
 }
@@ -459,6 +457,8 @@ static int load_policy(GKeyFile *keyfile, const char *groupname,
        str = g_key_file_get_string(keyfile, groupname, "AllowedBearers",
                                NULL);
        if (str) {
+               g_slist_free(config->allowed_bearers);
+               config->allowed_bearers = NULL;
                tokens = g_strsplit(str, " ", 0);
 
                for (i = 0; tokens[i]; i++) {
@@ -623,7 +623,7 @@ static int load_file(const char *filename, struct policy_file *file)
 
        for (i = 0; groupnames[i]; i++) {
                group = g_new0(struct policy_group, 1);
-               group->config = g_new0(struct connman_session_config, 1);
+               group->config = connman_session_create_default_config();
 
                err = load_policy(keyfile, groupnames[i], group);
                if (err < 0) {