diff options
author | San Mehat <san@google.com> | 2009-06-01 10:04:21 -0700 |
---|---|---|
committer | San Mehat <san@google.com> | 2009-06-02 10:26:58 -0700 |
commit | 21e90f0e10b5a75e583b10799c0084ddab3433d6 (patch) | |
tree | c4b287dd51b1bc4d14a3eaf467a699dae23a0aa8 /nexus/WifiNetwork.cpp | |
parent | 78828ff4f5f959fcf8066ecb6a6b689d2a3c5985 (diff) | |
download | system_core-21e90f0e10b5a75e583b10799c0084ddab3433d6.zip system_core-21e90f0e10b5a75e583b10799c0084ddab3433d6.tar.gz system_core-21e90f0e10b5a75e583b10799c0084ddab3433d6.tar.bz2 |
nexus: Validate that priority and KeyManagement are set before enabling a network
Signed-off-by: San Mehat <san@google.com>
Diffstat (limited to 'nexus/WifiNetwork.cpp')
-rw-r--r-- | nexus/WifiNetwork.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/nexus/WifiNetwork.cpp b/nexus/WifiNetwork.cpp index 1f53a20..818b91d 100644 --- a/nexus/WifiNetwork.cpp +++ b/nexus/WifiNetwork.cpp @@ -551,6 +551,20 @@ int WifiNetwork::setAllowedGroupCiphers(uint32_t mask) { } int WifiNetwork::setEnabled(bool enabled) { + + if (enabled) { + if (getPriority() == -1) { + LOGE("Cannot enable network when priority is not set"); + errno = EAGAIN; + return -1; + } + if (getAllowedKeyManagement() == KeyManagementMask::UNKNOWN) { + LOGE("Cannot enable network when KeyManagement is not set"); + errno = EAGAIN; + return -1; + } + } + if (mSuppl->enableNetwork(mNetid, enabled)) return -1; |