Fix derefrencing of invalid pointer
[platform/upstream/connman.git] / gsupplicant / supplicant.c
index 9ecaf06..4bc5276 100755 (executable)
@@ -2315,6 +2315,43 @@ GSupplicantNetwork *g_supplicant_interface_get_network(GSupplicantInterface *int
 
        return g_hash_table_lookup(interface->network_table, group);
 }
+
+static void copy_assoc_reject(gpointer key, gpointer value, gpointer user_data)
+{
+       struct assoc_reject_data *cloned_assoc_data;
+       struct assoc_reject_data *assoc_data = value;
+       GHashTable *cloned_assoc_reject_table = user_data;
+
+       if (assoc_data && cloned_assoc_reject_table) {
+               cloned_assoc_data = g_try_new0(struct assoc_reject_data, 1);
+               if (!cloned_assoc_data)
+                       return;
+
+               cloned_assoc_data->bssid = g_strdup(assoc_data->bssid);
+               cloned_assoc_data->reject_time_list = g_slist_copy(assoc_data->reject_time_list);
+               g_hash_table_insert(cloned_assoc_reject_table,
+                                       cloned_assoc_data->bssid, cloned_assoc_data);
+       }
+}
+
+GHashTable *g_supplicant_network_clone_assoc_reject_table(GSupplicantNetwork *network)
+{
+       GHashTable *cloned_assoc_reject_table;
+
+       if (!network)
+               return NULL;
+
+       GHashTable *assoc_reject_table = g_supplicant_network_get_assoc_reject_table(network);
+       if (!assoc_reject_table)
+               return NULL;
+
+       cloned_assoc_reject_table = g_hash_table_new_full(g_str_hash, g_str_equal,
+                                                               NULL, remove_assoc_data);
+       g_hash_table_foreach(assoc_reject_table, copy_assoc_reject, cloned_assoc_reject_table);
+
+       return cloned_assoc_reject_table;
+}
+
 #endif
 
 static void merge_network(GSupplicantNetwork *network)
@@ -5444,7 +5481,7 @@ static void country_result(const char *error,
                regdom->callback(result, regdom->alpha2,
                                        (void *) regdom->user_data);
 
-       dbus_free(regdom);
+       g_free(regdom);
 }
 
 static void country_params(DBusMessageIter *iter, void *user_data)
@@ -5708,7 +5745,7 @@ static void interface_create_result(const char *error,
        SUPPLICANT_DBG("");
 
        if (error) {
-               g_message("error %s", error);
+               g_warning("error %s", error);
                err = -EIO;
                goto done;
        }
@@ -6860,10 +6897,8 @@ static void add_network_security_tls(DBusMessageIter *dict,
        if (!ssid->private_key_path)
                return;
 
-#if !defined TIZEN_EXT
        if (!ssid->private_key_passphrase)
                return;
-#endif
 
        if (ssid->ca_cert_path)
                supplicant_dbus_dict_append_basic(dict, "ca_cert",
@@ -6872,11 +6907,9 @@ static void add_network_security_tls(DBusMessageIter *dict,
        supplicant_dbus_dict_append_basic(dict, "private_key",
                                                DBUS_TYPE_STRING,
                                                &ssid->private_key_path);
-#if !defined TIZEN_EXT
        supplicant_dbus_dict_append_basic(dict, "private_key_passwd",
                                                DBUS_TYPE_STRING,
                                                &ssid->private_key_passphrase);
-#endif
        supplicant_dbus_dict_append_basic(dict, "client_cert",
                                                DBUS_TYPE_STRING,
                                                &ssid->client_cert_path);