summaryrefslogtreecommitdiff
authorbenmeyer <benmeyer>2002-12-12 15:50:46 (UTC)
committer benmeyer <benmeyer>2002-12-12 15:50:46 (UTC)
commit2ebde078dcdc50434acb10f2fa245b0d3dd483bd (patch) (unidiff)
treef58b4c658e34aaa867bbe22e0ad6b481cbdda0dd
parent6c34d8a9165d46eb3d7d28c859e592d0aecbc92f (diff)
downloadopie-2ebde078dcdc50434acb10f2fa245b0d3dd483bd.zip
opie-2ebde078dcdc50434acb10f2fa245b0d3dd483bd.tar.gz
opie-2ebde078dcdc50434acb10f2fa245b0d3dd483bd.tar.bz2
Encryption issues fixed
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/networksetup/wlan/wlanimp.cpp28
-rw-r--r--noncore/settings/networksettings/wlan/wlanimp.cpp28
2 files changed, 26 insertions, 30 deletions
diff --git a/noncore/net/networksetup/wlan/wlanimp.cpp b/noncore/net/networksetup/wlan/wlanimp.cpp
index 84e0bae..cc18fba 100644
--- a/noncore/net/networksetup/wlan/wlanimp.cpp
+++ b/noncore/net/networksetup/wlan/wlanimp.cpp
@@ -89,31 +89,31 @@ void WLANImp::parseSettingFile(){
89 QString mode = line.mid(line.find("MODE=")+5, line.length()); 89 QString mode = line.mid(line.find("MODE=")+5, line.length());
90 if(mode == "Managed"){ 90 if(mode == "Managed"){
91 networkType->setCurrentItem(0); 91 networkType->setCurrentItem(0);
92 channelLabel->setEnabled(false); 92 channelLabel->setEnabled(false);
93 networkChannel->setEnabled(false); 93 networkChannel->setEnabled(false);
94 } 94 }
95 else{ 95 else{
96 networkType->setCurrentItem(1); 96 networkType->setCurrentItem(1);
97 networkChannel->setEnabled(true); 97 networkChannel->setEnabled(true);
98 channelLabel->setEnabled(true); 98 channelLabel->setEnabled(true);
99 } 99 }
100 } 100 }
101 if(line.contains("KEY0=")) 101 if(line.contains("#KEY0="))
102 keyLineEdit0->setText(line.mid(5, line.length())); 102 keyLineEdit0->setText(line.mid(5, line.length()));
103 if(line.contains("KEY1=")) 103 if(line.contains("#KEY1="))
104 keyLineEdit1->setText(line.mid(5, line.length())); 104 keyLineEdit1->setText(line.mid(5, line.length()));
105 if(line.contains("KEY2=")) 105 if(line.contains("#KEY2="))
106 keyLineEdit2->setText(line.mid(5, line.length())); 106 keyLineEdit2->setText(line.mid(5, line.length()));
107 if(line.contains("KEY3=")) 107 if(line.contains("#KEY3="))
108 keyLineEdit3->setText(line.mid(5, line.length())); 108 keyLineEdit3->setText(line.mid(5, line.length()));
109 109
110 if(line.contains("KEY=")){ 110 if(line.contains("KEY=")){
111 wepEnabled->setChecked(true); 111 wepEnabled->setChecked(true);
112 QString key; 112 QString key;
113 if(line.right(5) == (" open")){ 113 if(line.right(5) == (" open")){
114 key = line.mid(4, line.length()-5); 114 key = line.mid(4, line.length()-5);
115 authOpen->setChecked(true); 115 authOpen->setChecked(true);
116 authShared->setChecked(false); 116 authShared->setChecked(false);
117 } 117 }
118 else{ 118 else{
119 authOpen->setChecked(false); 119 authOpen->setChecked(false);
@@ -156,36 +156,35 @@ void WLANImp::changeAndSaveSettingFile(){
156 // See if we found our scheme to write or the sceme couldn't be found 156 // See if we found our scheme to write or the sceme couldn't be found
157 if((foundCase && line.contains("esac") && !found) || 157 if((foundCase && line.contains("esac") && !found) ||
158 (foundCase && line.left(currentProfile.length()+7) == currentProfile + ",*,*,*)" && line.at(0) != '#')){ 158 (foundCase && line.left(currentProfile.length()+7) == currentProfile + ",*,*,*)" && line.at(0) != '#')){
159 // write out scheme 159 // write out scheme
160 found = true; 160 found = true;
161 output = false; 161 output = false;
162 162
163 if(!line.contains("esac")) 163 if(!line.contains("esac"))
164 stream << line << "\n"; 164 stream << line << "\n";
165 if(!essAny->isChecked() == true){ 165 if(!essAny->isChecked() == true){
166 stream << "\tESSID=any\n"; 166 stream << "\tESSID=any\n";
167 stream << "\tMODE=Managed\n"; 167 stream << "\tMODE=Managed\n";
168 stream << "\tCHANNEL=6\n";
169 } 168 }
170 else{ 169 else{
171 stream << "\tESSID=" << essSpecificLineEdit->text() << '\n'; 170 stream << "\tESSID=" << essSpecificLineEdit->text() << '\n';
172 stream << "\tMODE=" << ( networkType->currentItem() == 0 ? "Managed" : "ad-hoc") << '\n'; 171 stream << "\tMODE=" << ( networkType->currentItem() == 0 ? "Managed" : "ad-hoc") << '\n';
173 stream << "\tCHANNEL=" << networkChannel->value() << "\n"; 172 stream << "\tCHANNEL=" << networkChannel->value() << "\n";
174 } 173 }
175 174
176 stream << "\tKEY0=" << keyLineEdit0->text() << "\n"; 175 stream << "\t#KEY0=" << keyLineEdit0->text() << "\n";
177 stream << "\tKEY1=" << keyLineEdit1->text() << "\n"; 176 stream << "\t#KEY1=" << keyLineEdit1->text() << "\n";
178 stream << "\tKEY2=" << keyLineEdit2->text() << "\n"; 177 stream << "\t#KEY2=" << keyLineEdit2->text() << "\n";
179 stream << "\tKEY3=" << keyLineEdit3->text() << "\n"; 178 stream << "\t#KEY3=" << keyLineEdit3->text() << "\n";
180 179
181 if(wepEnabled->isChecked()){ 180 if(wepEnabled->isChecked()){
182 stream << "\tKEY=\""; 181 stream << "\tKEY=\"";
183 if(keyRadio0->isChecked()) stream << keyLineEdit0->text(); 182 if(keyRadio0->isChecked()) stream << keyLineEdit0->text();
184 if(keyRadio1->isChecked()) stream << keyLineEdit1->text(); 183 if(keyRadio1->isChecked()) stream << keyLineEdit1->text();
185 if(keyRadio2->isChecked()) stream << keyLineEdit2->text(); 184 if(keyRadio2->isChecked()) stream << keyLineEdit2->text();
186 if(keyRadio3->isChecked()) stream << keyLineEdit3->text(); 185 if(keyRadio3->isChecked()) stream << keyLineEdit3->text();
187 if(authOpen->isChecked()) 186 if(authOpen->isChecked())
188 stream << " open"; 187 stream << " open";
189 else 188 else
190 stream << " restricted"; 189 stream << " restricted";
191 stream << "\"\n"; 190 stream << "\"\n";
@@ -199,32 +198,31 @@ void WLANImp::changeAndSaveSettingFile(){
199 if(output && (*it).length() ) 198 if(output && (*it).length() )
200 stream << (*it) << '\n'; 199 stream << (*it) << '\n';
201 } 200 }
202 file.close(); 201 file.close();
203} 202}
204 203
205/** 204/**
206 * Check to see if the current config is valid 205 * Check to see if the current config is valid
207 * Save wireless.opts, save interfaces 206 * Save wireless.opts, save interfaces
208 */ 207 */
209void WLANImp::accept(){ 208void WLANImp::accept(){
210 if(wepEnabled->isChecked()){ 209 if(wepEnabled->isChecked()){
211 if(keyLineEdit0->text().isEmpty() && keyLineEdit1->text().isEmpty() && keyLineEdit2->text().isEmpty() && keyLineEdit3->text().isEmpty() ) 210 if(keyLineEdit0->text().isEmpty() && keyLineEdit1->text().isEmpty() && keyLineEdit2->text().isEmpty() && keyLineEdit3->text().isEmpty() ){
212 { 211 QMessageBox::information(this, "Error", "Please enter a key for WEP.", QMessageBox::Ok);
213 QMessageBox::information(this, "Error", "Please enter a key for WEP.", QMessageBox::Ok); 212 return;
214 return; 213 }
215 }
216 } 214 }
217 215
218 if(essSpecificLineEdit->text().isEmpty()){ 216 if(essAny->isChecked() && essSpecificLineEdit->text().isEmpty()){
219 QMessageBox::information(this, "Error", "Please enter a ESS-ID.", QMessageBox::Ok); 217 QMessageBox::information(this, "Error", "Please enter a ESS-ID.", QMessageBox::Ok);
220 return; 218 return;
221 } 219 }
222 220
223 // Ok settings are good here, save 221 // Ok settings are good here, save
224 changeAndSaveSettingFile(); 222 changeAndSaveSettingFile();
225 223
226 // Try to save the interfaces settings. 224 // Try to save the interfaces settings.
227 if(!interfaceSetup->saveChanges()) 225 if(!interfaceSetup->saveChanges())
228 return; 226 return;
229 227
230 // Restart the device now that the settings have changed 228 // Restart the device now that the settings have changed
diff --git a/noncore/settings/networksettings/wlan/wlanimp.cpp b/noncore/settings/networksettings/wlan/wlanimp.cpp
index 84e0bae..cc18fba 100644
--- a/noncore/settings/networksettings/wlan/wlanimp.cpp
+++ b/noncore/settings/networksettings/wlan/wlanimp.cpp
@@ -89,31 +89,31 @@ void WLANImp::parseSettingFile(){
89 QString mode = line.mid(line.find("MODE=")+5, line.length()); 89 QString mode = line.mid(line.find("MODE=")+5, line.length());
90 if(mode == "Managed"){ 90 if(mode == "Managed"){
91 networkType->setCurrentItem(0); 91 networkType->setCurrentItem(0);
92 channelLabel->setEnabled(false); 92 channelLabel->setEnabled(false);
93 networkChannel->setEnabled(false); 93 networkChannel->setEnabled(false);
94 } 94 }
95 else{ 95 else{
96 networkType->setCurrentItem(1); 96 networkType->setCurrentItem(1);
97 networkChannel->setEnabled(true); 97 networkChannel->setEnabled(true);
98 channelLabel->setEnabled(true); 98 channelLabel->setEnabled(true);
99 } 99 }
100 } 100 }
101 if(line.contains("KEY0=")) 101 if(line.contains("#KEY0="))
102 keyLineEdit0->setText(line.mid(5, line.length())); 102 keyLineEdit0->setText(line.mid(5, line.length()));
103 if(line.contains("KEY1=")) 103 if(line.contains("#KEY1="))
104 keyLineEdit1->setText(line.mid(5, line.length())); 104 keyLineEdit1->setText(line.mid(5, line.length()));
105 if(line.contains("KEY2=")) 105 if(line.contains("#KEY2="))
106 keyLineEdit2->setText(line.mid(5, line.length())); 106 keyLineEdit2->setText(line.mid(5, line.length()));
107 if(line.contains("KEY3=")) 107 if(line.contains("#KEY3="))
108 keyLineEdit3->setText(line.mid(5, line.length())); 108 keyLineEdit3->setText(line.mid(5, line.length()));
109 109
110 if(line.contains("KEY=")){ 110 if(line.contains("KEY=")){
111 wepEnabled->setChecked(true); 111 wepEnabled->setChecked(true);
112 QString key; 112 QString key;
113 if(line.right(5) == (" open")){ 113 if(line.right(5) == (" open")){
114 key = line.mid(4, line.length()-5); 114 key = line.mid(4, line.length()-5);
115 authOpen->setChecked(true); 115 authOpen->setChecked(true);
116 authShared->setChecked(false); 116 authShared->setChecked(false);
117 } 117 }
118 else{ 118 else{
119 authOpen->setChecked(false); 119 authOpen->setChecked(false);
@@ -156,36 +156,35 @@ void WLANImp::changeAndSaveSettingFile(){
156 // See if we found our scheme to write or the sceme couldn't be found 156 // See if we found our scheme to write or the sceme couldn't be found
157 if((foundCase && line.contains("esac") && !found) || 157 if((foundCase && line.contains("esac") && !found) ||
158 (foundCase && line.left(currentProfile.length()+7) == currentProfile + ",*,*,*)" && line.at(0) != '#')){ 158 (foundCase && line.left(currentProfile.length()+7) == currentProfile + ",*,*,*)" && line.at(0) != '#')){
159 // write out scheme 159 // write out scheme
160 found = true; 160 found = true;
161 output = false; 161 output = false;
162 162
163 if(!line.contains("esac")) 163 if(!line.contains("esac"))
164 stream << line << "\n"; 164 stream << line << "\n";
165 if(!essAny->isChecked() == true){ 165 if(!essAny->isChecked() == true){
166 stream << "\tESSID=any\n"; 166 stream << "\tESSID=any\n";
167 stream << "\tMODE=Managed\n"; 167 stream << "\tMODE=Managed\n";
168 stream << "\tCHANNEL=6\n";
169 } 168 }
170 else{ 169 else{
171 stream << "\tESSID=" << essSpecificLineEdit->text() << '\n'; 170 stream << "\tESSID=" << essSpecificLineEdit->text() << '\n';
172 stream << "\tMODE=" << ( networkType->currentItem() == 0 ? "Managed" : "ad-hoc") << '\n'; 171 stream << "\tMODE=" << ( networkType->currentItem() == 0 ? "Managed" : "ad-hoc") << '\n';
173 stream << "\tCHANNEL=" << networkChannel->value() << "\n"; 172 stream << "\tCHANNEL=" << networkChannel->value() << "\n";
174 } 173 }
175 174
176 stream << "\tKEY0=" << keyLineEdit0->text() << "\n"; 175 stream << "\t#KEY0=" << keyLineEdit0->text() << "\n";
177 stream << "\tKEY1=" << keyLineEdit1->text() << "\n"; 176 stream << "\t#KEY1=" << keyLineEdit1->text() << "\n";
178 stream << "\tKEY2=" << keyLineEdit2->text() << "\n"; 177 stream << "\t#KEY2=" << keyLineEdit2->text() << "\n";
179 stream << "\tKEY3=" << keyLineEdit3->text() << "\n"; 178 stream << "\t#KEY3=" << keyLineEdit3->text() << "\n";
180 179
181 if(wepEnabled->isChecked()){ 180 if(wepEnabled->isChecked()){
182 stream << "\tKEY=\""; 181 stream << "\tKEY=\"";
183 if(keyRadio0->isChecked()) stream << keyLineEdit0->text(); 182 if(keyRadio0->isChecked()) stream << keyLineEdit0->text();
184 if(keyRadio1->isChecked()) stream << keyLineEdit1->text(); 183 if(keyRadio1->isChecked()) stream << keyLineEdit1->text();
185 if(keyRadio2->isChecked()) stream << keyLineEdit2->text(); 184 if(keyRadio2->isChecked()) stream << keyLineEdit2->text();
186 if(keyRadio3->isChecked()) stream << keyLineEdit3->text(); 185 if(keyRadio3->isChecked()) stream << keyLineEdit3->text();
187 if(authOpen->isChecked()) 186 if(authOpen->isChecked())
188 stream << " open"; 187 stream << " open";
189 else 188 else
190 stream << " restricted"; 189 stream << " restricted";
191 stream << "\"\n"; 190 stream << "\"\n";
@@ -199,32 +198,31 @@ void WLANImp::changeAndSaveSettingFile(){
199 if(output && (*it).length() ) 198 if(output && (*it).length() )
200 stream << (*it) << '\n'; 199 stream << (*it) << '\n';
201 } 200 }
202 file.close(); 201 file.close();
203} 202}
204 203
205/** 204/**
206 * Check to see if the current config is valid 205 * Check to see if the current config is valid
207 * Save wireless.opts, save interfaces 206 * Save wireless.opts, save interfaces
208 */ 207 */
209void WLANImp::accept(){ 208void WLANImp::accept(){
210 if(wepEnabled->isChecked()){ 209 if(wepEnabled->isChecked()){
211 if(keyLineEdit0->text().isEmpty() && keyLineEdit1->text().isEmpty() && keyLineEdit2->text().isEmpty() && keyLineEdit3->text().isEmpty() ) 210 if(keyLineEdit0->text().isEmpty() && keyLineEdit1->text().isEmpty() && keyLineEdit2->text().isEmpty() && keyLineEdit3->text().isEmpty() ){
212 { 211 QMessageBox::information(this, "Error", "Please enter a key for WEP.", QMessageBox::Ok);
213 QMessageBox::information(this, "Error", "Please enter a key for WEP.", QMessageBox::Ok); 212 return;
214 return; 213 }
215 }
216 } 214 }
217 215
218 if(essSpecificLineEdit->text().isEmpty()){ 216 if(essAny->isChecked() && essSpecificLineEdit->text().isEmpty()){
219 QMessageBox::information(this, "Error", "Please enter a ESS-ID.", QMessageBox::Ok); 217 QMessageBox::information(this, "Error", "Please enter a ESS-ID.", QMessageBox::Ok);
220 return; 218 return;
221 } 219 }
222 220
223 // Ok settings are good here, save 221 // Ok settings are good here, save
224 changeAndSaveSettingFile(); 222 changeAndSaveSettingFile();
225 223
226 // Try to save the interfaces settings. 224 // Try to save the interfaces settings.
227 if(!interfaceSetup->saveChanges()) 225 if(!interfaceSetup->saveChanges())
228 return; 226 return;
229 227
230 // Restart the device now that the settings have changed 228 // Restart the device now that the settings have changed