Shill: Shill now rebuffs connecting to service that isn't connectable.
In addtion to rebuffing non-connectable service connections, this
removes nulling-out key_management in UnloadEapCredentials. Previously,
that method set key_management to an illegal value and this broke
subsequent connection attempts.
BUG=chromium-os:30382
TEST=Autotest 092_ProfileCredentials (not yet checked-in) and, now, unit
tests!
Change-Id: I7c2764938dda18720208f3ddf58b858d5d7e708d
Reviewed-on: https://gerrit.chromium.org/gerrit/21631
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Wade Guthrie <wdg@chromium.org>
Commit-Ready: Wade Guthrie <wdg@chromium.org>
diff --git a/wifi_service.cc b/wifi_service.cc
index 8ce3693..bc533d0 100644
--- a/wifi_service.cc
+++ b/wifi_service.cc
@@ -312,8 +312,8 @@
bool WiFiService::Unload() {
Service::Unload();
hidden_ssid_ = false;
- passphrase_ = "";
- UpdateConnectable();
+ Error unused_error;
+ ClearPassphrase(&unused_error);
if (security_ == flimflam::kSecurity8021x) {
// TODO(pstew): 802.1x/RSN networks (as opposed to 802.1x/WPA or
// 802.1x/WEP) have the ability to cache WPA PMK credentials.
@@ -390,11 +390,19 @@
this, set, clear, default_value)));
}
-void WiFiService::Connect(Error */*error*/) {
- LOG(INFO) << "In " << __func__ << "():";
+void WiFiService::Connect(Error *error) {
+ LOG(INFO) << "In " << __func__ << "(): Service " << friendly_name();
std::map<string, DBus::Variant> params;
DBus::MessageIter writer;
+ if (!connectable()) {
+ LOG(ERROR) << "Can't connect. Service " << friendly_name()
+ << " is not connectable";
+ Error::PopulateAndLog(error, Error::kOperationFailed,
+ Error::GetDefaultMessage(Error::kOperationFailed));
+ return;
+ }
+
params[wpa_supplicant::kNetworkPropertyMode].writer().
append_uint32(WiFiEndpoint::ModeStringToUint(mode_));