changeset 49 | 43351a4f2da3 |
parent 36 | c98682f98478 |
47:712b4ffd76bb | 49:43351a4f2da3 |
---|---|
15 * EAP method configuration QT interface |
15 * EAP method configuration QT interface |
16 * |
16 * |
17 */ |
17 */ |
18 |
18 |
19 /* |
19 /* |
20 * %version: 52 % |
20 * %version: 55 % |
21 */ |
21 */ |
22 |
22 |
23 // System includes |
23 // System includes |
24 #include <QDir> |
24 #include <QDir> |
25 #include <QList> |
25 #include <QList> |
34 #include <EapGeneralSettings.h> |
34 #include <EapGeneralSettings.h> |
35 #include <eapqtplugininfo.h> |
35 #include <eapqtplugininfo.h> |
36 #include <eapqtcertificateinfo.h> |
36 #include <eapqtcertificateinfo.h> |
37 |
37 |
38 // User includes |
38 // User includes |
39 #include "EapFastPacStore.h" |
|
39 #include "cpeapplugininterface.h" |
40 #include "cpeapplugininterface.h" |
40 #include "eapqtconfiginterface_p.h" |
41 #include "eapqtconfiginterface_p.h" |
41 #include "eapqtvalidatorpassword.h" |
42 #include "eapqtvalidatorpassword.h" |
42 #include "eapqtvalidatorusername.h" |
43 #include "eapqtvalidatorusername.h" |
43 #include "eapqtvalidatorrealm.h" |
44 #include "eapqtvalidatorrealm.h" |
51 |
52 |
52 // External function prototypes |
53 // External function prototypes |
53 |
54 |
54 // Local constants |
55 // Local constants |
55 static const QString eapTranslationFile("cpeapuiplugins"); |
56 static const QString eapTranslationFile("cpeapuiplugins"); |
57 static const QString eapPromptsTranslationFile("eapprompts"); |
|
56 |
58 |
57 // ======== LOCAL FUNCTIONS ======== |
59 // ======== LOCAL FUNCTIONS ======== |
58 |
60 |
59 // ======== MEMBER FUNCTIONS ======== |
61 // ======== MEMBER FUNCTIONS ======== |
60 |
62 |
61 EapQtConfigInterfacePrivate::EapQtConfigInterfacePrivate() : |
63 EapQtConfigInterfacePrivate::EapQtConfigInterfacePrivate() : |
62 mValidatorInstance(true), |
64 mValidatorInstance(true), |
63 mLastOuterHandle(EapQtPluginHandle::PluginUndefined), |
65 mLastOuterHandle(EapQtPluginHandle::PluginUndefined), |
64 mTranslator(NULL), |
66 mTranslator(NULL), |
67 mEapPromptsTranslator(NULL), |
|
65 mEapGsIf(NULL), |
68 mEapGsIf(NULL), |
66 mEapTypeIf(NULL), |
69 mEapTypeIf(NULL), |
70 mPacStoreIf(NULL), |
|
67 mIapId(0), |
71 mIapId(0), |
68 mEapBearer(ELan), |
72 mEapBearer(ELan), |
69 mEapDbIndex(EapQtConfigInterface::IapIdUndefined), |
73 mEapDbIndex(EapQtConfigInterface::IapIdUndefined), |
70 mEapDbIndexValid(false) |
74 mEapDbIndexValid(false) |
71 { |
75 { |
74 |
78 |
75 EapQtConfigInterfacePrivate::EapQtConfigInterfacePrivate( |
79 EapQtConfigInterfacePrivate::EapQtConfigInterfacePrivate( |
76 const EapQtConfigInterface::EapBearerType bearerType, const int iapId) : |
80 const EapQtConfigInterface::EapBearerType bearerType, const int iapId) : |
77 mValidatorInstance(false), |
81 mValidatorInstance(false), |
78 mLastOuterHandle(EapQtPluginHandle::PluginUndefined), |
82 mLastOuterHandle(EapQtPluginHandle::PluginUndefined), |
79 mTranslator(NULL), |
83 mTranslator(NULL), |
84 mEapPromptsTranslator(NULL), |
|
80 mEapGsIf(NULL), |
85 mEapGsIf(NULL), |
81 mEapTypeIf(NULL), |
86 mEapTypeIf(NULL), |
87 mPacStoreIf(NULL), |
|
82 mIapId(iapId), |
88 mIapId(iapId), |
83 mEapBearer(ELan), |
89 mEapBearer(ELan), |
84 mEapDbIndex(EapQtConfigInterface::IapIdUndefined), |
90 mEapDbIndex(EapQtConfigInterface::IapIdUndefined), |
85 mEapDbIndexValid(false) |
91 mEapDbIndexValid(false) |
86 { |
92 { |
128 REComSession::FinalClose(); |
134 REComSession::FinalClose(); |
129 |
135 |
130 // mTranslator gets deleted automatically (QScopedPointer) |
136 // mTranslator gets deleted automatically (QScopedPointer) |
131 // mEapTypeIf gets deleted automatically (QScopedPointer) |
137 // mEapTypeIf gets deleted automatically (QScopedPointer) |
132 // mEapGsIf gets deleted automatically (QScopedPointer) |
138 // mEapGsIf gets deleted automatically (QScopedPointer) |
139 // mPacStoreIf gets deleted automatically (QScopedPointer) |
|
133 } |
140 } |
134 |
141 |
135 bool EapQtConfigInterfacePrivate::setConfigurationReference(const int iapId) |
142 bool EapQtConfigInterfacePrivate::setConfigurationReference(const int iapId) |
136 { |
143 { |
137 qDebug("EapQtConfigInterfacePrivate::setConfigurationReference - requested id: %d, this = 0x%08x", iapId, this); |
144 qDebug("EapQtConfigInterfacePrivate::setConfigurationReference - requested id: %d, this = 0x%08x", iapId, this); |
142 |
149 |
143 bool EapQtConfigInterfacePrivate::setEapDbIndex(const int iapId) |
150 bool EapQtConfigInterfacePrivate::setEapDbIndex(const int iapId) |
144 { |
151 { |
145 |
152 |
146 qDebug("EapQtConfigInterfacePrivate::setIapId - requested id: %d, this = 0x%08x", iapId, this); |
153 qDebug("EapQtConfigInterfacePrivate::setIapId - requested id: %d, this = 0x%08x", iapId, this); |
147 |
|
148 |
154 |
149 // optimization: do not re-create the interface if the reference does |
155 // optimization: do not re-create the interface if the reference does |
150 // not change and mEapGsIf exists already |
156 // not change and mEapGsIf exists already |
151 |
157 |
152 // WLAN reference is checked after setEapWlanDbIndex below since iapId may be |
158 // WLAN reference is checked after setEapWlanDbIndex below since iapId may be |
215 qDebug( |
221 qDebug( |
216 "EapQtConfigInterfacePrivate::setIapId() - calls CEapGeneralSettings::NewL(), bearer = %d, index = %d", |
222 "EapQtConfigInterfacePrivate::setIapId() - calls CEapGeneralSettings::NewL(), bearer = %d, index = %d", |
217 mEapBearer, mEapDbIndex); |
223 mEapBearer, mEapDbIndex); |
218 |
224 |
219 // load EAP general settings interface |
225 // load EAP general settings interface |
226 bool ret = true; |
|
220 CEapGeneralSettings* tmp = NULL; |
227 CEapGeneralSettings* tmp = NULL; |
221 TRAPD(err, tmp = CEapGeneralSettings::NewL(mEapBearer, mEapDbIndex)); |
228 TRAPD(err, tmp = CEapGeneralSettings::NewL(mEapBearer, mEapDbIndex)); |
222 if (err != KErrNone) { |
229 if (err != KErrNone) { |
223 qDebug("ERROR: EapQtConfigInterfacePrivate::setIapId - CEapGeneralSettings::NewL() failed"); |
230 qDebug("ERROR: EapQtConfigInterfacePrivate::setIapId - CEapGeneralSettings::NewL() failed"); |
224 mEapDbIndexValid = false; |
231 mEapDbIndexValid = false; |
225 return false; |
232 tmp = NULL; |
233 ret = false; |
|
226 } |
234 } |
227 |
235 |
228 // set to the created instance |
236 // set to the created instance |
229 mEapGsIf.reset(tmp); |
237 mEapGsIf.reset(tmp); |
230 |
238 |
231 return true; |
239 return ret; |
232 } |
240 } |
233 |
241 |
234 bool EapQtConfigInterfacePrivate::setEapWlanDbIndex(const int iapId) |
242 bool EapQtConfigInterfacePrivate::setEapWlanDbIndex(const int iapId) |
235 { |
243 { |
236 qDebug("EapQtConfigInterfacePrivate::setEapWlanDbIndex - requested id: %d, this = 0x%08x", iapId, this); |
244 qDebug("EapQtConfigInterfacePrivate::setEapWlanDbIndex - requested id: %d, this = 0x%08x", iapId, this); |
243 mEapDbIndex = EapQtConfigInterface::IapIdUndefined; |
251 mEapDbIndex = EapQtConfigInterface::IapIdUndefined; |
244 mIapId = 0; |
252 mIapId = 0; |
245 return false; |
253 return false; |
246 } |
254 } |
247 |
255 |
256 bool ret = true; |
|
248 TRAP(err, mEapDbIndex = cmm.GetConnectionMethodInfoIntL(iapId, CMManager::EWlanServiceId)); |
257 TRAP(err, mEapDbIndex = cmm.GetConnectionMethodInfoIntL(iapId, CMManager::EWlanServiceId)); |
249 if (err != KErrNone) { |
258 if (err != KErrNone) { |
250 qDebug( |
259 qDebug( |
251 "ERROR: EapQtConfigInterfacePrivate::setEapWlanDbIndex - cmm.GetConnectionMethodInfoIntL() failed", |
260 "ERROR: EapQtConfigInterfacePrivate::setEapWlanDbIndex - cmm.GetConnectionMethodInfoIntL() failed", |
252 mEapBearer, iapId); |
261 mEapBearer, iapId); |
253 cmm.Close(); |
|
254 mEapDbIndex = EapQtConfigInterface::IapIdUndefined; |
262 mEapDbIndex = EapQtConfigInterface::IapIdUndefined; |
255 mIapId = 0; |
263 mIapId = 0; |
256 return false; |
264 ret = false; |
257 } |
265 } |
258 |
266 |
259 cmm.Close(); |
267 cmm.Close(); |
260 |
268 |
261 qDebug("EapQtConfigInterfacePrivate::setEapWlanDbIndex - obtained WLAN service id: %d", |
269 qDebug("EapQtConfigInterfacePrivate::setEapWlanDbIndex - obtained WLAN service id: %d", |
262 mEapDbIndex); |
270 mEapDbIndex); |
263 |
271 |
264 return true; |
272 return ret; |
265 } |
273 } |
266 |
274 |
267 void EapQtConfigInterfacePrivate::checkInstanceThrowing() const |
275 void EapQtConfigInterfacePrivate::checkInstanceThrowing() const |
268 { |
276 { |
269 qDebug() << "EapQtConfigInterfacePrivate::checkInstanceThrowing() - mValidatorInstance:" |
277 qDebug() << "EapQtConfigInterfacePrivate::checkInstanceThrowing() - mValidatorInstance:" |
742 EAPSettings eapSettings; |
750 EAPSettings eapSettings; |
743 (void) eapSettings.iEAPExpandedType.SetValue(eapType.data(), eapType.length()); |
751 (void) eapSettings.iEAPExpandedType.SetValue(eapType.data(), eapType.length()); |
744 |
752 |
745 // copy the rest of the settings in the function |
753 // copy the rest of the settings in the function |
746 copyToEapSettings(config, eapSettings); |
754 copyToEapSettings(config, eapSettings); |
755 |
|
747 // store settings |
756 // store settings |
757 bool ret = true; |
|
748 TRAPD(err, mEapTypeIf->SetConfigurationL(eapSettings)); |
758 TRAPD(err, mEapTypeIf->SetConfigurationL(eapSettings)); |
749 if (err != KErrNone) { |
759 if (err != KErrNone) { |
750 qDebug("ERROR: EapQtConfigInterfacePrivate - saveConfiguration: SetConfigurationL failed"); |
760 qDebug("ERROR: EapQtConfigInterfacePrivate - saveConfiguration: SetConfigurationL failed"); |
751 // clear the instance so that the next attempt starts from scratch |
761 // clear the instance so that the next attempt starts from scratch |
752 mEapTypeIf.reset(NULL); |
762 mEapTypeIf.reset(NULL); |
753 mCurrentServerEapType = *EapExpandedTypeNone.GetType(); |
763 mCurrentServerEapType = *EapExpandedTypeNone.GetType(); |
754 return false; |
764 ret = false; |
755 } |
765 } |
756 |
766 |
757 return true; |
767 return ret; |
758 } |
768 } |
759 |
769 |
760 // config must be empty when calling |
770 // config must be empty when calling |
761 bool EapQtConfigInterfacePrivate::readConfiguration(const EapQtPluginHandle &outerHandle, |
771 bool EapQtConfigInterfacePrivate::readConfiguration(const EapQtPluginHandle &outerHandle, |
762 const EapQtPluginHandle &pluginHandle, EapQtConfig &config) |
772 const EapQtPluginHandle &pluginHandle, EapQtConfig &config) |
1788 |
1798 |
1789 if (mTranslator.isNull()) { |
1799 if (mTranslator.isNull()) { |
1790 // install translations for EAP UI plugins |
1800 // install translations for EAP UI plugins |
1791 mTranslator.reset(new HbTranslator(eapTranslationFile)); |
1801 mTranslator.reset(new HbTranslator(eapTranslationFile)); |
1792 } |
1802 } |
1793 |
1803 if (mEapPromptsTranslator.isNull()) { |
1804 // install translations for EAP UI plugins |
|
1805 mEapPromptsTranslator.reset(new HbTranslator(eapPromptsTranslationFile)); |
|
1806 } |
|
1807 |
|
1794 // go through all interfaces (dlls) |
1808 // go through all interfaces (dlls) |
1795 QList<CpEapPluginInterface*>::iterator iter; |
1809 QList<CpEapPluginInterface*>::iterator iter; |
1796 for (iter = mPlugins.begin(); iter != mPlugins.end(); ++iter) { |
1810 for (iter = mPlugins.begin(); iter != mPlugins.end(); ++iter) { |
1797 QList<EapQtPluginInfo> plugins; |
1811 QList<EapQtPluginInfo> plugins; |
1798 plugins.append((*iter)->pluginInfo()); |
1812 plugins.append((*iter)->pluginInfo()); |
1898 qDebug() << "EapQtConfigInterfacePrivate::validatorEap() - is returning NULL: " << (ret == NULL); |
1912 qDebug() << "EapQtConfigInterfacePrivate::validatorEap() - is returning NULL: " << (ret == NULL); |
1899 |
1913 |
1900 return ret; |
1914 return ret; |
1901 } |
1915 } |
1902 |
1916 |
1903 bool EapQtConfigInterfacePrivate::readPacStoreConfiguration(EapQtPacStoreConfig& /* config */) |
1917 bool EapQtConfigInterfacePrivate::readPacStoreConfiguration(EapQtPacStoreConfig& config) |
1904 { |
1918 { |
1905 // not supported |
1919 qDebug("EapQtConfigInterfacePrivate::readPacStoreConfiguration(), this = 0x%08x", this); |
1906 return false; |
1920 |
1907 } |
1921 // reset config to make sure it is empty |
1908 |
1922 config.clear(); |
1909 bool EapQtConfigInterfacePrivate::savePacStoreConfiguration(const EapQtPacStoreConfig& /* config */) |
1923 |
1910 { |
1924 // get PAC store IF |
1911 // not supported |
1925 getPacStoreIf(); |
1912 return false; |
1926 |
1927 if (mPacStoreIf.isNull()) { |
|
1928 qDebug() << "ERROR: EapQtConfigInterfacePrivate::readPacStoreConfiguration()" |
|
1929 << "- mPacStoreIf creation failed"; |
|
1930 return false; |
|
1931 } |
|
1932 |
|
1933 // *** check if PAC store has been created |
|
1934 qDebug() << "EapQtConfigInterfacePrivate::readPacStoreConfiguration() - calls IsMasterKeyPresentL"; |
|
1935 |
|
1936 TBool status(EFalse); |
|
1937 TRAPD(err, status = mPacStoreIf->IsMasterKeyPresentL()) |
|
1938 if (err != KErrNone) { |
|
1939 qDebug() |
|
1940 << "ERROR: EapQtConfigInterfacePrivate::readPacStoreConfiguration() - IsMasterKeyPresentL" |
|
1941 << "failed with code: " << err; |
|
1942 return false; |
|
1943 } |
|
1944 |
|
1945 if (status != EFalse) { |
|
1946 // PAC store exists |
|
1947 config.setValue(EapQtPacStoreConfig::PacStoreState, |
|
1948 EapQtPacStoreConfig::PacStoreStatePasswordRequired); |
|
1949 |
|
1950 qDebug() << "EapQtConfigInterfacePrivate::readPacStoreConfiguration()" |
|
1951 << "- setting status to PacStoreStatePasswordRequired"; |
|
1952 } |
|
1953 else { |
|
1954 // PAC store does not exist |
|
1955 config.setValue(EapQtPacStoreConfig::PacStoreState, |
|
1956 EapQtPacStoreConfig::PacStoreStateStoreNotExists); |
|
1957 |
|
1958 qDebug() << "EapQtConfigInterfacePrivate::readPacStoreConfiguration()" |
|
1959 << "- setting status to PacStoreStateStoreNotExists"; |
|
1960 |
|
1961 // enough info to exit here |
|
1962 return true; |
|
1963 } |
|
1964 |
|
1965 // here the state is PacStoreStatePasswordRequired, |
|
1966 // lets check if we need to change it below |
|
1967 |
|
1968 // *** check if PAC store password has been stored to settings database |
|
1969 TRAP(err, status = mPacStoreIf->IsPacStorePasswordPresentL()) |
|
1970 if (err != KErrNone) { |
|
1971 qDebug() |
|
1972 << "ERROR: EapQtConfigInterfacePrivate::readPacStoreConfiguration() - IsPacStorePasswordPresentL" |
|
1973 << "failed with code: " << err; |
|
1974 config.clear(); |
|
1975 return false; |
|
1976 } |
|
1977 |
|
1978 if (status != EFalse) { |
|
1979 // password stored |
|
1980 config.setValue(EapQtPacStoreConfig::PacStoreState, |
|
1981 EapQtPacStoreConfig::PacStoreStatePasswordStored); |
|
1982 |
|
1983 qDebug() << "EapQtConfigInterfacePrivate::readPacStoreConfiguration()" |
|
1984 << "- setting status to PacStoreStatePasswordStored"; |
|
1985 } |
|
1986 |
|
1987 return true; |
|
1988 } |
|
1989 |
|
1990 bool EapQtConfigInterfacePrivate::savePacStoreConfiguration(const EapQtPacStoreConfig& config) |
|
1991 { |
|
1992 qDebug("EapQtConfigInterfacePrivate::savePacStoreConfiguration(), this = 0x%08x", this); |
|
1993 |
|
1994 // get PAC store IF |
|
1995 getPacStoreIf(); |
|
1996 |
|
1997 if (mPacStoreIf.isNull()) { |
|
1998 qDebug() << "ERROR: EapQtConfigInterfacePrivate::savePacStoreConfiguration()" |
|
1999 << "- mPacStoreIf creation failed"; |
|
2000 return false; |
|
2001 } |
|
2002 |
|
2003 // reset PAC store, overrides other settings, |
|
2004 // nothing else will be performed if this is set to true, |
|
2005 // called regardless of PAC store state |
|
2006 TInt err(KErrNone); |
|
2007 bool ret = false; |
|
2008 QVariant varValue = config.value(EapQtPacStoreConfig::PacStoreReset); |
|
2009 if (varValue.type() == QVariant::Bool && varValue.toBool()) { |
|
2010 qDebug() << "EapQtConfigInterfacePrivate::savePacStoreConfiguration() - calls DestroyPacStore"; |
|
2011 |
|
2012 err = mPacStoreIf->DestroyPacStore(); |
|
2013 qDebug() |
|
2014 << "EapQtConfigInterfacePrivate::savePacStoreConfiguration() - DestroyPacStore returned:" |
|
2015 << err; |
|
2016 ret = (err == KErrNone); |
|
2017 return ret; |
|
2018 } |
|
2019 |
|
2020 // check PAC store state |
|
2021 EapQtPacStoreConfig localPacConfig; |
|
2022 ret = readPacStoreConfiguration(localPacConfig); |
|
2023 if(!ret) |
|
2024 { |
|
2025 qDebug() << "ERROR: EapQtConfigInterfacePrivate::savePacStoreConfiguration()" |
|
2026 << "- PAC store state check failed"; |
|
2027 return ret; |
|
2028 } |
|
2029 |
|
2030 // store state |
|
2031 EapQtPacStoreConfig::PacStoreStatus pacStoreState = |
|
2032 static_cast<EapQtPacStoreConfig::PacStoreStatus> (localPacConfig.value( |
|
2033 EapQtPacStoreConfig::PacStoreState).toInt()); |
|
2034 |
|
2035 ret = true; |
|
2036 TInt leaveErr(KErrNone); |
|
2037 // TBufC8 must be twice as long as QString |
|
2038 TBufC8<StringMaxLength> tmpPassword; |
|
2039 const QVariant varPassword = config.value(EapQtPacStoreConfig::PacStorePassword); |
|
2040 varValue = config.value(EapQtPacStoreConfig::PacStoreSavePassword); |
|
2041 |
|
2042 // create PAC store if it does not exist |
|
2043 if (pacStoreState == EapQtPacStoreConfig::PacStoreStateStoreNotExists && varPassword.type() |
|
2044 == QVariant::String && varPassword.toString().count() <= PacPasswordMaxLength) { |
|
2045 |
|
2046 qDebug() << "EapQtConfigInterfacePrivate::savePacStoreConfiguration() -" |
|
2047 << "creating PAC store with password:" << varPassword.toString(); |
|
2048 |
|
2049 // Convert to suitable format |
|
2050 QByteArray tmp = varPassword.toString().toUtf8(); |
|
2051 tmpPassword.Des().Copy(reinterpret_cast<const TUint8*>(tmp.data()), tmp.count()); |
|
2052 |
|
2053 TRAP(leaveErr, err = mPacStoreIf->CreateAndSaveMasterKeyL(tmpPassword)); |
|
2054 |
|
2055 qDebug() << "EapQtConfigInterfacePrivate::savePacStoreConfiguration() -" |
|
2056 << "CreateAndSaveMasterKeyL returned:" << err << ", trap returned:" |
|
2057 << leaveErr; |
|
2058 |
|
2059 ret = (err == KErrNone) && (leaveErr == KErrNone); |
|
2060 } |
|
2061 else if (pacStoreState == EapQtPacStoreConfig::PacStoreStateStoreNotExists) { |
|
2062 qDebug() << "ERROR: EapQtConfigInterfacePrivate::savePacStoreConfiguration()" |
|
2063 << "- PAC store does not exist and password is not ok"; |
|
2064 qDebug() << "ERROR: EapQtConfigInterfacePrivate::savePacStoreConfiguration()" |
|
2065 << "- password type == QString:" << (varPassword.type() == QVariant::String) |
|
2066 << ", password size:" << varPassword.toString().count(); |
|
2067 ret = false; |
|
2068 } |
|
2069 |
|
2070 // exit on failure |
|
2071 if(!ret) { |
|
2072 qDebug() << "ERROR: EapQtConfigInterfacePrivate::savePacStoreConfiguration()" |
|
2073 << "- PAC store creation failed"; |
|
2074 return ret; |
|
2075 } |
|
2076 |
|
2077 // clear tmpPassword |
|
2078 tmpPassword.Des().SetLength(0); |
|
2079 |
|
2080 // PAC store exists, clear password |
|
2081 if (varValue.type() == QVariant::Bool && !varValue.toBool()) { |
|
2082 |
|
2083 qDebug() << "EapQtConfigInterfacePrivate::savePacStoreConfiguration() - calls SetPacStorePasswordL with empty password"; |
|
2084 |
|
2085 // empty password clears the existing password from database and sets prompting on |
|
2086 TRAP(leaveErr, err = mPacStoreIf->SetPacStorePasswordL(tmpPassword)); |
|
2087 |
|
2088 qDebug() << "EapQtConfigInterfacePrivate::savePacStoreConfiguration() -" |
|
2089 << "clearing password, SetPacStorePasswordL returned:" << err << ", trap returned: " |
|
2090 << leaveErr; |
|
2091 ret = (err == KErrNone) && (leaveErr == KErrNone); |
|
2092 } |
|
2093 // PAC store exists, store password |
|
2094 // password's correcness is not checked here, PacStorePasswordConfirmation |
|
2095 // validator must be used to check it before calling savePacStoreConfiguration() |
|
2096 else if (varValue.type() == QVariant::Bool && varValue.toBool()) { |
|
2097 if (varPassword.type() == QVariant::String && varPassword.toString().count() <= PacPasswordMaxLength) { |
|
2098 |
|
2099 qDebug() << "EapQtConfigInterfacePrivate::savePacStoreConfiguration() -" |
|
2100 << "storing password:" << varPassword.toString(); |
|
2101 |
|
2102 // Convert to suitable format |
|
2103 QByteArray tmp = varPassword.toString().toUtf8(); |
|
2104 tmpPassword.Des().Copy(reinterpret_cast<const TUint8*>(tmp.data()), tmp.count()); |
|
2105 |
|
2106 TRAP(leaveErr, err = mPacStoreIf->SetPacStorePasswordL(tmpPassword)); |
|
2107 |
|
2108 qDebug() << "EapQtConfigInterfacePrivate::savePacStoreConfiguration() -" |
|
2109 << "SetPacStorePasswordL returned:" << err << ", trap returned:" << leaveErr; |
|
2110 ret = (err == KErrNone) && (leaveErr == KErrNone); |
|
2111 } |
|
2112 else { |
|
2113 qDebug() << "ERROR: EapQtConfigInterfacePrivate::savePacStoreConfiguration()" |
|
2114 << "- password not ok, not stored"; |
|
2115 qDebug() << "ERROR: EapQtConfigInterfacePrivate::savePacStoreConfiguration()" |
|
2116 << "- password type == QString:" << (varPassword.type() == QVariant::String) |
|
2117 << ", password size:" << varPassword.toString().count(); |
|
2118 ret = false; |
|
2119 } |
|
2120 } |
|
2121 |
|
2122 qDebug() << "EapQtConfigInterfacePrivate::savePacStoreConfiguration() - returns: " << ret; |
|
2123 return ret; |
|
2124 } |
|
2125 |
|
2126 void EapQtConfigInterfacePrivate::getPacStoreIf() |
|
2127 { |
|
2128 qDebug("EapQtConfigInterfacePrivate::getPacStoreIf(), this = 0x%08x", this); |
|
2129 |
|
2130 // cannot call isSupportedOuterType(EapQtPluginHandle::PluginEapFast) from |
|
2131 // validator instance (would throw), hence cannot check it here |
|
2132 |
|
2133 // check if we already have an instance |
|
2134 if (!mPacStoreIf.isNull()) { |
|
2135 qDebug() << "EapQtConfigInterfacePrivate::getPacStoreIf() - mPacStoreIf exists already"; |
|
2136 return; |
|
2137 } |
|
2138 |
|
2139 qDebug() << "EapQtConfigInterfacePrivate::getPacStoreIf() - calls CEapFastPacStore::NewL"; |
|
2140 |
|
2141 // try to create PAC store instance, this will fail is EAP-FAST is not supported |
|
2142 CEapFastPacStore* tmpPacStoreIf = NULL; |
|
2143 TRAPD(err, tmpPacStoreIf = CEapFastPacStore::NewL()); |
|
2144 if (err != KErrNone) { |
|
2145 qDebug() |
|
2146 << "ERROR: EapQtConfigInterfacePrivate::getPacStoreIf() - CEapFastPacStore::NewL failed"; |
|
2147 tmpPacStoreIf = NULL; |
|
2148 } |
|
2149 |
|
2150 // move the result to scoped member pointer |
|
2151 mPacStoreIf.reset(tmpPacStoreIf); |
|
1913 } |
2152 } |
1914 |
2153 |
1915 EapQtValidator *EapQtConfigInterfacePrivate::validatorPacStore( |
2154 EapQtValidator *EapQtConfigInterfacePrivate::validatorPacStore( |
1916 const EapQtPacStoreConfig::PacStoreSettings id) |
2155 const EapQtPacStoreConfig::PacStoreSettings id) |
1917 { |
2156 { |
1918 qDebug("EapQtConfigInterfacePrivate::validatorPacStore(), this = 0x%08x", this); |
2157 qDebug("EapQtConfigInterfacePrivate::validatorPacStore(), this = 0x%08x", this); |
1919 |
2158 |
1920 EapQtValidator *ret = NULL; |
2159 // cannot call isSupportedOuterType(EapQtPluginHandle::PluginEapFast) from |
2160 // validator instance (would throw), hence cannot check it here |
|
2161 |
|
2162 // Instead, EAP-FAST support is checked in EapQtValidatorPacStorePasswordConfirm constuctor: |
|
2163 // it throws if PAC store IF cannot be created |
|
2164 |
|
2165 // EapQtValidatorPacStorePassword (format validator) is always usable |
|
2166 |
|
2167 EapQtValidator* ret = NULL; |
|
1921 |
2168 |
1922 switch (id) { |
2169 switch (id) { |
1923 case EapQtPacStoreConfig::PacStorePassword: |
2170 case EapQtPacStoreConfig::PacStorePassword: |
1924 ret = new EapQtValidatorPacStorePassword(); |
2171 ret = new EapQtValidatorPacStorePassword(); |
1925 break; |
2172 break; |