Chromium Code Reviews| 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"; |
|
Jason Glasgow
2011/01/31 13:33:29
Do you want to mark this deprecated? Only used fo
| |
| 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"; | |
|
Jason Glasgow
2011/01/31 13:33:29
Is this the path to the cert?
| |
| 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 // Certificate path (backwards compat only) | |
|
Jason Glasgow
2011/01/31 13:33:29
Would it help to say // DEPRECATED so it is easy t
| |
| 773 default_string = ""; | |
| 774 properties.Retrieve(kCertPathProperty, &default_string); | |
| 775 info->cert_path = NewStringCopy(default_string); | |
| 776 | |
| 711 // Device Info (initialize to NULL) | 777 // Device Info (initialize to NULL) |
| 712 info->device_info = NULL; | 778 info->device_info = NULL; |
| 713 } | 779 } |
| 714 | 780 |
| 715 // Returns a ServiceInfo object populated with data from a | 781 // Returns a ServiceInfo object populated with data from a |
| 716 // given DBus object path. | 782 // given DBus object path. |
| 717 // | 783 // |
| 718 // returns true on success. | 784 // returns true on success. |
| 719 bool GetServiceInfo(const char* path, ServiceInfo *info) { | 785 bool GetServiceInfo(const char* path, ServiceInfo *info) { |
| 720 dbus::Proxy service_proxy(dbus::GetSystemBusConnection(), | 786 dbus::Proxy service_proxy(dbus::GetSystemBusConnection(), |
| (...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1484 "ChromeOSActivateCellularModem: already started activation"; | 1550 "ChromeOSActivateCellularModem: already started activation"; |
| 1485 return true; | 1551 return true; |
| 1486 } | 1552 } |
| 1487 LOG(WARNING) << "ChromeOSActivateCellularModem failed: " | 1553 LOG(WARNING) << "ChromeOSActivateCellularModem failed: " |
| 1488 << (error->message ? error->message : "Unknown Error."); | 1554 << (error->message ? error->message : "Unknown Error."); |
| 1489 return false; | 1555 return false; |
| 1490 } | 1556 } |
| 1491 return true; | 1557 return true; |
| 1492 } | 1558 } |
| 1493 | 1559 |
| 1560 class ScopedPtrGStrFreeV { | |
| 1561 public: | |
| 1562 inline void operator()(char** x) const { | |
| 1563 g_strfreev(x); | |
| 1564 } | |
| 1565 }; | |
| 1566 | |
| 1567 static const char *map_oldprop_to_newprop(const char *oldprop) | |
| 1568 { | |
| 1569 if (strcmp(oldprop, "key_id") == 0) | |
| 1570 return kEAPKeyIDProperty; | |
| 1571 if (strcmp(oldprop, "cert_id") == 0) | |
| 1572 return kEAPCertIDProperty; | |
| 1573 if (strcmp(oldprop, "pin") == 0) | |
| 1574 return kEAPPINProperty; | |
| 1575 | |
| 1576 return NULL; | |
| 1577 } | |
| 1578 | |
| 1579 | |
| 1580 | |
| 1494 extern "C" | 1581 extern "C" |
| 1495 bool ChromeOSConfigureWifiService(const char* ssid, | 1582 bool ChromeOSConfigureWifiService(const char* ssid, |
| 1496 ConnectionSecurity security, | 1583 ConnectionSecurity security, |
| 1497 const char* passphrase, | 1584 const char* passphrase, |
| 1498 const char* identity, | 1585 const char* identity, |
| 1499 const char* certpath) { | 1586 const char* certpath) { |
| 1500 | 1587 |
| 1501 dbus::Proxy manager_proxy(dbus::GetSystemBusConnection(), | 1588 dbus::Proxy manager_proxy(dbus::GetSystemBusConnection(), |
| 1502 kConnmanServiceName, | 1589 kConnmanServiceName, |
| 1503 "/", | 1590 "/", |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 1521 glib::Value value_cert_path(certpath); | 1608 glib::Value value_cert_path(certpath); |
| 1522 | 1609 |
| 1523 ::GHashTable* properties = scoped_properties.get(); | 1610 ::GHashTable* properties = scoped_properties.get(); |
| 1524 ::g_hash_table_insert(properties, ::g_strdup(kModeProperty), &value_mode); | 1611 ::g_hash_table_insert(properties, ::g_strdup(kModeProperty), &value_mode); |
| 1525 ::g_hash_table_insert(properties, ::g_strdup(kTypeProperty), &value_type); | 1612 ::g_hash_table_insert(properties, ::g_strdup(kTypeProperty), &value_type); |
| 1526 ::g_hash_table_insert(properties, ::g_strdup(kSSIDProperty), &value_ssid); | 1613 ::g_hash_table_insert(properties, ::g_strdup(kSSIDProperty), &value_ssid); |
| 1527 ::g_hash_table_insert(properties, ::g_strdup(kSecurityProperty), | 1614 ::g_hash_table_insert(properties, ::g_strdup(kSecurityProperty), |
| 1528 &value_security); | 1615 &value_security); |
| 1529 ::g_hash_table_insert(properties, ::g_strdup(kPassphraseProperty), | 1616 ::g_hash_table_insert(properties, ::g_strdup(kPassphraseProperty), |
| 1530 &value_passphrase); | 1617 &value_passphrase); |
| 1531 ::g_hash_table_insert(properties, ::g_strdup(kIdentityProperty), | 1618 ::g_hash_table_insert(properties, ::g_strdup(kEAPIdentityProperty), |
| 1532 &value_identity); | 1619 &value_identity); |
| 1533 ::g_hash_table_insert(properties, ::g_strdup(kCertPathProperty), | 1620 |
| 1534 &value_cert_path); | 1621 // Backwards-compatibility for "CertPath=SETTINGS:key_id=1,cert_id=2,..." |
| 1622 ScopedVector<glib::Value> values; | |
| 1623 scoped_ptr_malloc<char *, ScopedPtrGStrFreeV> settings; | |
| 1624 if (::g_str_has_prefix(certpath, kCertpathSettingsPrefix)) { | |
| 1625 char **settingsp; | |
| 1626 settings.reset(::g_strsplit_set( | |
| 1627 certpath + strlen(kCertpathSettingsPrefix), ",=", 0)); | |
| 1628 for (settingsp = settings.get(); *settingsp != NULL; settingsp += 2) { | |
| 1629 const char *key = map_oldprop_to_newprop(*settingsp); | |
| 1630 if (key == NULL) | |
| 1631 continue; // TODO(njw): log something? | |
|
Jason Glasgow
2011/01/31 13:33:29
Not really a TODO, since the code is already DEPRE
| |
| 1632 glib::Value *value = new glib::Value(*(settingsp + 1)); | |
| 1633 values.push_back(value); | |
| 1634 ::g_hash_table_insert(properties, ::g_strdup(key), value); | |
| 1635 } | |
| 1636 // Presume EAP-TLS if we're here | |
| 1637 glib::Value *value = new glib::Value("TLS"); | |
| 1638 values.push_back(value); | |
| 1639 ::g_hash_table_insert(properties, ::g_strdup(kEAPEAPProperty), value); | |
| 1640 } else { | |
| 1641 ::g_hash_table_insert(properties, ::g_strdup(kCertPathProperty), | |
|
Jason Glasgow
2011/01/31 13:33:29
Is this not kEAPClientCertProperty? Compare with
| |
| 1642 &value_cert_path); | |
| 1643 } | |
| 1535 | 1644 |
| 1536 | 1645 |
| 1537 glib::ScopedError error; | 1646 glib::ScopedError error; |
| 1538 if (!::dbus_g_proxy_call(manager_proxy.gproxy(), | 1647 if (!::dbus_g_proxy_call(manager_proxy.gproxy(), |
| 1539 kConfigureWifiServiceFunction, | 1648 kConfigureWifiServiceFunction, |
| 1540 &Resetter(&error).lvalue(), | 1649 &Resetter(&error).lvalue(), |
| 1541 ::dbus_g_type_get_map("GHashTable", | 1650 ::dbus_g_type_get_map("GHashTable", |
| 1542 G_TYPE_STRING, | 1651 G_TYPE_STRING, |
| 1543 G_TYPE_VALUE), | 1652 G_TYPE_VALUE), |
| 1544 properties, | 1653 properties, |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1595 G_TYPE_INVALID, | 1704 G_TYPE_INVALID, |
| 1596 G_TYPE_INVALID)) { | 1705 G_TYPE_INVALID)) { |
| 1597 LOG(WARNING) << "ConnectToNetwork failed on set identity: " | 1706 LOG(WARNING) << "ConnectToNetwork failed on set identity: " |
| 1598 << (error->message ? error->message : "Unknown Error."); | 1707 << (error->message ? error->message : "Unknown Error."); |
| 1599 return false; | 1708 return false; |
| 1600 } | 1709 } |
| 1601 } | 1710 } |
| 1602 | 1711 |
| 1603 // Set certificate path if non-null. | 1712 // Set certificate path if non-null. |
| 1604 if (certpath) { | 1713 if (certpath) { |
| 1605 glib::Value value_certpath(certpath); | 1714 // Backwards-compatibility for "CertPath=SETTINGS:key_id=1,cert_id=2,..." |
| 1606 glib::ScopedError error; | 1715 if (::g_str_has_prefix(certpath, kCertpathSettingsPrefix)) { |
| 1607 if (!::dbus_g_proxy_call(service_proxy.gproxy(), | 1716 glib::ScopedError error; |
| 1608 kSetPropertyFunction, | 1717 char **settingsp; |
| 1609 &Resetter(&error).lvalue(), | 1718 char **settings = ::g_strsplit_set( |
|
Jason Glasgow
2011/01/31 13:33:29
Can you use scoped_ptr_malloc<> here?
| |
| 1610 G_TYPE_STRING, | 1719 certpath + strlen(kCertpathSettingsPrefix), ",=", 0); |
| 1611 kCertPathProperty, | 1720 for (settingsp = settings; *settingsp != NULL; settingsp += 2) { |
| 1612 G_TYPE_VALUE, | 1721 const char *key = map_oldprop_to_newprop(*settingsp); |
| 1613 &value_certpath, | 1722 if (key == NULL) { |
| 1614 G_TYPE_INVALID, | 1723 LOG(WARNING) << "ConnectToNetwork, unknown key '" << key |
| 1615 G_TYPE_INVALID)) { | 1724 << "' from certpath "; |
| 1616 LOG(WARNING) << "ConnectToNetwork failed on set certpath: " | 1725 continue; |
| 1617 << (error->message ? error->message : "Unknown Error."); | 1726 } |
| 1618 return false; | 1727 glib::Value value(*(settingsp + 1)); |
| 1728 if (!::dbus_g_proxy_call(service_proxy.gproxy(), | |
| 1729 kSetPropertyFunction, | |
| 1730 &Resetter(&error).lvalue(), | |
| 1731 G_TYPE_STRING, | |
| 1732 key, | |
| 1733 G_TYPE_VALUE, | |
| 1734 &value, | |
| 1735 G_TYPE_INVALID, | |
| 1736 G_TYPE_INVALID)) { | |
| 1737 LOG(WARNING) << "ConnectToNetwork failed on set '" << key | |
| 1738 << "' (from certpath): " | |
| 1739 << (error->message ? error->message : "Unknown Error."); | |
| 1740 return false; | |
|
Jason Glasgow
2011/01/31 13:33:29
You will leak settings here unless you use the sco
| |
| 1741 } | |
| 1742 } | |
| 1743 ::g_strfreev(settings); | |
| 1744 // Presume EAP-TLS if we're here | |
| 1745 glib::Value value("TLS"); | |
| 1746 if (!::dbus_g_proxy_call(service_proxy.gproxy(), | |
| 1747 kSetPropertyFunction, | |
| 1748 &Resetter(&error).lvalue(), | |
| 1749 G_TYPE_STRING, | |
| 1750 kEAPEAPProperty, | |
| 1751 G_TYPE_VALUE, | |
| 1752 &value, | |
| 1753 G_TYPE_INVALID, | |
| 1754 G_TYPE_INVALID)) { | |
| 1755 LOG(WARNING) << "ConnectToNetwork failed on set EAP type'" | |
| 1756 << "' (from certpath): " | |
| 1757 << (error->message ? error->message : "Unknown Error."); | |
| 1758 return false; | |
| 1759 } | |
| 1760 } else { | |
| 1761 glib::Value value_certpath(certpath); | |
| 1762 glib::ScopedError error; | |
| 1763 if (!::dbus_g_proxy_call(service_proxy.gproxy(), | |
| 1764 kSetPropertyFunction, | |
| 1765 &Resetter(&error).lvalue(), | |
| 1766 G_TYPE_STRING, | |
| 1767 kEAPClientCertProperty, | |
|
Jason Glasgow
2011/01/31 13:33:29
See line 1641.
| |
| 1768 G_TYPE_VALUE, | |
| 1769 &value_certpath, | |
| 1770 G_TYPE_INVALID, | |
| 1771 G_TYPE_INVALID)) { | |
| 1772 LOG(WARNING) << "ConnectToNetwork failed on set certpath: " | |
| 1773 << (error->message ? error->message : "Unknown Error."); | |
| 1774 return false; | |
| 1775 } | |
| 1619 } | 1776 } |
| 1620 } | 1777 } |
| 1621 | 1778 |
| 1622 // Now try connecting. | 1779 // Now try connecting. |
| 1623 glib::ScopedError error; | 1780 glib::ScopedError error; |
| 1624 if (!::dbus_g_proxy_call(service_proxy.gproxy(), | 1781 if (!::dbus_g_proxy_call(service_proxy.gproxy(), |
| 1625 kConnectFunction, | 1782 kConnectFunction, |
| 1626 &Resetter(&error).lvalue(), | 1783 &Resetter(&error).lvalue(), |
| 1627 G_TYPE_INVALID, | 1784 G_TYPE_INVALID, |
| 1628 G_TYPE_INVALID)) { | 1785 G_TYPE_INVALID)) { |
| (...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2348 } | 2505 } |
| 2349 DCHECK(properties_array); | 2506 DCHECK(properties_array); |
| 2350 | 2507 |
| 2351 CellularDataPlanList *data_plan_list = | 2508 CellularDataPlanList *data_plan_list = |
| 2352 ParseCellularDataPlanList(properties_array); | 2509 ParseCellularDataPlanList(properties_array); |
| 2353 g_ptr_array_unref(properties_array); | 2510 g_ptr_array_unref(properties_array); |
| 2354 return data_plan_list; | 2511 return data_plan_list; |
| 2355 } | 2512 } |
| 2356 | 2513 |
| 2357 } // namespace chromeos | 2514 } // namespace chromeos |
| OLD | NEW |