gsupplicant: Fixed crash issue when network exists in supplicant 74/179474/1 accepted/tizen/unified/20180521.003506 submit/tizen/20180518.061044
authorSaurav Babu <saurav.babu@samsung.com>
Fri, 18 May 2018 05:54:45 +0000 (11:24 +0530)
committerSaurav Babu <saurav.babu@samsung.com>
Fri, 18 May 2018 05:54:45 +0000 (11:24 +0530)
In some cases interface->network_path exists but
interface->network_info.ssid is NULL which leads to crash with below
backtrace:
Program received signal SIGSEGV, Segmentation fault.
0xb6b0d184 in memcmp () from /lib/libc.so.6
(gdb) bt
 #0  0xb6b0d184 in memcmp () from /lib/libc.so.6
 #1  0xb6eb5530 in compare_network_parameters (ssid=0xb85aec20,
interface=0xb85a1710) at gsupplicant/supplicant.c:445
 #2  g_supplicant_interface_connect (interface=0xb85a1710,
ssid=0xb85aec20, callback=0xb6eab039 <connect_callback>,
user_data=0xb859cbb0) at gsupplicant/supplicant.c:5839
 #3  0xb6ecc000 in __connman_network_connect (network=0xb859cbb0) at
src/network.c:1711
 #4  0xb6edaabe in service_connect (service=0xb85a6558) at
src/service.c:8143
 #5  __connman_service_connect (service=service@entry=0xb85a6558,
reason=reason@entry=CONNMAN_SERVICE_CONNECT_REASON_USER) at
src/service.c:8203
 #6  0xb6edc148 in connect_service (conn=<optimized out>, msg=0xb85d3b80,
user_data=0xb85a6558) at src/service.c:5570
 #7  0xb6f1653e in process_message
(connection=connection@entry=0xb859b600,
message=message@entry=0xb85d3b80,
iface_user_data=iface_user_data@entry=0xb85a6558, method=<optimized
out>, method=<optimized out>) at gdbus/object.c:259
 #8  0xb6f167be in generic_message (connection=0xb859b600,
message=0xb85d3b80, user_data=<optimized out>) at gdbus/object.c:1071
 #9  0xb6d126b0 in ?? () from /lib/libdbus-1.so.3
 #10 0xb6d014a8 in dbus_connection_dispatch () from /lib/libdbus-1.so.3
 #11 0xb6f144f2 in message_dispatch (data=0xb859b600) at
gdbus/mainloop.c:76
 #12 0xb6d898e8 in g_main_dispatch (context=0xb8599808) at gmain.c:3234
 #13 g_main_context_dispatch (context=context@entry=0xb8599808) at
gmain.c:3887
 #14 0xb6d89c78 in g_main_context_iterate (context=0xb8599808,
block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at
gmain.c:3960
 #15 0xb6d89fd8 in g_main_loop_run (loop=0xb85999a8) at gmain.c:4156
 #16 0xb6e9f352 in main (argc=<optimized out>, argv=<optimized out>) at
src/main.c:851

Change-Id: I9ed4c69d31389bd7aa0c8ab250d92c45cdab7507
Signed-off-by: Saurav Babu <saurav.babu@samsung.com>
gsupplicant/supplicant.c

index c154a0e..4a78cee 100644 (file)
@@ -437,6 +437,11 @@ static GSupplicantState string2state(const char *state)
 static bool compare_network_parameters(GSupplicantInterface *interface,
                                GSupplicantSSID *ssid)
 {
+#if defined TIZEN_EXT
+       if (!interface->network_info.ssid)
+               return FALSE;
+#endif
+
        if (memcmp(interface->network_info.ssid, ssid->ssid, ssid->ssid_len))
                return FALSE;
 
@@ -5905,6 +5910,15 @@ static void network_remove_result(const char *error,
                connect_data->ssid = data->ssid;
                connect_data->user_data = data->user_data;
 
+#if defined TIZEN_EXT
+               int ret;
+               if (data->ssid->passphrase && g_strcmp0(data->ssid->passphrase, "") != 0
+                       && !data->ssid->eap) {
+                       ret = send_decryption_request(data->ssid->passphrase, connect_data);
+                       if (ret < 0)
+                               SUPPLICANT_DBG("Decryption request failed %d", ret);
+               } else
+#endif
                supplicant_dbus_method_call(data->interface->path,
                        SUPPLICANT_INTERFACE ".Interface", "AddNetwork",
                        interface_add_network_params,