From 37df32880dbb6712aecd4082e81e639e9ba504c2 Mon Sep 17 00:00:00 2001 From: Mygod Date: Sat, 24 Jul 2021 22:58:04 -0400 Subject: [PATCH] More descriptive errors in p2p supplicant --- .../vpnhotspot/net/wifi/P2pSupplicantConfiguration.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/P2pSupplicantConfiguration.kt b/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/P2pSupplicantConfiguration.kt index 00f22e56..d291ac87 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/P2pSupplicantConfiguration.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/P2pSupplicantConfiguration.kt @@ -75,7 +75,13 @@ class P2pSupplicantConfiguration(private val group: WifiP2pGroup? = null) { if (matchedBssid.isEmpty()) { check(block.pskLine == null && block.psk == null) if (match.groups[5] != null) { - block.psk = match.groupValues[5].apply { check(length in 8..63) } + block.psk = match.groupValues[5].apply { + when (length) { + in 8..63 -> { } + 64 -> error("WPA-PSK hex not supported") + else -> error("Unknown length $length") + } + } } block.pskLine = block.size } else if (bssids.any { matchedBssid.equals(it, true) }) {