shill: WiFiService: Don't ignore Passphrase for Configure
Do not ignore the Passphrase parameter when configuring a WiFi
service. This allows the Manager::ConfigureService to change
the passphrase on a service which is found by GUID.
Conversely, we should not directly set the passphrase for a
WiFi service in WiFi::GetService, and instead rely on the Configure
call to handle applying the passphrase. We can now make
WiFiService::SetPassphrase private, since there are no remaining
non-unittest consumers for this method.
BUG=chromium-os:34004
TEST=Unit-tests, small modification network_WiFiManager/095_ProfileGUID
Full WiFiManager suite.
Change-Id: Ie23c1b03dee89aea54a4a86c46734165488a885b
Reviewed-on: https://gerrit.chromium.org/gerrit/32997
Commit-Ready: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
diff --git a/wifi.cc b/wifi.cc
index 8fa866b..8ff1e78 100644
--- a/wifi.cc
+++ b/wifi.cc
@@ -1243,18 +1243,6 @@
// The Service will be registered if/when we find Endpoints for it.
}
- if ((security_method == flimflam::kSecurityWep ||
- security_method == flimflam::kSecurityPsk ||
- security_method == flimflam::kSecurityWpa ||
- security_method == flimflam::kSecurityRsn) &&
- args.ContainsString(flimflam::kPassphraseProperty)) {
- service->SetPassphrase(args.GetString(flimflam::kPassphraseProperty),
- error);
- if (error->IsFailure()) {
- return NULL;
- }
- }
-
service->Configure(args, error);
// TODO(pstew): Schedule a task to forget up all non-hidden services that
diff --git a/wifi_service.cc b/wifi_service.cc
index f6700f8..58a4a61 100644
--- a/wifi_service.cc
+++ b/wifi_service.cc
@@ -119,7 +119,6 @@
IgnoreParameterForConfigure(flimflam::kModeProperty);
IgnoreParameterForConfigure(flimflam::kSSIDProperty);
IgnoreParameterForConfigure(flimflam::kSecurityProperty);
- IgnoreParameterForConfigure(flimflam::kPassphraseProperty);
}
WiFiService::~WiFiService() {}
diff --git a/wifi_service.h b/wifi_service.h
index fe5d0de..6b82c65 100644
--- a/wifi_service.h
+++ b/wifi_service.h
@@ -72,8 +72,6 @@
const std::string &key_management() const { return GetEAPKeyManagement(); }
const std::vector<uint8_t> &ssid() const { return ssid_; }
- void SetPassphrase(const std::string &passphrase, Error *error);
-
// Overrride Load and Save from parent Service class. We will call
// the parent method.
virtual bool IsLoadableFrom(StoreInterface *storage) const;
@@ -103,6 +101,7 @@
private:
friend class WiFiServiceSecurityTest;
+ friend class WiFiServiceTest; // SetPassphrase
friend class WiFiServiceUpdateFromEndpointsTest; // SignalToStrength
FRIEND_TEST(MetricsTest, WiFiServicePostReady);
FRIEND_TEST(WiFiMainTest, CurrentBSSChangedUpdateServiceEndpoint);
@@ -168,6 +167,9 @@
std::string GetStorageIdentifierForSecurity(
const std::string &security) const;
+ // Validate then apply a passphrase for this service.
+ void SetPassphrase(const std::string &passphrase, Error *error);
+
// Populate the |params| map with available 802.1x EAP properties.
void Populate8021xProperties(std::map<std::string, DBus::Variant> *params);