summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/transferserver.cpp50
-rw-r--r--core/settings/security/security.cpp41
-rw-r--r--core/settings/security/security.h1
-rw-r--r--core/settings/security/securitybase.ui34
4 files changed, 99 insertions, 27 deletions
diff --git a/core/launcher/transferserver.cpp b/core/launcher/transferserver.cpp
index 439e110..eea9f3a 100644
--- a/core/launcher/transferserver.cpp
+++ b/core/launcher/transferserver.cpp
@@ -190,39 +190,49 @@ bool SyncAuthentication::checkPassword( const QString& password )
190 return TRUE; 190 return TRUE;
191#endif 191#endif
192 192
193 static int lastdenial=0; 193 static int lastdenial=0;
194 static int denials=0; 194 static int denials=0;
195 int now = time(0); 195 int now = time(0);
196 196
197 Config cfg("Security");
198 cfg.setGroup("Sync");
199 QString syncapp = cfg.readEntry("syncapp","Qtopia");
200
201 //No password needed if the user really wants it
202 if (syncapp == "IntelliSync") {
203 return TRUE;
204 }
205
197 // Detect old Qtopia Desktop (no password) 206 // Detect old Qtopia Desktop (no password)
198 if ( password.isEmpty() ) { 207 if ( password.isEmpty() ) {
199 if ( denials < 1 || now > lastdenial+600 ) { 208 if ( denials < 3 || now > lastdenial+600 ) {
200 QMessageBox unauth( 209 QMessageBox unauth(
201 tr("Sync Connection"), 210 tr("Sync Connection"),
202 tr("<p>An unauthorized system is requesting access to this device." 211 tr("<p>An unauthorized system is requesting access to this device."
203 "<p>If you are using a version of Qtopia Desktop older than 1.5.1, " 212 "<p>If you are using a version of Qtopia Desktop older than 1.5.1, "
204 "please upgrade."), 213 "please upgrade or change the security setting to use IntelliSync." ),
205 QMessageBox::Warning, 214 QMessageBox::Warning,
206 QMessageBox::Cancel, QMessageBox::NoButton, QMessageBox::NoButton, 215 QMessageBox::Cancel, QMessageBox::NoButton, QMessageBox::NoButton,
207 0, QString::null, TRUE, WStyle_StaysOnTop); 216 0, QString::null, TRUE, WStyle_StaysOnTop);
208 unauth.setButtonText(QMessageBox::Cancel, tr("Deny")); 217 unauth.setButtonText(QMessageBox::Cancel, tr("Deny"));
209 unauth.exec(); 218 unauth.exec();
210 219
211 denials++; 220 denials++;
212 lastdenial=now; 221 lastdenial=now;
213 } 222 }
214 return FALSE; 223 return FALSE;
215 } 224
225 }
216 226
217 // Second, check sync password... 227 // Second, check sync password...
218 228
219 static int lock=0; 229 static int lock=0;
220 if ( lock ) return FALSE; 230 if ( lock ) return FALSE;
221 231
222 ++lock; 232 ++lock;
223 233
224 /* 234 /*
225 * we need to support old Sync software and QtopiaDesktop 235 * we need to support old Sync software and QtopiaDesktop
226 */ 236 */
227 if ( password.left(6) == "Qtopia" || password.left(6) == "rootme" ) { 237 if ( password.left(6) == "Qtopia" || password.left(6) == "rootme" ) {
228 Config cfg( "Security" ); 238 Config cfg( "Security" );
diff --git a/core/settings/security/security.cpp b/core/settings/security/security.cpp
index 81363d2..1b90121 100644
--- a/core/settings/security/security.cpp
+++ b/core/settings/security/security.cpp
@@ -45,12 +45,22 @@
45 int auth_peer = cfg.readNumEntry("auth_peer",0xc0a88100);//new default 192.168.129.0/24 45 int auth_peer = cfg.readNumEntry("auth_peer",0xc0a88100);//new default 192.168.129.0/24
46 int auth_peer_bits = cfg.readNumEntry("auth_peer_bits",24); 46 int auth_peer_bits = cfg.readNumEntry("auth_peer_bits",24);
47 selectNet(auth_peer,auth_peer_bits); 47 selectNet(auth_peer,auth_peer_bits);
48 connect(syncnet, SIGNAL(textChanged(const QString&)), 48 connect(syncnet, SIGNAL(textChanged(const QString&)),
49 this, SLOT(setSyncNet(const QString&))); 49 this, SLOT(setSyncNet(const QString&)));
50 50
51 cfg.setGroup("Sync");
52 QString sa = cfg.readEntry("syncapp","Qtopia");
53
54 //There must be a better way to do that...
55 for (int i=0; i<syncapp->count(); i++) {
56 if ( syncapp->text(i) == sa ) {
57 syncapp->setCurrentItem(i);
58 }
59 }
60
51 /* 61 /*
52 cfg.setGroup("Remote"); 62 cfg.setGroup("Remote");
53 if ( telnetAvailable() ) 63 if ( telnetAvailable() )
54 telnet->setChecked(cfg.readEntry("allow_telnet")); 64 telnet->setChecked(cfg.readEntry("allow_telnet"));
55 else 65 else
56 telnet->hide(); 66 telnet->hide();
@@ -60,13 +70,13 @@
60 else 70 else
61 ssh->hide(); 71 ssh->hide();
62 */ 72 */
63 73
64 QString configFile = QPEApplication::qpeDir() + "/etc/opie-login.conf"; 74 QString configFile = QPEApplication::qpeDir() + "/etc/opie-login.conf";
65 Config loginCfg(configFile,Config::File); 75 Config loginCfg(configFile,Config::File);
66 76
67 loginCfg.setGroup("General"); 77 loginCfg.setGroup("General");
68 autoLoginName=loginCfg.readEntry("AutoLogin",""); 78 autoLoginName=loginCfg.readEntry("AutoLogin","");
69 79
70 if (autoLoginName.stripWhiteSpace().isEmpty()) { 80 if (autoLoginName.stripWhiteSpace().isEmpty()) {
71 autoLogin=false; 81 autoLogin=false;
72 } else { 82 } else {
@@ -78,13 +88,14 @@
78 syncModeCombo->setCurrentItem( mode - 1 ); 88 syncModeCombo->setCurrentItem( mode - 1 );
79 89
80 connect(autologinToggle, SIGNAL(toggled(bool)), this, SLOT(toggleAutoLogin(bool))); 90 connect(autologinToggle, SIGNAL(toggled(bool)), this, SLOT(toggleAutoLogin(bool)));
81 connect(userlist, SIGNAL(activated(int)), this, SLOT(changeLoginName(int))); 91 connect(userlist, SIGNAL(activated(int)), this, SLOT(changeLoginName(int)));
82 connect(changepasscode,SIGNAL(clicked()), this, SLOT(changePassCode())); 92 connect(changepasscode,SIGNAL(clicked()), this, SLOT(changePassCode()));
83 connect(clearpasscode,SIGNAL(clicked()), this, SLOT(clearPassCode())); 93 connect(clearpasscode,SIGNAL(clicked()), this, SLOT(clearPassCode()));
84 94 connect(syncapp,SIGNAL(activated(int)), this, SLOT(changeSyncApp()));
95
85 loadUsers(); 96 loadUsers();
86 updateGUI(); 97 updateGUI();
87 98
88 dl = new QPEDialogListener(this); 99 dl = new QPEDialogListener(this);
89 showMaximized(); 100 showMaximized();
90} 101}
@@ -101,14 +112,13 @@ void Security::updateGUI()
101 changepasscode->setText( empty ? tr("Set passcode" ) 112 changepasscode->setText( empty ? tr("Set passcode" )
102 : tr("Change passcode" ) ); 113 : tr("Change passcode" ) );
103 passcode_poweron->setEnabled( !empty ); 114 passcode_poweron->setEnabled( !empty );
104 clearpasscode->setEnabled( !empty ); 115 clearpasscode->setEnabled( !empty );
105 116
106 autologinToggle->setChecked(autoLogin); 117 autologinToggle->setChecked(autoLogin);
107 userlist->setEnabled(autoLogin); 118 userlist->setEnabled(autoLogin);
108
109} 119}
110 120
111 121
112void Security::show() 122void Security::show()
113{ 123{
114 //valid=FALSE; 124 //valid=FALSE;
@@ -245,13 +255,15 @@ void Security::applySecurity()
245 cfg.setGroup("Sync"); 255 cfg.setGroup("Sync");
246 int auth_peer=0; 256 int auth_peer=0;
247 int auth_peer_bits; 257 int auth_peer_bits;
248 QString sn = syncnet->currentText(); 258 QString sn = syncnet->currentText();
249 parseNet(sn,auth_peer,auth_peer_bits); 259 parseNet(sn,auth_peer,auth_peer_bits);
250 cfg.writeEntry("auth_peer",auth_peer); 260 cfg.writeEntry("auth_peer",auth_peer);
251 cfg.writeEntry("auth_peer_bits",auth_peer_bits); 261 cfg.writeEntry("auth_peer_bits",auth_peer_bits);
262 cfg.writeEntry("syncapp",syncapp->currentText());
263
252 /* 264 /*
253 cfg.setGroup("Remote"); 265 cfg.setGroup("Remote");
254 if ( telnetAvailable() ) 266 if ( telnetAvailable() )
255 cfg.writeEntry("allow_telnet",telnet->isChecked()); 267 cfg.writeEntry("allow_telnet",telnet->isChecked());
256 if ( sshAvailable() ) 268 if ( sshAvailable() )
257 cfg.writeEntry("allow_ssh",ssh->isChecked()); 269 cfg.writeEntry("allow_ssh",ssh->isChecked());
@@ -267,12 +279,31 @@ void Security::applySecurity()
267 } else { 279 } else {
268 loginCfg.removeEntry("AutoLogin"); 280 loginCfg.removeEntry("AutoLogin");
269 } 281 }
270 282
271 } 283 }
272} 284}
285void Security::changeSyncApp()
286{
287 // Don't say i didn't tell ya
288 if (syncapp->currentText() == "IntelliSync") {
289 QMessageBox attn(
290 tr("WARNING"),
291 tr("<p>Selecting IntelliSync here will disable the FTP password."
292 "<p>Every machine in your netrange will be able to sync with "
293 "your Zaurus!"),
294 QMessageBox::Warning,
295 QMessageBox::Cancel, QMessageBox::NoButton, QMessageBox::NoButton,
296 0, QString::null, TRUE, WStyle_StaysOnTop);
297 attn.setButtonText(QMessageBox::Cancel, tr("Ok"));
298 attn.exec();
299 }
300 updateGUI();
301}
302
303
273 304
274void Security::changeLoginName( int idx ) 305void Security::changeLoginName( int idx )
275{ 306{
276 autoLoginName = userlist->text(idx);; 307 autoLoginName = userlist->text(idx);;
277 updateGUI(); 308 updateGUI();
278} 309}
diff --git a/core/settings/security/security.h b/core/settings/security/security.h
index 52d56de..b1a3eca 100644
--- a/core/settings/security/security.h
+++ b/core/settings/security/security.h
@@ -43,12 +43,13 @@ protected:
43private slots: 43private slots:
44 void changePassCode(); 44 void changePassCode();
45 void clearPassCode(); 45 void clearPassCode();
46 void setSyncNet(const QString&); 46 void setSyncNet(const QString&);
47 void changeLoginName(int); 47 void changeLoginName(int);
48 void toggleAutoLogin(bool); 48 void toggleAutoLogin(bool);
49 void changeSyncApp();
49 50
50 51
51private: 52private:
52 void loadUsers(void); 53 void loadUsers(void);
53 bool telnetAvailable() const; 54 bool telnetAvailable() const;
54 bool sshAvailable() const; 55 bool sshAvailable() const;
diff --git a/core/settings/security/securitybase.ui b/core/settings/security/securitybase.ui
index 9fb63a8..934111e 100644
--- a/core/settings/security/securitybase.ui
+++ b/core/settings/security/securitybase.ui
@@ -8,13 +8,13 @@
8 </property> 8 </property>
9 <property stdset="1"> 9 <property stdset="1">
10 <name>geometry</name> 10 <name>geometry</name>
11 <rect> 11 <rect>
12 <x>0</x> 12 <x>0</x>
13 <y>0</y> 13 <y>0</y>
14 <width>329</width> 14 <width>321</width>
15 <height>483</height> 15 <height>483</height>
16 </rect> 16 </rect>
17 </property> 17 </property>
18 <property stdset="1"> 18 <property stdset="1">
19 <name>caption</name> 19 <name>caption</name>
20 <string>Security Settings</string> 20 <string>Security Settings</string>
@@ -279,13 +279,13 @@
279 <name>title</name> 279 <name>title</name>
280 <string>Sync</string> 280 <string>Sync</string>
281 </attribute> 281 </attribute>
282 <vbox> 282 <vbox>
283 <property stdset="1"> 283 <property stdset="1">
284 <name>margin</name> 284 <name>margin</name>
285 <number>6</number> 285 <number>11</number>
286 </property> 286 </property>
287 <property stdset="1"> 287 <property stdset="1">
288 <name>spacing</name> 288 <name>spacing</name>
289 <number>6</number> 289 <number>6</number>
290 </property> 290 </property>
291 <widget> 291 <widget>
@@ -379,12 +379,42 @@
379 <property stdset="1"> 379 <property stdset="1">
380 <name>editable</name> 380 <name>editable</name>
381 <bool>true</bool> 381 <bool>true</bool>
382 </property> 382 </property>
383 </widget> 383 </widget>
384 <widget> 384 <widget>
385 <class>QLabel</class>
386 <property stdset="1">
387 <name>name</name>
388 <cstring>TextLabel2</cstring>
389 </property>
390 <property stdset="1">
391 <name>text</name>
392 <string>Select your sync software</string>
393 </property>
394 </widget>
395 <widget>
396 <class>QComboBox</class>
397 <item>
398 <property>
399 <name>text</name>
400 <string>QTopia</string>
401 </property>
402 </item>
403 <item>
404 <property>
405 <name>text</name>
406 <string>IntelliSync</string>
407 </property>
408 </item>
409 <property stdset="1">
410 <name>name</name>
411 <cstring>syncapp</cstring>
412 </property>
413 </widget>
414 <widget>
385 <class>QComboBox</class> 415 <class>QComboBox</class>
386 <item> 416 <item>
387 <property> 417 <property>
388 <name>text</name> 418 <name>text</name>
389 <string>Qtopia 1.7</string> 419 <string>Qtopia 1.7</string>
390 </property> 420 </property>