File indexing completed on 2024-04-14 03:57:37

0001 /*
0002     SPDX-FileCopyrightText: 2012-2013 Jan Grulich <jgrulich@redhat.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #include "security8021xsetting.h"
0008 #include "security8021xsetting_p.h"
0009 
0010 #include <QDebug>
0011 
0012 NetworkManager::Security8021xSettingPrivate::Security8021xSettingPrivate()
0013     : name(NM_SETTING_802_1X_SETTING_NAME)
0014     , phase1PeapVer(Security8021xSetting::PeapVersionUnknown)
0015     , phase1PeapLabel(Security8021xSetting::PeapLabelUnknown)
0016     , phase1FastProvisioning(Security8021xSetting::FastProvisioningUnknown)
0017     , phase2AuthMethod(Security8021xSetting::AuthMethodUnknown)
0018     , phase2AuthEapMethod(Security8021xSetting::AuthEapMethodUnknown)
0019     , passwordFlags(NetworkManager::Setting::None)
0020     , passwordRawFlags(NetworkManager::Setting::None)
0021     , privateKeyPasswordFlags(NetworkManager::Setting::None)
0022     , phase2PrivateKeyPasswordFlags(NetworkManager::Setting::None)
0023     , pinFlags(NetworkManager::Setting::None)
0024     , systemCaCerts(false)
0025 {
0026 }
0027 
0028 NetworkManager::Security8021xSetting::Security8021xSetting()
0029     : Setting(Setting::Security8021x)
0030     , d_ptr(new Security8021xSettingPrivate())
0031 {
0032 }
0033 
0034 NetworkManager::Security8021xSetting::Security8021xSetting(const Ptr &other)
0035     : Setting(other)
0036     , d_ptr(new Security8021xSettingPrivate())
0037 {
0038     setEapMethods(other->eapMethods());
0039     setIdentity(other->identity());
0040     setDomainSuffixMatch(other->domainSuffixMatch());
0041     setAnonymousIdentity(other->anonymousIdentity());
0042     setPacFile(other->pacFile());
0043     setCaCertificate(other->caCertificate());
0044     setCaPath(other->caPath());
0045     setSubjectMatch(other->subjectMatch());
0046     setAltSubjectMatches(other->altSubjectMatches());
0047     setClientCertificate(other->clientCertificate());
0048     setPhase1PeapVersion(other->phase1PeapVersion());
0049     setPhase1PeapLabel(other->phase1PeapLabel());
0050     setPhase1FastProvisioning(other->phase1FastProvisioning());
0051     setPhase2AuthMethod(other->phase2AuthMethod());
0052     setPhase2AuthEapMethod(other->phase2AuthEapMethod());
0053     setPhase2CaCertificate(other->phase2CaCertificate());
0054     setPhase2CaPath(other->phase2CaPath());
0055     setPhase2SubjectMatch(other->phase2SubjectMatch());
0056     setPhase2AltSubjectMatches(other->phase2AltSubjectMatches());
0057     setPassword(other->password());
0058     setPasswordFlags(other->passwordFlags());
0059     setPasswordRaw(other->passwordRaw());
0060     setPasswordRawFlags(other->passwordRawFlags());
0061     setPrivateKey(other->privateKey());
0062     setPrivateKeyPassword(other->privateKeyPassword());
0063     setPrivateKeyPasswordFlags(other->privateKeyPasswordFlags());
0064     setPhase2PrivateKey(other->phase2PrivateKey());
0065     setPhase2PrivateKeyPassword(other->phase2PrivateKeyPassword());
0066     setPhase2PrivateKeyPasswordFlags(other->phase2PrivateKeyPasswordFlags());
0067     setSystemCaCertificates(other->systemCaCertificates());
0068 }
0069 
0070 NetworkManager::Security8021xSetting::~Security8021xSetting()
0071 {
0072     delete d_ptr;
0073 }
0074 
0075 QString NetworkManager::Security8021xSetting::name() const
0076 {
0077     Q_D(const Security8021xSetting);
0078 
0079     return d->name;
0080 }
0081 
0082 void NetworkManager::Security8021xSetting::setEapMethods(const QList<NetworkManager::Security8021xSetting::EapMethod> &methods)
0083 {
0084     Q_D(Security8021xSetting);
0085 
0086     d->eap = methods;
0087 }
0088 
0089 QList<NetworkManager::Security8021xSetting::EapMethod> NetworkManager::Security8021xSetting::eapMethods() const
0090 {
0091     Q_D(const Security8021xSetting);
0092 
0093     return d->eap;
0094 }
0095 
0096 void NetworkManager::Security8021xSetting::setIdentity(const QString &identity)
0097 {
0098     Q_D(Security8021xSetting);
0099 
0100     d->identity = identity;
0101 }
0102 
0103 QString NetworkManager::Security8021xSetting::identity() const
0104 {
0105     Q_D(const Security8021xSetting);
0106 
0107     return d->identity;
0108 }
0109 
0110 void NetworkManager::Security8021xSetting::setAnonymousIdentity(const QString &identity)
0111 {
0112     Q_D(Security8021xSetting);
0113 
0114     d->anonymousIdentity = identity;
0115 }
0116 
0117 QString NetworkManager::Security8021xSetting::anonymousIdentity() const
0118 {
0119     Q_D(const Security8021xSetting);
0120 
0121     return d->anonymousIdentity;
0122 }
0123 
0124 void NetworkManager::Security8021xSetting::setDomainSuffixMatch(const QString &domain)
0125 {
0126     Q_D(Security8021xSetting);
0127 
0128     d->domainSuffixMatch = domain;
0129 }
0130 
0131 QString NetworkManager::Security8021xSetting::domainSuffixMatch() const
0132 {
0133     Q_D(const Security8021xSetting);
0134 
0135     return d->domainSuffixMatch;
0136 }
0137 
0138 void NetworkManager::Security8021xSetting::setPacFile(const QString &filePath)
0139 {
0140     Q_D(Security8021xSetting);
0141 
0142     d->pacFile = filePath;
0143 }
0144 
0145 QString NetworkManager::Security8021xSetting::pacFile() const
0146 {
0147     Q_D(const Security8021xSetting);
0148 
0149     return d->pacFile;
0150 }
0151 
0152 void NetworkManager::Security8021xSetting::setCaCertificate(const QByteArray &certificate)
0153 {
0154     Q_D(Security8021xSetting);
0155 
0156     d->caCert = certificate;
0157 }
0158 
0159 QByteArray NetworkManager::Security8021xSetting::caCertificate() const
0160 {
0161     Q_D(const Security8021xSetting);
0162 
0163     return d->caCert;
0164 }
0165 
0166 void NetworkManager::Security8021xSetting::setCaPath(const QString &path)
0167 {
0168     Q_D(Security8021xSetting);
0169 
0170     d->caPath = path;
0171 }
0172 
0173 QString NetworkManager::Security8021xSetting::caPath() const
0174 {
0175     Q_D(const Security8021xSetting);
0176 
0177     return d->caPath;
0178 }
0179 
0180 void NetworkManager::Security8021xSetting::setSubjectMatch(const QString &substring)
0181 {
0182     Q_D(Security8021xSetting);
0183 
0184     d->subjectMatch = substring;
0185 }
0186 
0187 QString NetworkManager::Security8021xSetting::subjectMatch() const
0188 {
0189     Q_D(const Security8021xSetting);
0190 
0191     return d->subjectMatch;
0192 }
0193 
0194 void NetworkManager::Security8021xSetting::setAltSubjectMatches(const QStringList &strings)
0195 {
0196     Q_D(Security8021xSetting);
0197 
0198     d->altSubjectMatches = strings;
0199 }
0200 
0201 QStringList NetworkManager::Security8021xSetting::altSubjectMatches() const
0202 {
0203     Q_D(const Security8021xSetting);
0204 
0205     return d->altSubjectMatches;
0206 }
0207 
0208 void NetworkManager::Security8021xSetting::setClientCertificate(const QByteArray &certificate)
0209 {
0210     Q_D(Security8021xSetting);
0211 
0212     d->clientCert = certificate;
0213 }
0214 
0215 QByteArray NetworkManager::Security8021xSetting::clientCertificate() const
0216 {
0217     Q_D(const Security8021xSetting);
0218 
0219     return d->clientCert;
0220 }
0221 
0222 void NetworkManager::Security8021xSetting::setPhase1PeapVersion(NetworkManager::Security8021xSetting::PeapVersion version)
0223 {
0224     Q_D(Security8021xSetting);
0225 
0226     d->phase1PeapVer = version;
0227 }
0228 
0229 NetworkManager::Security8021xSetting::PeapVersion NetworkManager::Security8021xSetting::phase1PeapVersion() const
0230 {
0231     Q_D(const Security8021xSetting);
0232 
0233     return d->phase1PeapVer;
0234 }
0235 
0236 void NetworkManager::Security8021xSetting::setPhase1PeapLabel(NetworkManager::Security8021xSetting::PeapLabel label)
0237 {
0238     Q_D(Security8021xSetting);
0239 
0240     d->phase1PeapLabel = label;
0241 }
0242 
0243 NetworkManager::Security8021xSetting::PeapLabel NetworkManager::Security8021xSetting::phase1PeapLabel() const
0244 {
0245     Q_D(const Security8021xSetting);
0246 
0247     return d->phase1PeapLabel;
0248 }
0249 
0250 void NetworkManager::Security8021xSetting::setPhase1FastProvisioning(NetworkManager::Security8021xSetting::FastProvisioning provisioning)
0251 {
0252     Q_D(Security8021xSetting);
0253 
0254     d->phase1FastProvisioning = provisioning;
0255 }
0256 
0257 NetworkManager::Security8021xSetting::FastProvisioning NetworkManager::Security8021xSetting::phase1FastProvisioning() const
0258 {
0259     Q_D(const Security8021xSetting);
0260 
0261     return d->phase1FastProvisioning;
0262 }
0263 
0264 void NetworkManager::Security8021xSetting::setPhase2AuthMethod(NetworkManager::Security8021xSetting::AuthMethod method)
0265 {
0266     Q_D(Security8021xSetting);
0267 
0268     d->phase2AuthMethod = method;
0269 }
0270 
0271 NetworkManager::Security8021xSetting::AuthMethod NetworkManager::Security8021xSetting::phase2AuthMethod() const
0272 {
0273     Q_D(const Security8021xSetting);
0274 
0275     return d->phase2AuthMethod;
0276 }
0277 
0278 void NetworkManager::Security8021xSetting::setPhase2AuthEapMethod(NetworkManager::Security8021xSetting::AuthEapMethod method)
0279 {
0280     Q_D(Security8021xSetting);
0281 
0282     d->phase2AuthEapMethod = method;
0283 }
0284 
0285 NetworkManager::Security8021xSetting::AuthEapMethod NetworkManager::Security8021xSetting::phase2AuthEapMethod() const
0286 {
0287     Q_D(const Security8021xSetting);
0288 
0289     return d->phase2AuthEapMethod;
0290 }
0291 
0292 void NetworkManager::Security8021xSetting::setPhase2CaCertificate(const QByteArray &certificate)
0293 {
0294     Q_D(Security8021xSetting);
0295 
0296     d->phase2CaCert = certificate;
0297 }
0298 
0299 QByteArray NetworkManager::Security8021xSetting::phase2CaCertificate() const
0300 {
0301     Q_D(const Security8021xSetting);
0302 
0303     return d->phase2CaCert;
0304 }
0305 
0306 void NetworkManager::Security8021xSetting::setPhase2CaPath(const QString &path)
0307 {
0308     Q_D(Security8021xSetting);
0309 
0310     d->phase2CaPath = path;
0311 }
0312 
0313 QString NetworkManager::Security8021xSetting::phase2CaPath() const
0314 {
0315     Q_D(const Security8021xSetting);
0316 
0317     return d->phase2CaPath;
0318 }
0319 
0320 void NetworkManager::Security8021xSetting::setPhase2SubjectMatch(const QString &substring)
0321 {
0322     Q_D(Security8021xSetting);
0323 
0324     d->phase2SubjectMatch = substring;
0325 }
0326 
0327 QString NetworkManager::Security8021xSetting::phase2SubjectMatch() const
0328 {
0329     Q_D(const Security8021xSetting);
0330 
0331     return d->phase2SubjectMatch;
0332 }
0333 
0334 void NetworkManager::Security8021xSetting::setPhase2AltSubjectMatches(const QStringList &strings)
0335 {
0336     Q_D(Security8021xSetting);
0337 
0338     d->phase2AltSubjectMatches = strings;
0339 }
0340 
0341 QStringList NetworkManager::Security8021xSetting::phase2AltSubjectMatches() const
0342 {
0343     Q_D(const Security8021xSetting);
0344 
0345     return d->phase2AltSubjectMatches;
0346 }
0347 
0348 void NetworkManager::Security8021xSetting::setPhase2ClientCertificate(const QByteArray &certificate)
0349 {
0350     Q_D(Security8021xSetting);
0351 
0352     d->phase2ClientCert = certificate;
0353 }
0354 
0355 QByteArray NetworkManager::Security8021xSetting::phase2ClientCertificate() const
0356 {
0357     Q_D(const Security8021xSetting);
0358 
0359     return d->phase2ClientCert;
0360 }
0361 
0362 void NetworkManager::Security8021xSetting::setPassword(const QString &password)
0363 {
0364     Q_D(Security8021xSetting);
0365 
0366     d->password = password;
0367 }
0368 
0369 QString NetworkManager::Security8021xSetting::password() const
0370 {
0371     Q_D(const Security8021xSetting);
0372 
0373     return d->password;
0374 }
0375 
0376 void NetworkManager::Security8021xSetting::setPasswordFlags(NetworkManager::Setting::SecretFlags flags)
0377 {
0378     Q_D(Security8021xSetting);
0379 
0380     d->passwordFlags = flags;
0381 }
0382 
0383 NetworkManager::Setting::SecretFlags NetworkManager::Security8021xSetting::passwordFlags() const
0384 {
0385     Q_D(const Security8021xSetting);
0386 
0387     return d->passwordFlags;
0388 }
0389 
0390 void NetworkManager::Security8021xSetting::setPasswordRaw(const QByteArray &password)
0391 {
0392     Q_D(Security8021xSetting);
0393 
0394     d->passwordRaw = password;
0395 }
0396 
0397 QByteArray NetworkManager::Security8021xSetting::passwordRaw() const
0398 {
0399     Q_D(const Security8021xSetting);
0400 
0401     return d->passwordRaw;
0402 }
0403 
0404 void NetworkManager::Security8021xSetting::setPasswordRawFlags(NetworkManager::Setting::SecretFlags flags)
0405 {
0406     Q_D(Security8021xSetting);
0407 
0408     d->passwordRawFlags = flags;
0409 }
0410 
0411 NetworkManager::Setting::SecretFlags NetworkManager::Security8021xSetting::passwordRawFlags() const
0412 {
0413     Q_D(const Security8021xSetting);
0414 
0415     return d->passwordRawFlags;
0416 }
0417 
0418 void NetworkManager::Security8021xSetting::setPrivateKey(const QByteArray &key)
0419 {
0420     Q_D(Security8021xSetting);
0421 
0422     d->privateKey = key;
0423 }
0424 
0425 QByteArray NetworkManager::Security8021xSetting::privateKey() const
0426 {
0427     Q_D(const Security8021xSetting);
0428 
0429     return d->privateKey;
0430 }
0431 
0432 void NetworkManager::Security8021xSetting::setPrivateKeyPassword(const QString &password)
0433 {
0434     Q_D(Security8021xSetting);
0435 
0436     d->privateKeyPassword = password;
0437 }
0438 
0439 QString NetworkManager::Security8021xSetting::privateKeyPassword() const
0440 {
0441     Q_D(const Security8021xSetting);
0442 
0443     return d->privateKeyPassword;
0444 }
0445 
0446 void NetworkManager::Security8021xSetting::setPrivateKeyPasswordFlags(NetworkManager::Setting::SecretFlags flags)
0447 {
0448     Q_D(Security8021xSetting);
0449 
0450     d->privateKeyPasswordFlags = flags;
0451 }
0452 
0453 NetworkManager::Setting::SecretFlags NetworkManager::Security8021xSetting::privateKeyPasswordFlags() const
0454 {
0455     Q_D(const Security8021xSetting);
0456 
0457     return d->privateKeyPasswordFlags;
0458 }
0459 
0460 void NetworkManager::Security8021xSetting::setPhase2PrivateKey(const QByteArray &key)
0461 {
0462     Q_D(Security8021xSetting);
0463 
0464     d->phase2PrivateKey = key;
0465 }
0466 
0467 QByteArray NetworkManager::Security8021xSetting::phase2PrivateKey() const
0468 {
0469     Q_D(const Security8021xSetting);
0470 
0471     return d->phase2PrivateKey;
0472 }
0473 
0474 void NetworkManager::Security8021xSetting::setPhase2PrivateKeyPassword(const QString &password)
0475 {
0476     Q_D(Security8021xSetting);
0477 
0478     d->phase2PrivateKeyPassword = password;
0479 }
0480 
0481 QString NetworkManager::Security8021xSetting::phase2PrivateKeyPassword() const
0482 {
0483     Q_D(const Security8021xSetting);
0484 
0485     return d->phase2PrivateKeyPassword;
0486 }
0487 
0488 void NetworkManager::Security8021xSetting::setPhase2PrivateKeyPasswordFlags(NetworkManager::Setting::SecretFlags flags)
0489 {
0490     Q_D(Security8021xSetting);
0491 
0492     d->phase2PrivateKeyPasswordFlags = flags;
0493 }
0494 
0495 NetworkManager::Setting::SecretFlags NetworkManager::Security8021xSetting::phase2PrivateKeyPasswordFlags() const
0496 {
0497     Q_D(const Security8021xSetting);
0498 
0499     return d->phase2PrivateKeyPasswordFlags;
0500 }
0501 
0502 void NetworkManager::Security8021xSetting::setSystemCaCertificates(bool use)
0503 {
0504     Q_D(Security8021xSetting);
0505 
0506     d->systemCaCerts = use;
0507 }
0508 
0509 void NetworkManager::Security8021xSetting::setPin(const QString &pin)
0510 {
0511     Q_D(Security8021xSetting);
0512 
0513     d->pin = pin;
0514 }
0515 
0516 QString NetworkManager::Security8021xSetting::pin() const
0517 {
0518     Q_D(const Security8021xSetting);
0519 
0520     return d->pin;
0521 }
0522 
0523 void NetworkManager::Security8021xSetting::setPinFlags(NetworkManager::Setting::SecretFlags flags)
0524 {
0525     Q_D(Security8021xSetting);
0526 
0527     d->pinFlags = flags;
0528 }
0529 
0530 NetworkManager::Setting::SecretFlags NetworkManager::Security8021xSetting::pinFlags() const
0531 {
0532     Q_D(const Security8021xSetting);
0533 
0534     return d->pinFlags;
0535 }
0536 
0537 bool NetworkManager::Security8021xSetting::systemCaCertificates() const
0538 {
0539     Q_D(const Security8021xSetting);
0540 
0541     return d->systemCaCerts;
0542 }
0543 
0544 QStringList NetworkManager::Security8021xSetting::needSecrets(bool requestNew) const
0545 {
0546     QStringList secrets;
0547 
0548     /* clang-format off */
0549     if (eapMethods().contains(EapMethodTls)
0550         && (privateKeyPassword().isEmpty() || requestNew)
0551         && !privateKeyPasswordFlags().testFlag(NotRequired)) {
0552         secrets << QLatin1String(NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD);
0553     } else if ((eapMethods().contains(EapMethodTtls)
0554                     || eapMethods().contains(EapMethodPeap)
0555                     || eapMethods().contains(EapMethodLeap)
0556                     || eapMethods().contains(EapMethodFast)
0557                     || eapMethods().contains(EapMethodPwd))
0558                && (password().isEmpty() || requestNew)
0559                && !passwordFlags().testFlag(NotRequired)) {
0560         secrets << QLatin1String(NM_SETTING_802_1X_PASSWORD);
0561         secrets << QLatin1String(NM_SETTING_802_1X_PASSWORD_RAW);
0562     } else if (eapMethods().contains(EapMethodSim)
0563                && (pin().isEmpty() || requestNew)
0564                && !pinFlags().testFlag(NotRequired)) { /* clang-format on */
0565         secrets << QLatin1String(NM_SETTING_802_1X_PIN);
0566     }
0567 
0568     /* clang-format off */
0569     if ((phase2AuthMethod() == AuthMethodTls || phase2AuthEapMethod() == AuthEapMethodTls)
0570         && (phase2PrivateKeyPassword().isEmpty() || requestNew)
0571         && !phase2PrivateKeyPasswordFlags().testFlag(NotRequired)) { /* clang-format on */
0572         secrets << QLatin1String(NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD);
0573     }
0574 
0575     return secrets;
0576 }
0577 
0578 void NetworkManager::Security8021xSetting::secretsFromMap(const QVariantMap &secrets)
0579 {
0580     if (secrets.contains(QLatin1String(NM_SETTING_802_1X_PASSWORD))) {
0581         setPassword(secrets.value(QLatin1String(NM_SETTING_802_1X_PASSWORD)).toString());
0582     }
0583 
0584     if (secrets.contains(QLatin1String(NM_SETTING_802_1X_PASSWORD_RAW))) {
0585         setPasswordRaw(secrets.value(QLatin1String(NM_SETTING_802_1X_PASSWORD_RAW)).toByteArray());
0586     }
0587 
0588     if (secrets.contains(QLatin1String(NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD))) {
0589         setPrivateKeyPassword(secrets.value(QLatin1String(NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD)).toString());
0590     }
0591 
0592     if (secrets.contains(QLatin1String(NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD))) {
0593         setPhase2PrivateKeyPassword(secrets.value(QLatin1String(NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD)).toString());
0594     }
0595 
0596     if (secrets.contains(QLatin1String(NM_SETTING_802_1X_PIN))) {
0597         setPin(secrets.value(QLatin1String(NM_SETTING_802_1X_PIN)).toString());
0598     }
0599 }
0600 
0601 QVariantMap NetworkManager::Security8021xSetting::secretsToMap() const
0602 {
0603     QVariantMap secrets;
0604 
0605     if (!password().isEmpty()) {
0606         secrets.insert(QLatin1String(NM_SETTING_802_1X_PASSWORD), password());
0607     }
0608 
0609     if (!passwordRaw().isEmpty()) {
0610         secrets.insert(QLatin1String(NM_SETTING_802_1X_PASSWORD_RAW), passwordRaw());
0611     }
0612 
0613     if (!privateKeyPassword().isEmpty()) {
0614         secrets.insert(QLatin1String(NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD), privateKeyPassword());
0615     }
0616 
0617     if (!phase2PrivateKeyPassword().isEmpty()) {
0618         secrets.insert(QLatin1String(NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD), phase2PrivateKeyPassword());
0619     }
0620 
0621     if (!pin().isEmpty()) {
0622         secrets.insert(QLatin1String(NM_SETTING_802_1X_PIN), pin());
0623     }
0624 
0625     return secrets;
0626 }
0627 
0628 void NetworkManager::Security8021xSetting::fromMap(const QVariantMap &setting)
0629 {
0630     if (setting.contains(QLatin1String(NM_SETTING_802_1X_EAP))) {
0631         const QStringList methods = setting.value(QLatin1String(NM_SETTING_802_1X_EAP)).toStringList();
0632         QList<EapMethod> eapMethods;
0633         for (const QString &method : methods) {
0634             if (method == "leap") {
0635                 eapMethods << EapMethodLeap;
0636             } else if (method == "md5") {
0637                 eapMethods << EapMethodMd5;
0638             } else if (method == "tls") {
0639                 eapMethods << EapMethodTls;
0640             } else if (method == "peap") {
0641                 eapMethods << EapMethodPeap;
0642             } else if (method == "ttls") {
0643                 eapMethods << EapMethodTtls;
0644             } else if (method == "sim") {
0645                 eapMethods << EapMethodSim;
0646             } else if (method == "fast") {
0647                 eapMethods << EapMethodFast;
0648             } else if (method == "pwd") {
0649                 eapMethods << EapMethodPwd;
0650             }
0651         }
0652 
0653         setEapMethods(eapMethods);
0654     }
0655 
0656     if (setting.contains(QLatin1String(NM_SETTING_802_1X_IDENTITY))) {
0657         setIdentity(setting.value(QLatin1String(NM_SETTING_802_1X_IDENTITY)).toString());
0658     }
0659 
0660     if (setting.contains(QLatin1String(NM_SETTING_802_1X_ANONYMOUS_IDENTITY))) {
0661         setAnonymousIdentity(setting.value(QLatin1String(NM_SETTING_802_1X_ANONYMOUS_IDENTITY)).toString());
0662     }
0663 
0664     if (setting.contains(QLatin1String(NM_SETTING_802_1X_DOMAIN_SUFFIX_MATCH))) {
0665         setDomainSuffixMatch(setting.value(QLatin1String(NM_SETTING_802_1X_DOMAIN_SUFFIX_MATCH)).toString());
0666     }
0667 
0668     if (setting.contains(QLatin1String(NM_SETTING_802_1X_PAC_FILE))) {
0669         setPacFile(setting.value(QLatin1String(NM_SETTING_802_1X_PAC_FILE)).toString());
0670     }
0671 
0672     if (setting.contains(QLatin1String(NM_SETTING_802_1X_CA_CERT))) {
0673         setCaCertificate(setting.value(QLatin1String(NM_SETTING_802_1X_CA_CERT)).toByteArray());
0674     }
0675 
0676     if (setting.contains(QLatin1String(NM_SETTING_802_1X_CA_PATH))) {
0677         setCaPath(setting.value(QLatin1String(NM_SETTING_802_1X_CA_PATH)).toString());
0678     }
0679 
0680     if (setting.contains(QLatin1String(NM_SETTING_802_1X_SUBJECT_MATCH))) {
0681         setSubjectMatch(setting.value(QLatin1String(NM_SETTING_802_1X_SUBJECT_MATCH)).toString());
0682     }
0683 
0684     if (setting.contains(QLatin1String(NM_SETTING_802_1X_ALTSUBJECT_MATCHES))) {
0685         setAltSubjectMatches(setting.value(QLatin1String(NM_SETTING_802_1X_ALTSUBJECT_MATCHES)).toStringList());
0686     }
0687 
0688     if (setting.contains(QLatin1String(NM_SETTING_802_1X_CLIENT_CERT))) {
0689         setClientCertificate(setting.value(QLatin1String(NM_SETTING_802_1X_CLIENT_CERT)).toByteArray());
0690     }
0691 
0692     if (setting.contains(QLatin1String(NM_SETTING_802_1X_PHASE1_PEAPVER))) {
0693         const QString version = setting.value(QLatin1String(NM_SETTING_802_1X_PHASE1_PEAPVER)).toString();
0694 
0695         if (version == "0") {
0696             setPhase1PeapVersion(PeapVersionZero);
0697         } else if (version == "1") {
0698             setPhase1PeapVersion(PeapVersionOne);
0699         }
0700     }
0701 
0702     if (setting.contains(QLatin1String(NM_SETTING_802_1X_PHASE1_PEAPLABEL))) {
0703         const QString label = setting.value(QLatin1String(NM_SETTING_802_1X_PHASE1_PEAPLABEL)).toString();
0704 
0705         if (label == "1") {
0706             setPhase1PeapLabel(PeapLabelForce);
0707         }
0708     }
0709 
0710     if (setting.contains(QLatin1String(NM_SETTING_802_1X_PHASE1_FAST_PROVISIONING))) {
0711         const QString provisioning = setting.value(QLatin1String(NM_SETTING_802_1X_PHASE1_FAST_PROVISIONING)).toString();
0712 
0713         if (provisioning == "0") {
0714             setPhase1FastProvisioning(FastProvisioningDisabled);
0715         } else if (provisioning == "1") {
0716             setPhase1FastProvisioning(FastProvisioningAllowUnauthenticated);
0717         } else if (provisioning == "2") {
0718             setPhase1FastProvisioning(FastProvisioningAllowAuthenticated);
0719         } else if (provisioning == "3") {
0720             setPhase1FastProvisioning(FastProvisioningAllowBoth);
0721         }
0722     }
0723 
0724     if (setting.contains(QLatin1String(NM_SETTING_802_1X_PHASE2_AUTH))) {
0725         const QString authMethod = setting.value(QLatin1String(NM_SETTING_802_1X_PHASE2_AUTH)).toString();
0726 
0727         if (authMethod == "pap") {
0728             setPhase2AuthMethod(AuthMethodPap);
0729         } else if (authMethod == "chap") {
0730             setPhase2AuthMethod(AuthMethodChap);
0731         } else if (authMethod == "mschap") {
0732             setPhase2AuthMethod(AuthMethodMschap);
0733         } else if (authMethod == "mschapv2") {
0734             setPhase2AuthMethod(AuthMethodMschapv2);
0735         } else if (authMethod == "gtc") {
0736             setPhase2AuthMethod(AuthMethodGtc);
0737         } else if (authMethod == "otp") {
0738             setPhase2AuthMethod(AuthMethodOtp);
0739         } else if (authMethod == "md5") {
0740             setPhase2AuthMethod(AuthMethodMd5);
0741         } else if (authMethod == "tls") {
0742             setPhase2AuthMethod(AuthMethodTls);
0743         }
0744     }
0745 
0746     if (setting.contains(QLatin1String(NM_SETTING_802_1X_PHASE2_AUTHEAP))) {
0747         const QString authEapMethod = setting.value(QLatin1String(NM_SETTING_802_1X_PHASE2_AUTHEAP)).toString();
0748 
0749         if (authEapMethod == "md5") {
0750             setPhase2AuthEapMethod(AuthEapMethodMd5);
0751         } else if (authEapMethod == "mschapv2") {
0752             setPhase2AuthEapMethod(AuthEapMethodMschapv2);
0753         } else if (authEapMethod == "otp") {
0754             setPhase2AuthEapMethod(AuthEapMethodOtp);
0755         } else if (authEapMethod == "gtc") {
0756             setPhase2AuthEapMethod(AuthEapMethodGtc);
0757         } else if (authEapMethod == "tls") {
0758             setPhase2AuthEapMethod(AuthEapMethodTls);
0759         }
0760     }
0761 
0762     if (setting.contains(QLatin1String(NM_SETTING_802_1X_PHASE2_CA_CERT))) {
0763         setPhase2CaCertificate(setting.value(QLatin1String(NM_SETTING_802_1X_PHASE2_CA_CERT)).toByteArray());
0764     }
0765 
0766     if (setting.contains(QLatin1String(NM_SETTING_802_1X_PHASE2_CA_PATH))) {
0767         setPhase2CaPath(setting.value(QLatin1String(NM_SETTING_802_1X_PHASE2_CA_PATH)).toString());
0768     }
0769 
0770     if (setting.contains(QLatin1String(NM_SETTING_802_1X_PHASE2_SUBJECT_MATCH))) {
0771         setPhase2SubjectMatch(setting.value(QLatin1String(NM_SETTING_802_1X_PHASE2_SUBJECT_MATCH)).toString());
0772     }
0773 
0774     if (setting.contains(QLatin1String(NM_SETTING_802_1X_PHASE2_ALTSUBJECT_MATCHES))) {
0775         setPhase2AltSubjectMatches(setting.value(QLatin1String(NM_SETTING_802_1X_PHASE2_ALTSUBJECT_MATCHES)).toStringList());
0776     }
0777 
0778     if (setting.contains(QLatin1String(NM_SETTING_802_1X_PHASE2_CLIENT_CERT))) {
0779         setPhase2ClientCertificate(setting.value(QLatin1String(NM_SETTING_802_1X_PHASE2_CLIENT_CERT)).toByteArray());
0780     }
0781 
0782     if (setting.contains(QLatin1String(NM_SETTING_802_1X_PASSWORD))) {
0783         setPassword(setting.value(QLatin1String(NM_SETTING_802_1X_PASSWORD)).toString());
0784     }
0785 
0786     if (setting.contains(QLatin1String(NM_SETTING_802_1X_PASSWORD_FLAGS))) {
0787         setPasswordFlags((Setting::SecretFlags)setting.value(QLatin1String(NM_SETTING_802_1X_PASSWORD_FLAGS)).toUInt());
0788     }
0789 
0790     if (setting.contains(QLatin1String(NM_SETTING_802_1X_PASSWORD_RAW))) {
0791         setPasswordRaw(setting.value(QLatin1String(NM_SETTING_802_1X_PASSWORD_RAW)).toByteArray());
0792     }
0793 
0794     if (setting.contains(QLatin1String(NM_SETTING_802_1X_PASSWORD_RAW_FLAGS))) {
0795         setPasswordRawFlags((Setting::SecretFlags)setting.value(QLatin1String(NM_SETTING_802_1X_PASSWORD_RAW_FLAGS)).toUInt());
0796     }
0797 
0798     if (setting.contains(QLatin1String(NM_SETTING_802_1X_PRIVATE_KEY))) {
0799         setPrivateKey(setting.value(QLatin1String(NM_SETTING_802_1X_PRIVATE_KEY)).toByteArray());
0800     }
0801 
0802     if (setting.contains(QLatin1String(NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD))) {
0803         setPrivateKeyPassword(setting.value(QLatin1String(NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD)).toString());
0804     }
0805 
0806     if (setting.contains(QLatin1String(NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD_FLAGS))) {
0807         setPrivateKeyPasswordFlags((Setting::SecretFlags)setting.value(QLatin1String(NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD_FLAGS)).toUInt());
0808     }
0809 
0810     if (setting.contains(QLatin1String(NM_SETTING_802_1X_PHASE2_PRIVATE_KEY))) {
0811         setPhase2PrivateKey(setting.value(QLatin1String(NM_SETTING_802_1X_PHASE2_PRIVATE_KEY)).toByteArray());
0812     }
0813 
0814     if (setting.contains(QLatin1String(NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD))) {
0815         setPhase2PrivateKeyPassword(setting.value(QLatin1String(NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD)).toString());
0816     }
0817 
0818     if (setting.contains(QLatin1String(NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD_FLAGS))) {
0819         setPhase2PrivateKeyPasswordFlags((Setting::SecretFlags)setting.value(QLatin1String(NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD_FLAGS)).toUInt());
0820     }
0821 
0822     if (setting.contains(QLatin1String(NM_SETTING_802_1X_PIN))) {
0823         setPin(setting.value(QLatin1String(NM_SETTING_802_1X_PIN)).toString());
0824     }
0825 
0826     if (setting.contains(QLatin1String(NM_SETTING_802_1X_PIN_FLAGS))) {
0827         setPinFlags((Setting::SecretFlags)setting.value(QLatin1String(NM_SETTING_802_1X_PIN_FLAGS)).toUInt());
0828     }
0829 
0830     if (setting.contains(QLatin1String(NM_SETTING_802_1X_SYSTEM_CA_CERTS))) {
0831         setSystemCaCertificates(setting.value(QLatin1String(NM_SETTING_802_1X_SYSTEM_CA_CERTS)).toBool());
0832     }
0833 }
0834 
0835 QVariantMap NetworkManager::Security8021xSetting::toMap() const
0836 {
0837     QVariantMap setting;
0838 
0839     if (!eapMethods().isEmpty()) {
0840         QStringList methods;
0841 
0842         const auto methodList = eapMethods();
0843         for (const EapMethod &method : methodList) {
0844             if (method == EapMethodLeap) {
0845                 methods << "leap";
0846             } else if (method == EapMethodMd5) {
0847                 methods << "md5";
0848             } else if (method == EapMethodTls) {
0849                 methods << "tls";
0850             } else if (method == EapMethodPeap) {
0851                 methods << "peap";
0852             } else if (method == EapMethodTtls) {
0853                 methods << "ttls";
0854             } else if (method == EapMethodSim) {
0855                 methods << "sim";
0856             } else if (method == EapMethodFast) {
0857                 methods << "fast";
0858             } else if (method == EapMethodPwd) {
0859                 methods << "pwd";
0860             }
0861         }
0862 
0863         setting.insert(QLatin1String(NM_SETTING_802_1X_EAP), methods);
0864     }
0865 
0866     if (!identity().isEmpty()) {
0867         setting.insert(QLatin1String(NM_SETTING_802_1X_IDENTITY), identity());
0868     }
0869 
0870     if (!anonymousIdentity().isEmpty()) {
0871         setting.insert(QLatin1String(NM_SETTING_802_1X_ANONYMOUS_IDENTITY), anonymousIdentity());
0872     }
0873 
0874     if (!domainSuffixMatch().isEmpty()) {
0875         setting.insert(QLatin1String(NM_SETTING_802_1X_DOMAIN_SUFFIX_MATCH), domainSuffixMatch());
0876     }
0877 
0878     if (!pacFile().isEmpty()) {
0879         setting.insert(QLatin1String(NM_SETTING_802_1X_PAC_FILE), pacFile());
0880     }
0881 
0882     if (!caCertificate().isEmpty()) {
0883         setting.insert(QLatin1String(NM_SETTING_802_1X_CA_CERT), caCertificate());
0884     }
0885 
0886     if (!caPath().isEmpty()) {
0887         setting.insert(QLatin1String(NM_SETTING_802_1X_CA_PATH), caPath());
0888     }
0889 
0890     if (!subjectMatch().isEmpty()) {
0891         setting.insert(QLatin1String(NM_SETTING_802_1X_SUBJECT_MATCH), subjectMatch());
0892     }
0893 
0894     if (!altSubjectMatches().isEmpty()) {
0895         setting.insert(QLatin1String(NM_SETTING_802_1X_ALTSUBJECT_MATCHES), altSubjectMatches());
0896     }
0897 
0898     if (!clientCertificate().isEmpty()) {
0899         setting.insert(QLatin1String(NM_SETTING_802_1X_CLIENT_CERT), clientCertificate());
0900     }
0901 
0902     QString version;
0903     switch (phase1PeapVersion()) {
0904     case PeapVersionZero:
0905         version = '0';
0906         break;
0907     case PeapVersionOne:
0908         version = '1';
0909         break;
0910     case PeapVersionUnknown:
0911         break;
0912     }
0913 
0914     if (!version.isEmpty()) {
0915         setting.insert(QLatin1String(NM_SETTING_802_1X_PHASE1_PEAPVER), version);
0916     }
0917 
0918     QString peapLabel;
0919     switch (phase1PeapLabel()) {
0920     case PeapLabelForce:
0921         peapLabel = '1';
0922         break;
0923     case PeapLabelUnknown:
0924         break;
0925     }
0926 
0927     if (!peapLabel.isEmpty()) {
0928         setting.insert(QLatin1String(NM_SETTING_802_1X_PHASE1_PEAPLABEL), peapLabel);
0929     }
0930 
0931     QString provisioning;
0932     switch (phase1FastProvisioning()) {
0933     case FastProvisioningDisabled:
0934         provisioning = '0';
0935         break;
0936     case FastProvisioningAllowUnauthenticated:
0937         provisioning = '1';
0938         break;
0939     case FastProvisioningAllowAuthenticated:
0940         provisioning = '2';
0941         break;
0942     case FastProvisioningAllowBoth:
0943         provisioning = '3';
0944         break;
0945     case FastProvisioningUnknown:
0946         break;
0947     }
0948 
0949     if (!provisioning.isEmpty()) {
0950         setting.insert(QLatin1String(NM_SETTING_802_1X_PHASE1_FAST_PROVISIONING), provisioning);
0951     }
0952 
0953     QString authMethod;
0954     switch (phase2AuthMethod()) {
0955     case AuthMethodPap:
0956         authMethod = "pap";
0957         break;
0958     case AuthMethodChap:
0959         authMethod = "chap";
0960         break;
0961     case AuthMethodMschap:
0962         authMethod = "mschap";
0963         break;
0964     case AuthMethodMschapv2:
0965         authMethod = "mschapv2";
0966         break;
0967     case AuthMethodGtc:
0968         authMethod = "gtc";
0969         break;
0970     case AuthMethodOtp:
0971         authMethod = "otp";
0972         break;
0973     case AuthMethodMd5:
0974         authMethod = "md5";
0975         break;
0976     case AuthMethodTls:
0977         authMethod = "tls";
0978         break;
0979     case AuthMethodUnknown:
0980         break;
0981     }
0982 
0983     if (!authMethod.isEmpty()) {
0984         setting.insert(QLatin1String(NM_SETTING_802_1X_PHASE2_AUTH), authMethod);
0985     }
0986 
0987     QString authEapMethod;
0988     switch (phase2AuthEapMethod()) {
0989     case AuthEapMethodMd5:
0990         authEapMethod = "md5";
0991         break;
0992     case AuthEapMethodMschapv2:
0993         authEapMethod = "mschapv2";
0994         break;
0995     case AuthEapMethodOtp:
0996         authEapMethod = "otp";
0997         break;
0998     case AuthEapMethodGtc:
0999         authEapMethod = "gtc";
1000         break;
1001     case AuthEapMethodTls:
1002         authEapMethod = "tls";
1003         break;
1004     case AuthEapMethodUnknown:
1005         break;
1006     }
1007 
1008     if (!authEapMethod.isEmpty()) {
1009         setting.insert(QLatin1String(NM_SETTING_802_1X_PHASE2_AUTHEAP), authEapMethod);
1010     }
1011 
1012     if (!phase2CaCertificate().isEmpty()) {
1013         setting.insert(QLatin1String(NM_SETTING_802_1X_PHASE2_CA_CERT), phase2CaCertificate());
1014     }
1015 
1016     if (!phase2CaPath().isEmpty()) {
1017         setting.insert(QLatin1String(NM_SETTING_802_1X_PHASE2_CA_PATH), phase2CaPath());
1018     }
1019 
1020     if (!phase2SubjectMatch().isEmpty()) {
1021         setting.insert(QLatin1String(NM_SETTING_802_1X_PHASE2_SUBJECT_MATCH), phase2SubjectMatch());
1022     }
1023 
1024     if (!phase2AltSubjectMatches().isEmpty()) {
1025         setting.insert(QLatin1String(NM_SETTING_802_1X_PHASE2_ALTSUBJECT_MATCHES), phase2AltSubjectMatches());
1026     }
1027 
1028     if (!phase2ClientCertificate().isEmpty()) {
1029         setting.insert(QLatin1String(NM_SETTING_802_1X_PHASE2_CLIENT_CERT), phase2ClientCertificate());
1030     }
1031 
1032     if (!password().isEmpty()) {
1033         setting.insert(QLatin1String(NM_SETTING_802_1X_PASSWORD), password());
1034     }
1035 
1036     if (passwordFlags() != None) {
1037         setting.insert(QLatin1String(NM_SETTING_802_1X_PASSWORD_FLAGS), (int)passwordFlags());
1038     }
1039 
1040     if (!passwordRaw().isEmpty()) {
1041         setting.insert(QLatin1String(NM_SETTING_802_1X_PASSWORD_RAW), passwordRaw());
1042     }
1043 
1044     if (passwordRawFlags() != None) {
1045         setting.insert(QLatin1String(NM_SETTING_802_1X_PASSWORD_RAW_FLAGS), (int)passwordRawFlags());
1046     }
1047 
1048     if (!privateKey().isEmpty()) {
1049         setting.insert(QLatin1String(NM_SETTING_802_1X_PRIVATE_KEY), privateKey());
1050     }
1051 
1052     if (!privateKeyPassword().isEmpty()) {
1053         setting.insert(QLatin1String(NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD), privateKeyPassword());
1054     }
1055 
1056     if (privateKeyPasswordFlags() != None) {
1057         setting.insert(QLatin1String(NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD_FLAGS), (int)privateKeyPasswordFlags());
1058     }
1059 
1060     if (!phase2PrivateKey().isEmpty()) {
1061         setting.insert(QLatin1String(NM_SETTING_802_1X_PHASE2_PRIVATE_KEY), phase2PrivateKey());
1062     }
1063 
1064     if (!phase2PrivateKeyPassword().isEmpty()) {
1065         setting.insert(QLatin1String(NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD), phase2PrivateKeyPassword());
1066     }
1067 
1068     if (phase2PrivateKeyPasswordFlags() != None) {
1069         setting.insert(QLatin1String(NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD_FLAGS), (int)phase2PrivateKeyPasswordFlags());
1070     }
1071 
1072     if (!pin().isEmpty()) {
1073         setting.insert(QLatin1String(NM_SETTING_802_1X_PIN), pin());
1074     }
1075 
1076     if (pinFlags() != None) {
1077         setting.insert(QLatin1String(NM_SETTING_802_1X_PIN_FLAGS), (int)pinFlags());
1078     }
1079 
1080     if (systemCaCertificates()) {
1081         setting.insert(QLatin1String(NM_SETTING_802_1X_SYSTEM_CA_CERTS), systemCaCertificates());
1082     }
1083 
1084     return setting;
1085 }
1086 
1087 QDebug NetworkManager::operator<<(QDebug dbg, const NetworkManager::Security8021xSetting &setting)
1088 {
1089     dbg.nospace() << "type: " << setting.typeAsString(setting.type()) << '\n';
1090     dbg.nospace() << "initialized: " << !setting.isNull() << '\n';
1091 
1092     dbg.nospace() << NM_SETTING_802_1X_EAP << ": " << setting.eapMethods() << '\n';
1093     dbg.nospace() << NM_SETTING_802_1X_IDENTITY << ": " << setting.identity() << '\n';
1094     dbg.nospace() << NM_SETTING_802_1X_ANONYMOUS_IDENTITY << ": " << setting.anonymousIdentity() << '\n';
1095     dbg.nospace() << NM_SETTING_802_1X_PAC_FILE << ": " << setting.pacFile() << '\n';
1096     dbg.nospace() << NM_SETTING_802_1X_CA_CERT << ": " << setting.caCertificate() << '\n';
1097     dbg.nospace() << NM_SETTING_802_1X_CA_PATH << ": " << setting.caPath() << '\n';
1098     dbg.nospace() << NM_SETTING_802_1X_DOMAIN_SUFFIX_MATCH << ": " << setting.domainSuffixMatch() << '\n';
1099     dbg.nospace() << NM_SETTING_802_1X_SUBJECT_MATCH << ": " << setting.subjectMatch() << '\n';
1100     dbg.nospace() << NM_SETTING_802_1X_ALTSUBJECT_MATCHES << ": " << setting.altSubjectMatches() << '\n';
1101     dbg.nospace() << NM_SETTING_802_1X_CLIENT_CERT << ": " << setting.clientCertificate() << '\n';
1102     dbg.nospace() << NM_SETTING_802_1X_PHASE1_PEAPVER << ": " << setting.phase1PeapVersion() << '\n';
1103     dbg.nospace() << NM_SETTING_802_1X_PHASE1_PEAPLABEL << ": " << setting.phase1PeapLabel() << '\n';
1104     dbg.nospace() << NM_SETTING_802_1X_PHASE1_FAST_PROVISIONING << ": " << setting.phase1FastProvisioning() << '\n';
1105     dbg.nospace() << NM_SETTING_802_1X_PHASE2_AUTH << ": " << setting.phase2AuthMethod() << '\n';
1106     dbg.nospace() << NM_SETTING_802_1X_PHASE2_AUTHEAP << ": " << setting.phase2AuthEapMethod() << '\n';
1107     dbg.nospace() << NM_SETTING_802_1X_PHASE2_CA_CERT << ": " << setting.phase2CaCertificate() << '\n';
1108     dbg.nospace() << NM_SETTING_802_1X_PHASE2_CA_PATH << ": " << setting.phase2CaPath() << '\n';
1109     dbg.nospace() << NM_SETTING_802_1X_PHASE2_SUBJECT_MATCH << ": " << setting.phase2SubjectMatch() << '\n';
1110     dbg.nospace() << NM_SETTING_802_1X_PHASE2_ALTSUBJECT_MATCHES << ": " << setting.phase2AltSubjectMatches() << '\n';
1111     dbg.nospace() << NM_SETTING_802_1X_PHASE2_CLIENT_CERT << ": " << setting.phase2ClientCertificate() << '\n';
1112     dbg.nospace() << NM_SETTING_802_1X_PASSWORD << ": " << setting.password() << '\n';
1113     dbg.nospace() << NM_SETTING_802_1X_PASSWORD_FLAGS << ": " << setting.passwordFlags() << '\n';
1114     dbg.nospace() << NM_SETTING_802_1X_PASSWORD_RAW << ": " << setting.passwordRaw() << '\n';
1115     dbg.nospace() << NM_SETTING_802_1X_PASSWORD_RAW_FLAGS << ": " << setting.passwordRawFlags() << '\n';
1116     dbg.nospace() << NM_SETTING_802_1X_PRIVATE_KEY << ": " << setting.privateKey() << '\n';
1117     dbg.nospace() << NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD << ": " << setting.privateKeyPassword() << '\n';
1118     dbg.nospace() << NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD_FLAGS << ": " << setting.privateKeyPasswordFlags() << '\n';
1119     dbg.nospace() << NM_SETTING_802_1X_PHASE2_PRIVATE_KEY << ": " << setting.phase2PrivateKey() << '\n';
1120     dbg.nospace() << NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD << ": " << setting.phase2PrivateKeyPassword() << '\n';
1121     dbg.nospace() << NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD_FLAGS << ": " << setting.phase2PrivateKeyPasswordFlags() << '\n';
1122     dbg.nospace() << NM_SETTING_802_1X_PIN << ": " << setting.pin() << '\n';
1123     dbg.nospace() << NM_SETTING_802_1X_PIN_FLAGS << ": " << setting.pinFlags() << '\n';
1124     dbg.nospace() << NM_SETTING_802_1X_SYSTEM_CA_CERTS << ": " << setting.systemCaCertificates() << '\n';
1125 
1126     return dbg.maybeSpace();
1127 }