Fix a crash when doing PEAP/TTLS authentication
authorFabien Marotte <fabienx.marotte@linux.intel.com>
Thu, 16 Sep 2010 07:52:43 +0000 (09:52 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Thu, 16 Sep 2010 10:52:08 +0000 (12:52 +0200)
When doing a PEAP/TTLS authentication, if the Phase2 passphrase is
not provided, connman crashes due to a NULL pointer.
This patch fixes the crash.

Fixes BMC #6841

plugins/supplicant.c

index 928bacc..6bfcd45 100644 (file)
@@ -1144,6 +1144,12 @@ static int set_network_peap(struct connman_network *network,
         *              The Client private key file
         *              The Client private key file password
         */
+       if (passphrase == NULL) {
+               connman_error("Error in PEAP/TTLS authentication: "
+                             "a phase2 passphrase must be defined\n");
+               return -EINVAL;
+       }
+
        ca_cert = connman_network_get_string(network, "WiFi.CACertFile");
        if (ca_cert == NULL) {
                connman_error("Error in PEAP/TTLS authentication: "