summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tdecore/networkbackends/network-manager/network-manager.cpp85
-rw-r--r--tdecore/networkbackends/network-manager/network-manager.h2
-rw-r--r--tdecore/tdenetworkconnections.cpp8
-rw-r--r--tdecore/tdenetworkconnections.h59
4 files changed, 125 insertions, 29 deletions
diff --git a/tdecore/networkbackends/network-manager/network-manager.cpp b/tdecore/networkbackends/network-manager/network-manager.cpp
index d6db41565..32a15c0ad 100644
--- a/tdecore/networkbackends/network-manager/network-manager.cpp
+++ b/tdecore/networkbackends/network-manager/network-manager.cpp
@@ -699,29 +699,29 @@ TQString tdeWiFiAuthTypeToNMWiFiAuthType(TDENetworkWiFiAuthType::TDENetworkWiFiA
return ret;
}
-TDENetworkWiFiWPAVersion::TDENetworkWiFiWPAVersion nmWiFiWPAVersionToTDEWiFiWPAVersion(TQStringList nm) {
- TDENetworkWiFiWPAVersion::TDENetworkWiFiWPAVersion ret = TDENetworkWiFiWPAVersion::Other;
+TDENetworkWiFiWPAVersionFlags::TDENetworkWiFiWPAVersionFlags nmWiFiWPAVersionToTDEWiFiWPAVersion(TQStringList nm) {
+ TDENetworkWiFiWPAVersionFlags::TDENetworkWiFiWPAVersionFlags ret = TDENetworkWiFiWPAVersionFlags::None;
if ((nm.contains("wpa") && nm.contains("rsn")) || (nm.count() < 1)) {
- ret = TDENetworkWiFiWPAVersion::Any;
+ ret |= TDENetworkWiFiWPAVersionFlags::Any;
}
else if (nm.contains("wpa")) {
- ret = TDENetworkWiFiWPAVersion::WPA;
+ ret |= TDENetworkWiFiWPAVersionFlags::WPA;
}
else if (nm.contains("rsn")) {
- ret = TDENetworkWiFiWPAVersion::RSN;
+ ret |= TDENetworkWiFiWPAVersionFlags::RSN;
}
return ret;
}
-TQStringList tdeWiFiWPAVersionToNMWiFiWPAVersion(TDENetworkWiFiWPAVersion::TDENetworkWiFiWPAVersion type) {
+TQStringList tdeWiFiWPAVersionToNMWiFiWPAVersion(TDENetworkWiFiWPAVersionFlags::TDENetworkWiFiWPAVersionFlags type) {
TQStringList ret;
- if (type == TDENetworkWiFiWPAVersion::WPA) {
+ if (type & TDENetworkWiFiWPAVersionFlags::WPA) {
ret.append("wpa");
}
- if (type == TDENetworkWiFiWPAVersion::RSN) {
+ if (type & TDENetworkWiFiWPAVersionFlags::RSN) {
ret.append("rsn");
}
@@ -1868,6 +1868,12 @@ void TDENetworkConnectionManager_BackendNM::loadConnectionInformation() {
TQT_DBusData innerDataValue = *it4;
wiFiConnection->securitySettings.allowedPairWiseCiphers.append(nmWiFiCipherToTDEWiFiCipher(innerDataValue.toString()));
}
+ if ((wiFiConnection->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherWEP40))
+ || (wiFiConnection->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherWEP104))
+ || (wiFiConnection->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherTKIP))
+ || (wiFiConnection->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherCCMP))) {
+ wiFiConnection->securitySettings.allowedPairWiseCiphers.append(TDENetworkWiFiConnectionCipher::Any);
+ }
}
else if (keyValue.lower() == "group") {
TQT_DBusDataValueList valueList = dataValue2.toTQValueList();
@@ -1877,6 +1883,12 @@ void TDENetworkConnectionManager_BackendNM::loadConnectionInformation() {
TQT_DBusData innerDataValue = *it4;
wiFiConnection->securitySettings.allowedGroupWiseCiphers.append(nmWiFiCipherToTDEWiFiCipher(innerDataValue.toString()));
}
+ if ((wiFiConnection->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherWEP40))
+ || (wiFiConnection->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherWEP104))
+ || (wiFiConnection->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherTKIP))
+ || (wiFiConnection->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherCCMP))) {
+ wiFiConnection->securitySettings.allowedGroupWiseCiphers.append(TDENetworkWiFiConnectionCipher::Any);
+ }
}
else if (keyValue.lower() == "leap-username") {
wiFiConnection->securitySettings.leapUsername = dataValue2.toString();
@@ -2244,7 +2256,7 @@ void TDENetworkConnectionManager_BackendNM::loadConnectionInformation() {
connection->ipConfig.connectionFlags &= ~TDENetworkIPConfigurationFlags::IPV4MayUseAsDefaultRoute;
}
}
- if (keyValue.lower() == "routes") {
+ else if (keyValue.lower() == "routes") {
TQT_DBusDataValueList valueList = dataValue2.toTQValueList();
TQT_DBusDataValueList::const_iterator it4;
for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) {
@@ -2277,6 +2289,7 @@ void TDENetworkConnectionManager_BackendNM::loadConnectionInformation() {
connection->ipConfig.routeConfigurations.append(routeConfig);
}
}
+ connection->ipConfig.valid = true;
}
else if (outerKeyValue.lower() == "ipv6") {
if (keyValue.lower() == "addresses") {
@@ -2399,7 +2412,7 @@ void TDENetworkConnectionManager_BackendNM::loadConnectionInformation() {
connection->ipConfig.connectionFlags &= ~TDENetworkIPConfigurationFlags::IPV6MayUseAsDefaultRoute;
}
}
- if (keyValue.lower() == "routes") {
+ else if (keyValue.lower() == "routes") {
TQT_DBusDataValueList valueList = dataValue2.toTQValueList();
TQT_DBusDataValueList::const_iterator it4;
for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) {
@@ -2445,6 +2458,7 @@ void TDENetworkConnectionManager_BackendNM::loadConnectionInformation() {
connection->ipConfig.routeConfigurations.append(routeConfig);
}
}
+ connection->ipConfig.valid = true;
}
}
else {
@@ -2460,7 +2474,7 @@ void TDENetworkConnectionManager_BackendNM::loadConnectionInformation() {
// If the connection's MAC matches my MAC, or if the connection is not locked to any MAC address,
// or if this manager object is not locked to a device, then add this connection to the list
if ((deviceMACAddress == connection->lockedHWAddress) || (!connection->lockedHWAddress.isValid()) || (!deviceMACAddress.isValid())) {
- connection->ipConfig.valid = true;
+ loadConnectionAllowedValues(connection);
m_connectionList->append(connection);
}
}
@@ -2477,6 +2491,29 @@ void TDENetworkConnectionManager_BackendNM::loadConnectionInformation() {
}
}
+void TDENetworkConnectionManager_BackendNM::loadConnectionAllowedValues(TDENetworkConnection* connection) {
+ if (connection) {
+ // Insert all allowed EAP phase 2 methods
+ connection->eapConfig.allowedPhase2NonEAPMethods.clear();
+ connection->eapConfig.allowedPhase2NonEAPMethods.append(TDENetworkIEEE8021xType::MD5);
+ connection->eapConfig.allowedPhase2NonEAPMethods.append(TDENetworkIEEE8021xType::MSCHAPV2);
+ connection->eapConfig.allowedPhase2NonEAPMethods.append(TDENetworkIEEE8021xType::OTP);
+ connection->eapConfig.allowedPhase2NonEAPMethods.append(TDENetworkIEEE8021xType::GTC);
+ connection->eapConfig.allowedPhase2NonEAPMethods.append(TDENetworkIEEE8021xType::TLS);
+
+ connection->eapConfig.allowedPhase2EAPMethods.clear();
+ connection->eapConfig.allowedPhase2EAPMethods.append(TDENetworkIEEE8021xType::PAP);
+ connection->eapConfig.allowedPhase2EAPMethods.append(TDENetworkIEEE8021xType::CHAP);
+ connection->eapConfig.allowedPhase2EAPMethods.append(TDENetworkIEEE8021xType::MSCHAP);
+ connection->eapConfig.allowedPhase2EAPMethods.append(TDENetworkIEEE8021xType::MSCHAPV2);
+ connection->eapConfig.allowedPhase2EAPMethods.append(TDENetworkIEEE8021xType::OTP);
+ connection->eapConfig.allowedPhase2EAPMethods.append(TDENetworkIEEE8021xType::GTC);
+ connection->eapConfig.allowedPhase2EAPMethods.append(TDENetworkIEEE8021xType::TLS);
+
+ connection->eapConfig.allowedValid = true;
+ }
+}
+
// NOTE
// While this separate separate routine is needed to get the secrets, note that secrets must
// be saved using the same connection map save routine that all other settings use above.
@@ -2853,13 +2890,17 @@ bool TDENetworkConnectionManager_BackendNM::saveConnection(TDENetworkConnection*
UPDATE_STRING_SETTING_IF_VALID(connection->eapConfig.forcePEAPVersion, "phase1-peapver", settingsMap)
UPDATE_STRING_SETTING_IF_VALID(connection->eapConfig.forcePEAPLabel, "phase1-peaplabel", settingsMap)
UPDATE_STRING_SETTING_IF_VALID(tdeEAPFastFlagsToNMEAPFastFlags(connection->eapConfig.fastProvisioningFlags), "phase1-fast-provisioning", settingsMap)
- UPDATE_STRING_SETTING_IF_VALID(connection->eapConfig.phase2NonEAPAuthMethod, "phase2-auth", settingsMap)
- UPDATE_STRING_SETTING_IF_VALID(connection->eapConfig.phase2EAPAuthMethod, "phase2-autheap", settingsMap)
}
else {
settingsMap.remove("phase1-peapver");
settingsMap.remove("phase1-peaplabel");
settingsMap.remove("phase1-fast-provisioning");
+ }
+ if (connection->eapConfig.valid) {
+ settingsMap["phase2-auth"] = convertDBUSDataToVariantData(TQT_DBusData::fromString(tdeEAPTypeToNMEAPType(connection->eapConfig.phase2NonEAPAuthMethod)));
+ settingsMap["phase2-autheap"] = convertDBUSDataToVariantData(TQT_DBusData::fromString(tdeEAPTypeToNMEAPType(connection->eapConfig.phase2EAPAuthMethod)));
+ }
+ else {
settingsMap.remove("phase2-auth");
settingsMap.remove("phase2-autheap");
}
@@ -3234,6 +3275,12 @@ bool TDENetworkConnectionManager_BackendNM::saveConnection(TDENetworkConnection*
{
TQT_DBusDataValueList valueList;
{
+ if (wiFiConnection->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::Any)) {
+ if (!wiFiConnection->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherWEP40)) wiFiConnection->securitySettings.allowedPairWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherWEP40);
+ if (!wiFiConnection->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherWEP104)) wiFiConnection->securitySettings.allowedPairWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherWEP104);
+ if (!wiFiConnection->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherTKIP)) wiFiConnection->securitySettings.allowedPairWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherTKIP);
+ if (!wiFiConnection->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherCCMP)) wiFiConnection->securitySettings.allowedPairWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherCCMP);
+ }
for (TDENetworkWiFiConnectionCipherList::Iterator it = wiFiConnection->securitySettings.allowedPairWiseCiphers.begin(); it != wiFiConnection->securitySettings.allowedPairWiseCiphers.end(); ++it) {
valueList.append(TQT_DBusData::fromString(tdeWiFiCipherToNMWiFiCipher(*it)));
}
@@ -3244,6 +3291,12 @@ bool TDENetworkConnectionManager_BackendNM::saveConnection(TDENetworkConnection*
{
TQT_DBusDataValueList valueList;
{
+ if (wiFiConnection->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::Any)) {
+ if (!wiFiConnection->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherWEP40)) wiFiConnection->securitySettings.allowedGroupWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherWEP40);
+ if (!wiFiConnection->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherWEP104)) wiFiConnection->securitySettings.allowedGroupWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherWEP104);
+ if (!wiFiConnection->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherTKIP)) wiFiConnection->securitySettings.allowedGroupWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherTKIP);
+ if (!wiFiConnection->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherCCMP)) wiFiConnection->securitySettings.allowedGroupWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherCCMP);
+ }
for (TDENetworkWiFiConnectionCipherList::Iterator it = wiFiConnection->securitySettings.allowedGroupWiseCiphers.begin(); it != wiFiConnection->securitySettings.allowedGroupWiseCiphers.end(); ++it) {
valueList.append(TQT_DBusData::fromString(tdeWiFiCipherToNMWiFiCipher(*it)));
}
@@ -3988,6 +4041,12 @@ bool TDENetworkConnectionManager_BackendNM::deleteConnection(TQString uuid) {
}
}
+bool TDENetworkConnectionManager_BackendNM::verifyConnectionSettings(TDENetworkConnection* connection) {
+ // FIXME
+ // This should actually attempt to validate the settings!
+ return TRUE;
+}
+
TDENetworkConnectionStatus::TDENetworkConnectionStatus TDENetworkConnectionManager_BackendNM::initiateConnection(TQString uuid) {
TQT_DBusObjectPath existingConnection;
TQT_DBusError error;
diff --git a/tdecore/networkbackends/network-manager/network-manager.h b/tdecore/networkbackends/network-manager/network-manager.h
index 709cd42cf..620841ba3 100644
--- a/tdecore/networkbackends/network-manager/network-manager.h
+++ b/tdecore/networkbackends/network-manager/network-manager.h
@@ -142,9 +142,11 @@ class TDECORE_EXPORT TDENetworkConnectionManager_BackendNM : public TDENetworkCo
virtual TDENetworkDeviceInformation deviceInformation();
virtual void loadConnectionInformation();
+ virtual void loadConnectionAllowedValues(TDENetworkConnection* connection);
virtual bool loadConnectionSecrets(TQString uuid);
virtual bool saveConnection(TDENetworkConnection* connection);
virtual bool deleteConnection(TQString uuid);
+ virtual bool verifyConnectionSettings(TDENetworkConnection* connection);
virtual TDENetworkConnectionStatus::TDENetworkConnectionStatus initiateConnection(TQString uuid);
virtual TDENetworkConnectionStatus::TDENetworkConnectionStatus checkConnectionStatus(TQString uuid);
diff --git a/tdecore/tdenetworkconnections.cpp b/tdecore/tdenetworkconnections.cpp
index fa5405bd4..b3f0d9257 100644
--- a/tdecore/tdenetworkconnections.cpp
+++ b/tdecore/tdenetworkconnections.cpp
@@ -293,6 +293,7 @@ bool TDENetworkSingleRouteConfiguration::isIPv6() {
TDENetworkIEEE8021xConfiguration::TDENetworkIEEE8021xConfiguration() {
valid = false;
+ allowedValid = false;
secretsValid = false;
fastProvisioningFlags = TDENetworkIEEE8021xFastFlags::None;
passwordFlags = TDENetworkPasswordHandlingFlags::None;
@@ -415,7 +416,7 @@ TDENetworkWiFiSecurityConfiguration::TDENetworkWiFiSecurityConfiguration() {
wepKeyIndex = 0;
keyType = TDENetworkWiFiKeyType::Other;
authType = TDENetworkWiFiAuthType::Other;
- wpaVersion = TDENetworkWiFiWPAVersion::Any;
+ wpaVersion = TDENetworkWiFiWPAVersionFlags::Any;
wepKeyFlags = TDENetworkPasswordHandlingFlags::None;
pskFlags = TDENetworkPasswordHandlingFlags::None;
leapPasswordFlags = TDENetworkPasswordHandlingFlags::None;
@@ -835,6 +836,11 @@ bool TDEGlobalNetworkManager::deleteConnection(TQString uuid) {
return m_internalConnectionManager->deleteConnection(uuid);
}
+bool TDEGlobalNetworkManager::verifyConnectionSettings(TDENetworkConnection* connection) {
+ if (!m_internalConnectionManager) return false;
+ return m_internalConnectionManager->verifyConnectionSettings(connection);
+}
+
TDENetworkConnectionStatus::TDENetworkConnectionStatus TDEGlobalNetworkManager::initiateConnection(TQString uuid) {
if (!m_internalConnectionManager) return TDENetworkConnectionStatus::Invalid;
return m_internalConnectionManager->initiateConnection(uuid);
diff --git a/tdecore/tdenetworkconnections.h b/tdecore/tdenetworkconnections.h
index 181abd29f..ded2d58b4 100644
--- a/tdecore/tdenetworkconnections.h
+++ b/tdecore/tdenetworkconnections.h
@@ -276,7 +276,8 @@ namespace TDENetworkWiFiConnectionCipher {
CipherTKIP,
CipherCCMP,
CipherWPA,
- CipherRSN
+ CipherRSN,
+ Any
};
};
@@ -322,16 +323,6 @@ namespace TDENetworkWiFiAuthType {
};
};
-namespace TDENetworkWiFiWPAVersion {
- enum TDENetworkWiFiWPAVersion {
- Any,
- WPA,
- RSN,
- Other,
- Last = Other
- };
-};
-
namespace TDENetworkIEEE8021xType {
enum TDENetworkIEEE8021xType {
None,
@@ -355,6 +346,8 @@ namespace TDENetworkIEEE8021xType {
};
};
+typedef TQValueList<TDENetworkIEEE8021xType::TDENetworkIEEE8021xType> TDENetworkIEEE8021xTypeList;
+
namespace TDENetworkIEEE8021xFastFlags {
enum TDENetworkIEEE8021xFastFlags {
None = 0x00000000,
@@ -365,6 +358,17 @@ namespace TDENetworkIEEE8021xFastFlags {
CREATE_FLAG_BITWISE_MANIPULATION_FUNCTIONS(TDENetworkIEEE8021xFastFlags)
};
+namespace TDENetworkWiFiWPAVersionFlags {
+ enum TDENetworkWiFiWPAVersionFlags {
+ None = 0x00000000,
+ WPA = 0x00000001,
+ RSN = 0x00000002,
+ Any = 0x00000003
+ };
+
+ CREATE_FLAG_BITWISE_MANIPULATION_FUNCTIONS(TDENetworkWiFiWPAVersionFlags)
+};
+
namespace TDENetworkPasswordHandlingFlags {
enum TDENetworkPasswordHandlingFlags {
None = 0x00000000,
@@ -484,7 +488,7 @@ class TDECORE_EXPORT TDEMACAddress
friend bool operator==(const TDEMACAddress &a1, const TDEMACAddress &a2);
};
-bool operator==(const TDEMACAddress &a1, const TDEMACAddress &a2);
+TDECORE_EXPORT bool operator==(const TDEMACAddress &a1, const TDEMACAddress &a2);
typedef TQValueList<TDEMACAddress> TDEMACAddressList;
@@ -533,6 +537,7 @@ class TDENetworkIEEE8021xConfiguration
public:
bool valid;
+ bool allowedValid;
bool secretsValid;
TDENetworkIEEE8021xType::TDENetworkIEEE8021xType type;
TQString userName;
@@ -546,8 +551,10 @@ class TDENetworkIEEE8021xConfiguration
TQString forcePEAPVersion;
TQString forcePEAPLabel;
TDENetworkIEEE8021xFastFlags::TDENetworkIEEE8021xFastFlags fastProvisioningFlags;
- TQString phase2NonEAPAuthMethod;
- TQString phase2EAPAuthMethod;
+ TDENetworkIEEE8021xType::TDENetworkIEEE8021xType phase2NonEAPAuthMethod;
+ TDENetworkIEEE8021xType::TDENetworkIEEE8021xType phase2EAPAuthMethod;
+ TDENetworkIEEE8021xTypeList allowedPhase2NonEAPMethods;
+ TDENetworkIEEE8021xTypeList allowedPhase2EAPMethods;
TQByteArray phase2CaCertificate;
TQString phase2CaFilesPath;
TQString phase2AuthServerCertSubjectMatch;
@@ -662,7 +669,7 @@ class TDENetworkWiFiSecurityConfiguration
bool secretsValid;
TDENetworkWiFiKeyType::TDENetworkWiFiKeyType keyType;
TDENetworkWiFiAuthType::TDENetworkWiFiAuthType authType;
- TDENetworkWiFiWPAVersion::TDENetworkWiFiWPAVersion wpaVersion;
+ TDENetworkWiFiWPAVersionFlags::TDENetworkWiFiWPAVersionFlags wpaVersion;
TDENetworkWiFiConnectionCipher::TDENetworkWiFiConnectionCipher cipher;
TQString wepKey0;
TQString wepKey1;
@@ -959,6 +966,14 @@ class TDECORE_EXPORT TDENetworkConnectionManager : public TQObject
virtual void loadConnectionInformation() = 0;
/**
+ * @param connection a pointer to a TDENetworkConnection object containing a
+ * connection in which to load the values allowed by the backend.
+ * This is normally called as part of loadConnectionInformation(), but should
+ * manually be called immediately after creation of a new TDENetworkConnection object.
+ */
+ virtual void loadConnectionAllowedValues(TDENetworkConnection* connection) = 0;
+
+ /**
* @param uuid a TQString conntaining the UUID of a connection for which to
* load secrets from the configuration backend.
* @return true on success, false on failure.
@@ -980,6 +995,13 @@ class TDECORE_EXPORT TDENetworkConnectionManager : public TQObject
virtual bool deleteConnection(TQString uuid) = 0;
/**
+ * @param connection a pointer to a TDENetworkConnection object containing a
+ * connection for which to verify integrity of all settings.
+ * @return true on success, false if invalid settings are detected.
+ */
+ virtual bool verifyConnectionSettings(TDENetworkConnection* connection) = 0;
+
+ /**
* Initiates a connection with UUID @param uuid.
* @return A TDENetworkConnectionStatus enum value with the current connection status
* The client application should poll for status updates using checkConnectionStatus()
@@ -1177,6 +1199,13 @@ class TDECORE_EXPORT TDEGlobalNetworkManager : public TQObject
virtual bool deleteConnection(TQString uuid);
/**
+ * @param connection a pointer to a TDENetworkConnection object containing a
+ * connection for which to verify integrity of all settings.
+ * @return true on success, false if invalid settings are detected.
+ */
+ virtual bool verifyConnectionSettings(TDENetworkConnection* connection);
+
+ /**
* Initiates a connection with UUID @param uuid.
* @return A TDENetworkConnectionStatus enum value with the current connection status
* The client application should poll for status updates using checkConnectionStatus()