OLD | NEW |
1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chromeos_network.h" // NOLINT | 5 #include "chromeos_network.h" // NOLINT |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cstring> | 8 #include <cstring> |
9 #include <list> | 9 #include <list> |
10 #include <set> | 10 #include <set> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "marshal.glibmarshal.h" // NOLINT | 13 #include "marshal.glibmarshal.h" // NOLINT |
14 #include "base/scoped_ptr.h" | 14 #include "base/scoped_ptr.h" |
| 15 #include "base/scoped_vector.h" |
15 #include "base/string_util.h" | 16 #include "base/string_util.h" |
16 #include "base/values.h" | 17 #include "base/values.h" |
17 #include "chromeos/dbus/dbus.h" // NOLINT | 18 #include "chromeos/dbus/dbus.h" // NOLINT |
18 #include "chromeos/glib/object.h" // NOLINT | 19 #include "chromeos/glib/object.h" // NOLINT |
19 #include "chromeos/string.h" | 20 #include "chromeos/string.h" |
20 | 21 |
21 // TODO(rtc): Unittest this code as soon as the tree is refactored. | 22 // TODO(rtc): Unittest this code as soon as the tree is refactored. |
22 namespace chromeos { // NOLINT | 23 namespace chromeos { // NOLINT |
23 | 24 |
24 namespace { // NOLINT | 25 namespace { // NOLINT |
(...skipping 21 matching lines...) Expand all Loading... |
46 static const char* kAddIPConfigFunction = "AddIPConfig"; | 47 static const char* kAddIPConfigFunction = "AddIPConfig"; |
47 static const char* kRemoveConfigFunction = "Remove"; | 48 static const char* kRemoveConfigFunction = "Remove"; |
48 static const char* kGetEntryFunction = "GetEntry"; | 49 static const char* kGetEntryFunction = "GetEntry"; |
49 static const char* kDeleteEntryFunction = "DeleteEntry"; | 50 static const char* kDeleteEntryFunction = "DeleteEntry"; |
50 static const char* kActivateCellularModemFunction = "ActivateCellularModem"; | 51 static const char* kActivateCellularModemFunction = "ActivateCellularModem"; |
51 | 52 |
52 // Connman property names. | 53 // Connman property names. |
53 static const char* kSecurityProperty = "Security"; | 54 static const char* kSecurityProperty = "Security"; |
54 static const char* kPassphraseProperty = "Passphrase"; | 55 static const char* kPassphraseProperty = "Passphrase"; |
55 static const char* kIdentityProperty = "Identity"; | 56 static const char* kIdentityProperty = "Identity"; |
56 static const char* kCertPathProperty = "CertPath"; | 57 static const char* kCertPathProperty = "CertPath"; // DEPRECATED |
57 static const char* kPassphraseRequiredProperty = "PassphraseRequired"; | 58 static const char* kPassphraseRequiredProperty = "PassphraseRequired"; |
58 static const char* kServicesProperty = "Services"; | 59 static const char* kServicesProperty = "Services"; |
59 static const char* kAvailableTechnologiesProperty = "AvailableTechnologies"; | 60 static const char* kAvailableTechnologiesProperty = "AvailableTechnologies"; |
60 static const char* kEnabledTechnologiesProperty = "EnabledTechnologies"; | 61 static const char* kEnabledTechnologiesProperty = "EnabledTechnologies"; |
61 static const char* kConnectedTechnologiesProperty = "ConnectedTechnologies"; | 62 static const char* kConnectedTechnologiesProperty = "ConnectedTechnologies"; |
62 static const char* kDefaultTechnologyProperty = "DefaultTechnology"; | 63 static const char* kDefaultTechnologyProperty = "DefaultTechnology"; |
63 static const char* kOfflineModeProperty = "OfflineMode"; | 64 static const char* kOfflineModeProperty = "OfflineMode"; |
64 static const char* kSignalStrengthProperty = "Strength"; | 65 static const char* kSignalStrengthProperty = "Strength"; |
65 static const char* kNameProperty = "Name"; | 66 static const char* kNameProperty = "Name"; |
66 static const char* kStateProperty = "State"; | 67 static const char* kStateProperty = "State"; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 static const char* kImsiProperty = "Cellular.IMSI"; | 100 static const char* kImsiProperty = "Cellular.IMSI"; |
100 static const char* kEsnProperty = "Cellular.ESN"; | 101 static const char* kEsnProperty = "Cellular.ESN"; |
101 static const char* kMdnProperty = "Cellular.MDN"; | 102 static const char* kMdnProperty = "Cellular.MDN"; |
102 static const char* kMinProperty = "Cellular.MIN"; | 103 static const char* kMinProperty = "Cellular.MIN"; |
103 static const char* kModelIDProperty = "Cellular.ModelID"; | 104 static const char* kModelIDProperty = "Cellular.ModelID"; |
104 static const char* kManufacturerProperty = "Cellular.Manufacturer"; | 105 static const char* kManufacturerProperty = "Cellular.Manufacturer"; |
105 static const char* kFirmwareRevisionProperty = "Cellular.FirmwareRevision"; | 106 static const char* kFirmwareRevisionProperty = "Cellular.FirmwareRevision"; |
106 static const char* kHardwareRevisionProperty = "Cellular.HardwareRevision"; | 107 static const char* kHardwareRevisionProperty = "Cellular.HardwareRevision"; |
107 static const char* kLastDeviceUpdateProperty = "Cellular.LastDeviceUpdate"; | 108 static const char* kLastDeviceUpdateProperty = "Cellular.LastDeviceUpdate"; |
108 static const char* kPRLVersionProperty = "Cellular.PRLVersion"; // (INT16) | 109 static const char* kPRLVersionProperty = "Cellular.PRLVersion"; // (INT16) |
| 110 static const char* kCertpathSettingsPrefix = "SETTINGS:"; |
| 111 |
| 112 // Connman EAP service properties |
| 113 static const char* kEAPIdentityProperty = "EAP.Identity"; |
| 114 static const char* kEAPEAPProperty = "EAP.EAP"; |
| 115 static const char* kEAPInnerEAPProperty = "EAP.InnerEAP"; |
| 116 static const char* kEAPAnonymousIdentityProperty = "EAP.AnonymousIdentity"; |
| 117 static const char* kEAPClientCertProperty = "EAP.ClientCert"; |
| 118 static const char* kEAPCertIDProperty = "EAP.CertID"; |
| 119 static const char* kEAPPrivateKeyProperty = "EAP.PrivateKey"; |
| 120 static const char* kEAPPrivateKeyPasswordProperty = "EAP.PrivateKeyPassword"; |
| 121 static const char* kEAPKeyIDProperty = "EAP.KeyID"; |
| 122 static const char* kEAPCACertProperty = "EAP.CACert"; |
| 123 static const char* kEAPCACertIDProperty = "EAP.CACertID"; |
| 124 static const char* kEAPPINProperty = "EAP.PIN"; |
| 125 static const char* kEAPPasswordProperty = "EAP.Password"; |
109 | 126 |
110 // Connman monitored properties | 127 // Connman monitored properties |
111 static const char* kMonitorPropertyChanged = "PropertyChanged"; | 128 static const char* kMonitorPropertyChanged = "PropertyChanged"; |
112 | 129 |
113 // Connman network state | 130 // Connman network state |
114 static const char* kOnline = "online"; | 131 static const char* kOnline = "online"; |
115 | 132 |
116 // Connman type options. | 133 // Connman type options. |
117 static const char* kTypeEthernet = "ethernet"; | 134 static const char* kTypeEthernet = "ethernet"; |
118 static const char* kTypeWifi = "wifi"; | 135 static const char* kTypeWifi = "wifi"; |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 properties.Retrieve(kPassphraseRequiredProperty, &default_bool); | 633 properties.Retrieve(kPassphraseRequiredProperty, &default_bool); |
617 info->passphrase_required = default_bool; | 634 info->passphrase_required = default_bool; |
618 | 635 |
619 // Passphrase | 636 // Passphrase |
620 default_string = ""; | 637 default_string = ""; |
621 properties.Retrieve(kPassphraseProperty, &default_string); | 638 properties.Retrieve(kPassphraseProperty, &default_string); |
622 info->passphrase = NewStringCopy(default_string); | 639 info->passphrase = NewStringCopy(default_string); |
623 | 640 |
624 // Identity | 641 // Identity |
625 default_string = ""; | 642 default_string = ""; |
626 properties.Retrieve(kIdentityProperty, &default_string); | 643 properties.Retrieve(kEAPIdentityProperty, &default_string); |
627 info->identity = NewStringCopy(default_string); | 644 info->identity = NewStringCopy(default_string); |
628 | 645 |
629 // Certificate path | |
630 default_string = ""; | |
631 properties.Retrieve(kCertPathProperty, &default_string); | |
632 info->cert_path = NewStringCopy(default_string); | |
633 | |
634 // Strength | 646 // Strength |
635 uint8 default_uint8 = 0; | 647 uint8 default_uint8 = 0; |
636 properties.Retrieve(kSignalStrengthProperty, &default_uint8); | 648 properties.Retrieve(kSignalStrengthProperty, &default_uint8); |
637 info->strength = default_uint8; | 649 info->strength = default_uint8; |
638 | 650 |
639 // Favorite | 651 // Favorite |
640 default_bool = false; | 652 default_bool = false; |
641 properties.Retrieve(kFavoriteProperty, &default_bool); | 653 properties.Retrieve(kFavoriteProperty, &default_bool); |
642 info->favorite = default_bool; | 654 info->favorite = default_bool; |
643 | 655 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 properties.Retrieve(kOperatorCodeProperty, &default_string); | 713 properties.Retrieve(kOperatorCodeProperty, &default_string); |
702 info->carrier_info->operator_code = NewStringCopy(default_string); | 714 info->carrier_info->operator_code = NewStringCopy(default_string); |
703 // Payment URL | 715 // Payment URL |
704 default_string = kUnknownString; | 716 default_string = kUnknownString; |
705 properties.Retrieve(kPaymentURLProperty, &default_string); | 717 properties.Retrieve(kPaymentURLProperty, &default_string); |
706 info->carrier_info->payment_url = NewStringCopy(default_string); | 718 info->carrier_info->payment_url = NewStringCopy(default_string); |
707 } else { | 719 } else { |
708 info->carrier_info = NULL; | 720 info->carrier_info = NULL; |
709 } | 721 } |
710 | 722 |
| 723 // EAP type |
| 724 default_string = ""; |
| 725 properties.Retrieve(kEAPEAPProperty, &default_string); |
| 726 info->eap = NewStringCopy(default_string); |
| 727 // Inner EAP type |
| 728 default_string = ""; |
| 729 properties.Retrieve(kEAPInnerEAPProperty, &default_string); |
| 730 info->inner_eap = NewStringCopy(default_string); |
| 731 // Anonymous identity |
| 732 default_string = ""; |
| 733 properties.Retrieve(kEAPAnonymousIdentityProperty, &default_string); |
| 734 info->anonymous_identity = NewStringCopy(default_string); |
| 735 // Client certificate |
| 736 default_string = ""; |
| 737 properties.Retrieve(kEAPClientCertProperty, &default_string); |
| 738 info->client_cert = NewStringCopy(default_string); |
| 739 // Certificate ID |
| 740 default_string = ""; |
| 741 properties.Retrieve(kEAPCertIDProperty, &default_string); |
| 742 info->cert_id = NewStringCopy(default_string); |
| 743 // Private key |
| 744 default_string = ""; |
| 745 properties.Retrieve(kEAPPrivateKeyProperty, &default_string); |
| 746 info->private_key = NewStringCopy(default_string); |
| 747 // Private key password |
| 748 default_string = ""; |
| 749 properties.Retrieve(kEAPPrivateKeyPasswordProperty, &default_string); |
| 750 info->private_key_passwd = NewStringCopy(default_string); |
| 751 // Private key ID |
| 752 default_string = ""; |
| 753 properties.Retrieve(kEAPKeyIDProperty, &default_string); |
| 754 info->key_id = NewStringCopy(default_string); |
| 755 // CA certificate |
| 756 default_string = ""; |
| 757 properties.Retrieve(kEAPCACertProperty, &default_string); |
| 758 info->ca_cert = NewStringCopy(default_string); |
| 759 // CA certificate ID |
| 760 default_string = ""; |
| 761 properties.Retrieve(kEAPCACertIDProperty, &default_string); |
| 762 info->ca_cert_id = NewStringCopy(default_string); |
| 763 // PKCS#11 PIN |
| 764 default_string = ""; |
| 765 properties.Retrieve(kEAPPINProperty, &default_string); |
| 766 info->pin = NewStringCopy(default_string); |
| 767 // EAP Password |
| 768 default_string = ""; |
| 769 properties.Retrieve(kEAPPasswordProperty, &default_string); |
| 770 info->password = NewStringCopy(default_string); |
| 771 |
| 772 // DEPRECATED: Certificate path (backwards compat only) |
| 773 default_string = ""; |
| 774 if (strcmp(info->eap, "TLS") == 0) { |
| 775 // "SETTINGS:cert_id=x,key_id=x,pin=x" |
| 776 std::string certpath("SETTINGS:"); |
| 777 const char *comma = ""; |
| 778 if (strlen(info->cert_id) != 0) { |
| 779 certpath += StringPrintf("%scert_id=%s", comma, info->cert_id); |
| 780 comma = ","; |
| 781 } |
| 782 if (strlen(info->key_id) != 0) { |
| 783 certpath += StringPrintf("%skey_id=%s", comma, info->key_id); |
| 784 comma = ","; |
| 785 } |
| 786 if (strlen(info->pin) != 0) { |
| 787 certpath += StringPrintf("%spin=%s", comma, info->pin); |
| 788 comma = ","; |
| 789 } |
| 790 info->cert_path = NewStringCopy(certpath.c_str()); |
| 791 } else |
| 792 info->cert_path = NewStringCopy(default_string); |
| 793 |
711 // Device Info (initialize to NULL) | 794 // Device Info (initialize to NULL) |
712 info->device_info = NULL; | 795 info->device_info = NULL; |
713 } | 796 } |
714 | 797 |
715 // Returns a ServiceInfo object populated with data from a | 798 // Returns a ServiceInfo object populated with data from a |
716 // given DBus object path. | 799 // given DBus object path. |
717 // | 800 // |
718 // returns true on success. | 801 // returns true on success. |
719 bool GetServiceInfo(const char* path, ServiceInfo *info) { | 802 bool GetServiceInfo(const char* path, ServiceInfo *info) { |
720 dbus::Proxy service_proxy(dbus::GetSystemBusConnection(), | 803 dbus::Proxy service_proxy(dbus::GetSystemBusConnection(), |
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1484 "ChromeOSActivateCellularModem: already started activation"; | 1567 "ChromeOSActivateCellularModem: already started activation"; |
1485 return true; | 1568 return true; |
1486 } | 1569 } |
1487 LOG(WARNING) << "ChromeOSActivateCellularModem failed: " | 1570 LOG(WARNING) << "ChromeOSActivateCellularModem failed: " |
1488 << (error->message ? error->message : "Unknown Error."); | 1571 << (error->message ? error->message : "Unknown Error."); |
1489 return false; | 1572 return false; |
1490 } | 1573 } |
1491 return true; | 1574 return true; |
1492 } | 1575 } |
1493 | 1576 |
| 1577 class ScopedPtrGStrFreeV { |
| 1578 public: |
| 1579 inline void operator()(char** x) const { |
| 1580 g_strfreev(x); |
| 1581 } |
| 1582 }; |
| 1583 |
| 1584 static const char *map_oldprop_to_newprop(const char *oldprop) |
| 1585 { |
| 1586 if (strcmp(oldprop, "key_id") == 0) |
| 1587 return kEAPKeyIDProperty; |
| 1588 if (strcmp(oldprop, "cert_id") == 0) |
| 1589 return kEAPCertIDProperty; |
| 1590 if (strcmp(oldprop, "pin") == 0) |
| 1591 return kEAPPINProperty; |
| 1592 |
| 1593 return NULL; |
| 1594 } |
| 1595 |
| 1596 |
| 1597 |
1494 extern "C" | 1598 extern "C" |
1495 bool ChromeOSConfigureWifiService(const char* ssid, | 1599 bool ChromeOSConfigureWifiService(const char* ssid, |
1496 ConnectionSecurity security, | 1600 ConnectionSecurity security, |
1497 const char* passphrase, | 1601 const char* passphrase, |
1498 const char* identity, | 1602 const char* identity, |
1499 const char* certpath) { | 1603 const char* certpath) { |
1500 | 1604 |
1501 dbus::Proxy manager_proxy(dbus::GetSystemBusConnection(), | 1605 dbus::Proxy manager_proxy(dbus::GetSystemBusConnection(), |
1502 kConnmanServiceName, | 1606 kConnmanServiceName, |
1503 "/", | 1607 "/", |
(...skipping 17 matching lines...) Expand all Loading... |
1521 glib::Value value_cert_path(certpath); | 1625 glib::Value value_cert_path(certpath); |
1522 | 1626 |
1523 ::GHashTable* properties = scoped_properties.get(); | 1627 ::GHashTable* properties = scoped_properties.get(); |
1524 ::g_hash_table_insert(properties, ::g_strdup(kModeProperty), &value_mode); | 1628 ::g_hash_table_insert(properties, ::g_strdup(kModeProperty), &value_mode); |
1525 ::g_hash_table_insert(properties, ::g_strdup(kTypeProperty), &value_type); | 1629 ::g_hash_table_insert(properties, ::g_strdup(kTypeProperty), &value_type); |
1526 ::g_hash_table_insert(properties, ::g_strdup(kSSIDProperty), &value_ssid); | 1630 ::g_hash_table_insert(properties, ::g_strdup(kSSIDProperty), &value_ssid); |
1527 ::g_hash_table_insert(properties, ::g_strdup(kSecurityProperty), | 1631 ::g_hash_table_insert(properties, ::g_strdup(kSecurityProperty), |
1528 &value_security); | 1632 &value_security); |
1529 ::g_hash_table_insert(properties, ::g_strdup(kPassphraseProperty), | 1633 ::g_hash_table_insert(properties, ::g_strdup(kPassphraseProperty), |
1530 &value_passphrase); | 1634 &value_passphrase); |
1531 ::g_hash_table_insert(properties, ::g_strdup(kIdentityProperty), | 1635 ::g_hash_table_insert(properties, ::g_strdup(kEAPIdentityProperty), |
1532 &value_identity); | 1636 &value_identity); |
1533 ::g_hash_table_insert(properties, ::g_strdup(kCertPathProperty), | 1637 |
1534 &value_cert_path); | 1638 // DEPRECATED |
| 1639 // Backwards-compatibility for "CertPath=SETTINGS:key_id=1,cert_id=2,..." |
| 1640 ScopedVector<glib::Value> values; |
| 1641 scoped_ptr_malloc<char *, ScopedPtrGStrFreeV> settings; |
| 1642 if (::g_str_has_prefix(certpath, kCertpathSettingsPrefix)) { |
| 1643 char **settingsp; |
| 1644 settings.reset(::g_strsplit_set( |
| 1645 certpath + strlen(kCertpathSettingsPrefix), ",=", 0)); |
| 1646 for (settingsp = settings.get(); *settingsp != NULL; settingsp += 2) { |
| 1647 const char *key = map_oldprop_to_newprop(*settingsp); |
| 1648 if (key == NULL) { |
| 1649 LOG(WARNING) << "ConfigureWifiService, unknown key '" << key |
| 1650 << "' from certpath "; |
| 1651 continue; |
| 1652 } |
| 1653 glib::Value *value = new glib::Value(*(settingsp + 1)); |
| 1654 values.push_back(value); |
| 1655 ::g_hash_table_insert(properties, ::g_strdup(key), value); |
| 1656 } |
| 1657 // Presume EAP-TLS if we're here |
| 1658 glib::Value *value = new glib::Value("TLS"); |
| 1659 values.push_back(value); |
| 1660 ::g_hash_table_insert(properties, ::g_strdup(kEAPEAPProperty), value); |
| 1661 } else { |
| 1662 ::g_hash_table_insert(properties, ::g_strdup(kEAPClientCertProperty), |
| 1663 &value_cert_path); |
| 1664 } |
1535 | 1665 |
1536 | 1666 |
1537 glib::ScopedError error; | 1667 glib::ScopedError error; |
1538 if (!::dbus_g_proxy_call(manager_proxy.gproxy(), | 1668 if (!::dbus_g_proxy_call(manager_proxy.gproxy(), |
1539 kConfigureWifiServiceFunction, | 1669 kConfigureWifiServiceFunction, |
1540 &Resetter(&error).lvalue(), | 1670 &Resetter(&error).lvalue(), |
1541 ::dbus_g_type_get_map("GHashTable", | 1671 ::dbus_g_type_get_map("GHashTable", |
1542 G_TYPE_STRING, | 1672 G_TYPE_STRING, |
1543 G_TYPE_VALUE), | 1673 G_TYPE_VALUE), |
1544 properties, | 1674 properties, |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1595 G_TYPE_INVALID, | 1725 G_TYPE_INVALID, |
1596 G_TYPE_INVALID)) { | 1726 G_TYPE_INVALID)) { |
1597 LOG(WARNING) << "ConnectToNetwork failed on set identity: " | 1727 LOG(WARNING) << "ConnectToNetwork failed on set identity: " |
1598 << (error->message ? error->message : "Unknown Error."); | 1728 << (error->message ? error->message : "Unknown Error."); |
1599 return false; | 1729 return false; |
1600 } | 1730 } |
1601 } | 1731 } |
1602 | 1732 |
1603 // Set certificate path if non-null. | 1733 // Set certificate path if non-null. |
1604 if (certpath) { | 1734 if (certpath) { |
1605 glib::Value value_certpath(certpath); | 1735 // DEPRECATED |
1606 glib::ScopedError error; | 1736 // Backwards-compatibility for "CertPath=SETTINGS:key_id=1,cert_id=2,..." |
1607 if (!::dbus_g_proxy_call(service_proxy.gproxy(), | 1737 if (::g_str_has_prefix(certpath, kCertpathSettingsPrefix)) { |
1608 kSetPropertyFunction, | 1738 glib::ScopedError error; |
1609 &Resetter(&error).lvalue(), | 1739 char **settingsp; |
1610 G_TYPE_STRING, | 1740 scoped_ptr_malloc<char *, ScopedPtrGStrFreeV> settings( |
1611 kCertPathProperty, | 1741 ::g_strsplit_set(certpath + |
1612 G_TYPE_VALUE, | 1742 strlen(kCertpathSettingsPrefix), ",=", 0)); |
1613 &value_certpath, | 1743 for (settingsp = settings.get(); *settingsp != NULL; settingsp += 2) { |
1614 G_TYPE_INVALID, | 1744 const char *key = map_oldprop_to_newprop(*settingsp); |
1615 G_TYPE_INVALID)) { | 1745 if (key == NULL) { |
1616 LOG(WARNING) << "ConnectToNetwork failed on set certpath: " | 1746 LOG(WARNING) << "ConnectToNetwork, unknown key '" << key |
1617 << (error->message ? error->message : "Unknown Error."); | 1747 << "' from certpath "; |
1618 return false; | 1748 continue; |
| 1749 } |
| 1750 glib::Value value(*(settingsp + 1)); |
| 1751 if (!::dbus_g_proxy_call(service_proxy.gproxy(), |
| 1752 kSetPropertyFunction, |
| 1753 &Resetter(&error).lvalue(), |
| 1754 G_TYPE_STRING, |
| 1755 key, |
| 1756 G_TYPE_VALUE, |
| 1757 &value, |
| 1758 G_TYPE_INVALID, |
| 1759 G_TYPE_INVALID)) { |
| 1760 LOG(WARNING) << "ConnectToNetwork failed on set '" << key |
| 1761 << "' (from certpath): " |
| 1762 << (error->message ? error->message : "Unknown Error."); |
| 1763 return false; |
| 1764 } |
| 1765 } |
| 1766 // Presume EAP-TLS if we're here |
| 1767 glib::Value value("TLS"); |
| 1768 if (!::dbus_g_proxy_call(service_proxy.gproxy(), |
| 1769 kSetPropertyFunction, |
| 1770 &Resetter(&error).lvalue(), |
| 1771 G_TYPE_STRING, |
| 1772 kEAPEAPProperty, |
| 1773 G_TYPE_VALUE, |
| 1774 &value, |
| 1775 G_TYPE_INVALID, |
| 1776 G_TYPE_INVALID)) { |
| 1777 LOG(WARNING) << "ConnectToNetwork failed on set EAP type'" |
| 1778 << "' (from certpath): " |
| 1779 << (error->message ? error->message : "Unknown Error."); |
| 1780 return false; |
| 1781 } |
| 1782 } else { |
| 1783 glib::Value value_certpath(certpath); |
| 1784 glib::ScopedError error; |
| 1785 if (!::dbus_g_proxy_call(service_proxy.gproxy(), |
| 1786 kSetPropertyFunction, |
| 1787 &Resetter(&error).lvalue(), |
| 1788 G_TYPE_STRING, |
| 1789 kEAPClientCertProperty, |
| 1790 G_TYPE_VALUE, |
| 1791 &value_certpath, |
| 1792 G_TYPE_INVALID, |
| 1793 G_TYPE_INVALID)) { |
| 1794 LOG(WARNING) << "ConnectToNetwork failed on set certpath: " |
| 1795 << (error->message ? error->message : "Unknown Error."); |
| 1796 return false; |
| 1797 } |
1619 } | 1798 } |
1620 } | 1799 } |
1621 | 1800 |
1622 // Now try connecting. | 1801 // Now try connecting. |
1623 glib::ScopedError error; | 1802 glib::ScopedError error; |
1624 if (!::dbus_g_proxy_call(service_proxy.gproxy(), | 1803 if (!::dbus_g_proxy_call(service_proxy.gproxy(), |
1625 kConnectFunction, | 1804 kConnectFunction, |
1626 &Resetter(&error).lvalue(), | 1805 &Resetter(&error).lvalue(), |
1627 G_TYPE_INVALID, | 1806 G_TYPE_INVALID, |
1628 G_TYPE_INVALID)) { | 1807 G_TYPE_INVALID)) { |
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2348 } | 2527 } |
2349 DCHECK(properties_array); | 2528 DCHECK(properties_array); |
2350 | 2529 |
2351 CellularDataPlanList *data_plan_list = | 2530 CellularDataPlanList *data_plan_list = |
2352 ParseCellularDataPlanList(properties_array); | 2531 ParseCellularDataPlanList(properties_array); |
2353 g_ptr_array_unref(properties_array); | 2532 g_ptr_array_unref(properties_array); |
2354 return data_plan_list; | 2533 return data_plan_list; |
2355 } | 2534 } |
2356 | 2535 |
2357 } // namespace chromeos | 2536 } // namespace chromeos |
OLD | NEW |