[wpa_supplicant] Set the OWE only flag when KeyMgmt set to OWE

When manually configuring an OWE network as hidden, the phone
connected to an Open network with the same SSID.
Setting the OWE only flag when the key managemenet is set to OWE.

Bug: 169472668
Test: Manually configure GoogleGuest as Enhanced Open and hidden,
verify that the phone does not connect.

Merged-In: Ic793e09ed69156c3e28f859317375693c521a641
Change-Id: Iea2faf080b33ee798483592d7380f461810809de
diff --git a/wpa_supplicant/hidl/1.3/sta_network.cpp b/wpa_supplicant/hidl/1.3/sta_network.cpp
index 5f3b491..9716b6e 100644
--- a/wpa_supplicant/hidl/1.3/sta_network.cpp
+++ b/wpa_supplicant/hidl/1.3/sta_network.cpp
@@ -2176,6 +2176,11 @@
 		return {SupplicantStatusCode::FAILURE_ARGS_INVALID, ""};
 	}
 	setFastTransitionKeyMgmt(key_mgmt_mask);
+
+	if (key_mgmt_mask & WPA_KEY_MGMT_OWE) {
+		// Do not allow to connect to Open network when OWE is selected
+		wpa_ssid->owe_only = 1;
+	}
 	wpa_ssid->key_mgmt = key_mgmt_mask;
 	wpa_printf(MSG_MSGDUMP, "key_mgmt: 0x%x", wpa_ssid->key_mgmt);
 	resetInternalStateAfterParamsUpdate();