|
Lines 643-652
EncryptionWPAEnterprise::serialize (DBus
Link Here
|
| 643 |
kdDebug () << "method: " << _method << " identity: " << _identity << " password: " << _secret[IdPasswordKey] << |
643 |
kdDebug () << "method: " << _method << " identity: " << _identity << " password: " << _secret[IdPasswordKey] << |
| 644 |
" anon ident: " << _anonIdentity << " cert priv passwd: " << _secret[CertPrivatePasswordKey] << |
644 |
" anon ident: " << _anonIdentity << " cert priv passwd: " << _secret[CertPrivatePasswordKey] << |
| 645 |
" cert priv: " << _certPrivate << " cert client: " << _certClient << " cert CA: " << _certCA << |
645 |
" cert priv: " << _certPrivate << " cert client: " << _certClient << " cert CA: " << _certCA << |
| 646 |
" version: " << _version << endl; |
646 |
" version: " << _version << " phase2: " << _phase2type << endl; |
| 647 |
|
647 |
|
| 648 |
dbus_message_iter_init_append (msg, &iter); |
648 |
dbus_message_iter_init_append (msg, &iter); |
| 649 |
status = nmu_security_serialize_wpa_eap_with_cipher (&iter, _method, keyType, _identity.utf8(), |
649 |
|
|
|
650 |
/* second argument is combined bitfield for eap method and phase2 type */ |
| 651 |
int bf_method_phase2 = (int)_method | (int)_phase2type; |
| 652 |
status = nmu_security_serialize_wpa_eap_with_cipher (&iter, bf_method_phase2, keyType, _identity.utf8(), |
| 650 |
_secret[IdPasswordKey].utf8(), _anonIdentity.utf8(), |
653 |
_secret[IdPasswordKey].utf8(), _anonIdentity.utf8(), |
| 651 |
_secret[CertPrivatePasswordKey].utf8(), |
654 |
_secret[CertPrivatePasswordKey].utf8(), |
| 652 |
_certPrivate.utf8(), _certClient.utf8(), _certCA.utf8(), |
655 |
_certPrivate.utf8(), _certClient.utf8(), _certCA.utf8(), |
|
Lines 659-664
bool
Link Here
|
| 659 |
EncryptionWPAEnterprise::deserialize( DBusMessageIter * iter, int we_cipher ) |
662 |
EncryptionWPAEnterprise::deserialize( DBusMessageIter * iter, int we_cipher ) |
| 660 |
{ |
663 |
{ |
| 661 |
int method; |
664 |
int method; |
|
|
665 |
EAPMethod eapMethod; |
| 666 |
Phase2Type phase2Type; |
| 662 |
int keyType; |
667 |
int keyType; |
| 663 |
char* identity = NULL; |
668 |
char* identity = NULL; |
| 664 |
char* identityPassword = NULL; |
669 |
char* identityPassword = NULL; |
|
Lines 680-689
EncryptionWPAEnterprise::deserialize( DB
Link Here
|
| 680 |
|
685 |
|
| 681 |
if ( !(version == IW_AUTH_WPA_VERSION_WPA || version == IW_AUTH_WPA_VERSION_WPA2 ) ) |
686 |
if ( !(version == IW_AUTH_WPA_VERSION_WPA || version == IW_AUTH_WPA_VERSION_WPA2 ) ) |
| 682 |
return false; |
687 |
return false; |
| 683 |
if ( !(method == EAP_PEAP || method == EAP_TLS || method == EAP_TTLS ) ) |
688 |
eapMethod = ((EAPMethod) NM_EAP_TO_EAP_METHOD (method)); |
|
|
689 |
if ( !(eapMethod == EAP_PEAP || eapMethod == EAP_TLS || eapMethod == EAP_TTLS ) ) |
| 690 |
return false; |
| 691 |
phase2Type = ((Phase2Type) NM_EAP_TO_PHASE2_METHOD (method)); |
| 692 |
if ( !(phase2Type == PHASE2_PAP || phase2Type == PHASE2_MSCHAP || phase2Type == PHASE2_MSCHAPV2 || phase2Type == PHASE2_GTC ) ) |
| 684 |
return false; |
693 |
return false; |
| 685 |
|
694 |
|
| 686 |
setMethod ((EAPMethod) method); |
695 |
setMethod (eapMethod); |
|
|
696 |
setPhase2 (phase2Type); |
| 687 |
setIdentity (identity); |
697 |
setIdentity (identity); |
| 688 |
setAnonIdentity (anonIdentity); |
698 |
setAnonIdentity (anonIdentity); |
| 689 |
setCertPrivate (certPrivate); |
699 |
setCertPrivate (certPrivate); |
|
Lines 716-721
EncryptionWPAEnterprise::setDefaults (vo
Link Here
|
| 716 |
setProtocol (WPA_EAP); |
726 |
setProtocol (WPA_EAP); |
| 717 |
setVersion (WPA1); |
727 |
setVersion (WPA1); |
| 718 |
setMethod (EAP_PEAP); |
728 |
setMethod (EAP_PEAP); |
|
|
729 |
setPhase2 (PHASE2_NONE); |
| 719 |
setIdentity (""); |
730 |
setIdentity (""); |
| 720 |
setAnonIdentity (""); |
731 |
setAnonIdentity (""); |
| 721 |
setCertPrivate (""); |
732 |
setCertPrivate (""); |
|
Lines 845-850
EncryptionWPAEnterprise::getMethod (void
Link Here
|
| 845 |
return _method; |
856 |
return _method; |
| 846 |
} |
857 |
} |
| 847 |
|
858 |
|
|
|
859 |
void |
| 860 |
EncryptionWPAEnterprise::setPhase2 (Phase2Type phase2type) |
| 861 |
{ |
| 862 |
kdDebug() << k_funcinfo << " " << phase2type << endl; |
| 863 |
_phase2type = phase2type; |
| 864 |
} |
| 865 |
|
| 866 |
Phase2Type |
| 867 |
EncryptionWPAEnterprise::getPhase2 (void) |
| 868 |
{ |
| 869 |
kdDebug() << k_funcinfo << endl; |
| 870 |
return _phase2type; |
| 871 |
} |
| 872 |
|
| 848 |
EncryptionWPAEnterprise::EncryptionWPAEnterprise () |
873 |
EncryptionWPAEnterprise::EncryptionWPAEnterprise () |
| 849 |
{ |
874 |
{ |
| 850 |
kdDebug() << k_funcinfo << endl; |
875 |
kdDebug() << k_funcinfo << endl; |
|
Lines 871-876
void EncryptionWPAEnterprise::persist( K
Link Here
|
| 871 |
cfg->writeEntry( "Method", "TTLS" ); |
896 |
cfg->writeEntry( "Method", "TTLS" ); |
| 872 |
} |
897 |
} |
| 873 |
|
898 |
|
|
|
899 |
if ( _phase2type == PHASE2_NONE) { |
| 900 |
cfg->writeEntry( "Phase2", "NONE" ); |
| 901 |
} else if ( _phase2type == PHASE2_PAP ) { |
| 902 |
cfg->writeEntry( "Phase2", "PAP" ); |
| 903 |
} else if ( _phase2type == PHASE2_MSCHAP ) { |
| 904 |
cfg->writeEntry( "Phase2", "MSCHAP" ); |
| 905 |
} else if ( _phase2type == PHASE2_MSCHAPV2 ) { |
| 906 |
cfg->writeEntry( "Phase2", "MSCHAPV2" ); |
| 907 |
} else if ( _phase2type == PHASE2_GTC ) { |
| 908 |
cfg->writeEntry( "Phase2", "GTC" ); |
| 909 |
} |
| 910 |
|
| 874 |
cfg->writeEntry( "Identity", _identity ); |
911 |
cfg->writeEntry( "Identity", _identity ); |
| 875 |
cfg->writeEntry( "AnonIdentity", _anonIdentity ); |
912 |
cfg->writeEntry( "AnonIdentity", _anonIdentity ); |
| 876 |
cfg->writeEntry( "CertPrivate", _certPrivate ); |
913 |
cfg->writeEntry( "CertPrivate", _certPrivate ); |
|
Lines 922-927
void EncryptionWPAEnterprise::restore( K
Link Here
|
| 922 |
_method = EAP_TTLS; |
959 |
_method = EAP_TTLS; |
| 923 |
} |
960 |
} |
| 924 |
|
961 |
|
|
|
962 |
QString phase2 = cfg->readEntry( "Phase2" ); |
| 963 |
if ( "PAP" == phase2 ) { |
| 964 |
_phase2type = PHASE2_PAP; |
| 965 |
} else if ( "MSCHAP" == phase2 ) { |
| 966 |
_phase2type = PHASE2_MSCHAP; |
| 967 |
} else if ( "MSCHAPV2" == phase2 ) { |
| 968 |
_phase2type = PHASE2_MSCHAPV2; |
| 969 |
} else if ( "GTC" == phase2 ) { |
| 970 |
_phase2type = PHASE2_GTC; |
| 971 |
} else { |
| 972 |
_phase2type = PHASE2_NONE; |
| 973 |
} |
| 974 |
|
| 925 |
_identity = cfg->readEntry( "Identity" ); |
975 |
_identity = cfg->readEntry( "Identity" ); |
| 926 |
_anonIdentity = cfg->readEntry( "AnonIdentity" ); |
976 |
_anonIdentity = cfg->readEntry( "AnonIdentity" ); |
| 927 |
_certPrivate = cfg->readEntry( "CertPrivate" ); |
977 |
_certPrivate = cfg->readEntry( "CertPrivate" ); |