shill: work properly with non-ascii SSIDs
specifically: when a service has non-ascii characters in the SSID,
replace them with a placeholder. this avoids crashing when we try
to serialize the Name property to a D-Bus string. (D-Bus strings
must be utf-8.)
also:
- per pstew, only provide a WiFi.HexSSID property if the Name
property does not faithfully represent the SSID. (other parts
of the system may key on the presence of WiFi.HexSSID as an
indication that Name has been munged.)
- separate out Service.name_ into unique_name_, and friendly_name_.
- unique_name_ is maintained by Service, and is guaranteed to be
unique.
- friendly_name_ may be modified to subclasses of Service, to
provide a user-friendly name.
BUG=chromium-os:21412
TEST=unittests, WiFiManager/001_SSID_NonAscii
Change-Id: Ia625bdcb183691da54f2cf1f4c330379196d94aa
Reviewed-on: http://gerrit.chromium.org/gerrit/9762
Tested-by: mukesh agrawal <quiche@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
diff --git a/manager.cc b/manager.cc
index f8ebd53..5bffc6c 100644
--- a/manager.cc
+++ b/manager.cc
@@ -190,6 +190,8 @@
}
void Manager::RegisterService(const ServiceRefPtr &to_manage) {
+ VLOG(2) << __func__ << to_manage->UniqueName();
+
for (vector<ProfileRefPtr>::iterator it = profiles_.begin();
it != profiles_.end();
++it) {
@@ -201,11 +203,9 @@
ephemeral_profile_->AdoptService(to_manage);
// Now add to OUR list.
- // TODO(cmasone): Keep this list sorted.
vector<ServiceRefPtr>::iterator it;
for (it = services_.begin(); it != services_.end(); ++it) {
- if (to_manage->UniqueName() == (*it)->UniqueName())
- return;
+ CHECK(to_manage->UniqueName() != (*it)->UniqueName());
}
services_.push_back(to_manage);
SortServices();