-rw-r--r-- | core/launcher/transferserver.cpp | 50 | ||||
-rw-r--r-- | core/settings/security/security.cpp | 41 | ||||
-rw-r--r-- | core/settings/security/security.h | 1 | ||||
-rw-r--r-- | core/settings/security/securitybase.ui | 34 |
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 | |||
@@ -164,91 +164,101 @@ int SyncAuthentication::isAuthorized(QHostAddress peeraddress) | |||
164 | 164 | ||
165 | bool SyncAuthentication::checkUser( const QString& user ) | 165 | bool SyncAuthentication::checkUser( const QString& user ) |
166 | { | 166 | { |
167 | if ( user.isEmpty() ) return FALSE; | 167 | if ( user.isEmpty() ) return FALSE; |
168 | QString euser = loginName(); | 168 | QString euser = loginName(); |
169 | return user == euser; | 169 | return user == euser; |
170 | } | 170 | } |
171 | 171 | ||
172 | bool SyncAuthentication::checkPassword( const QString& password ) | 172 | bool SyncAuthentication::checkPassword( const QString& password ) |
173 | { | 173 | { |
174 | #ifdef ALLOW_UNIX_USER_FTP | 174 | #ifdef ALLOW_UNIX_USER_FTP |
175 | // First, check system password... | 175 | // First, check system password... |
176 | 176 | ||
177 | struct passwd *pw = 0; | 177 | struct passwd *pw = 0; |
178 | struct spwd *spw = 0; | 178 | struct spwd *spw = 0; |
179 | 179 | ||
180 | pw = getpwuid( geteuid() ); | 180 | pw = getpwuid( geteuid() ); |
181 | spw = getspnam( pw->pw_name ); | 181 | spw = getspnam( pw->pw_name ); |
182 | 182 | ||
183 | QString cpwd = QString::fromLocal8Bit( pw->pw_passwd ); | 183 | QString cpwd = QString::fromLocal8Bit( pw->pw_passwd ); |
184 | if ( cpwd == "x" && spw ) | 184 | if ( cpwd == "x" && spw ) |
185 | cpwd = QString::fromLocal8Bit( spw->sp_pwdp ); | 185 | cpwd = QString::fromLocal8Bit( spw->sp_pwdp ); |
186 | 186 | ||
187 | // Note: some systems use more than crypt for passwords. | 187 | // Note: some systems use more than crypt for passwords. |
188 | QString cpassword = QString::fromLocal8Bit( crypt( password.local8Bit(), cpwd.local8Bit() ) ); | 188 | QString cpassword = QString::fromLocal8Bit( crypt( password.local8Bit(), cpwd.local8Bit() ) ); |
189 | if ( cpwd == cpassword ) | 189 | if ( cpwd == cpassword ) |
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" ); |
229 | cfg.setGroup("Sync"); | 239 | cfg.setGroup("Sync"); |
230 | QStringList pwds = cfg.readListEntry("Passwords",' '); | 240 | QStringList pwds = cfg.readListEntry("Passwords",' '); |
231 | for (QStringList::ConstIterator it=pwds.begin(); it!=pwds.end(); ++it) { | 241 | for (QStringList::ConstIterator it=pwds.begin(); it!=pwds.end(); ++it) { |
232 | #ifndef Q_OS_WIN32 | 242 | #ifndef Q_OS_WIN32 |
233 | QString cpassword = QString::fromLocal8Bit( | 243 | QString cpassword = QString::fromLocal8Bit( |
234 | crypt( password.mid(8).local8Bit(), (*it).left(2).latin1() ) ); | 244 | crypt( password.mid(8).local8Bit(), (*it).left(2).latin1() ) ); |
235 | #else | 245 | #else |
236 | // ### revise | 246 | // ### revise |
237 | QString cpassword(""); | 247 | QString cpassword(""); |
238 | #endif | 248 | #endif |
239 | if ( *it == cpassword ) { | 249 | if ( *it == cpassword ) { |
240 | lock--; | 250 | lock--; |
241 | return TRUE; | 251 | return TRUE; |
242 | } | 252 | } |
243 | } | 253 | } |
244 | 254 | ||
245 | // Unrecognized system. Be careful... | 255 | // Unrecognized system. Be careful... |
246 | QMessageBox unrecbox( | 256 | QMessageBox unrecbox( |
247 | tr("Sync Connection"), | 257 | tr("Sync Connection"), |
248 | tr("<p>An unrecognized system is requesting access to this device." | 258 | tr("<p>An unrecognized system is requesting access to this device." |
249 | "<p>If you have just initiated a Sync for the first time, this is normal."), | 259 | "<p>If you have just initiated a Sync for the first time, this is normal."), |
250 | QMessageBox::Warning, | 260 | QMessageBox::Warning, |
251 | QMessageBox::Cancel, QMessageBox::Yes, QMessageBox::NoButton, | 261 | QMessageBox::Cancel, QMessageBox::Yes, QMessageBox::NoButton, |
252 | 0, QString::null, TRUE, WStyle_StaysOnTop); | 262 | 0, QString::null, TRUE, WStyle_StaysOnTop); |
253 | unrecbox.setButtonText(QMessageBox::Cancel, tr("Deny")); | 263 | unrecbox.setButtonText(QMessageBox::Cancel, tr("Deny")); |
254 | unrecbox.setButtonText(QMessageBox::Yes, tr("Allow")); | 264 | unrecbox.setButtonText(QMessageBox::Yes, tr("Allow")); |
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 | |||
@@ -19,122 +19,132 @@ | |||
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include "security.h" | 20 | #include "security.h" |
21 | 21 | ||
22 | #include <qpe/qpeapplication.h> | 22 | #include <qpe/qpeapplication.h> |
23 | #include <qpe/config.h> | 23 | #include <qpe/config.h> |
24 | #include <qpe/password.h> | 24 | #include <qpe/password.h> |
25 | #include <qpe/qpedialog.h> | 25 | #include <qpe/qpedialog.h> |
26 | #include <qpe/qcopenvelope_qws.h> | 26 | #include <qpe/qcopenvelope_qws.h> |
27 | 27 | ||
28 | #include <qcheckbox.h> | 28 | #include <qcheckbox.h> |
29 | #include <qpushbutton.h> | 29 | #include <qpushbutton.h> |
30 | #include <qcombobox.h> | 30 | #include <qcombobox.h> |
31 | #include <qmessagebox.h> | 31 | #include <qmessagebox.h> |
32 | #include <qfile.h> | 32 | #include <qfile.h> |
33 | #include <qlistview.h> | 33 | #include <qlistview.h> |
34 | #include <qtextstream.h> | 34 | #include <qtextstream.h> |
35 | 35 | ||
36 | Security::Security( QWidget* parent, const char* name, WFlags fl ) | 36 | Security::Security( QWidget* parent, const char* name, WFlags fl ) |
37 | : SecurityBase( parent, name, TRUE, fl ) | 37 | : SecurityBase( parent, name, TRUE, fl ) |
38 | { | 38 | { |
39 | valid=FALSE; | 39 | valid=FALSE; |
40 | Config cfg("Security"); | 40 | Config cfg("Security"); |
41 | cfg.setGroup("Passcode"); | 41 | cfg.setGroup("Passcode"); |
42 | passcode = cfg.readEntry("passcode"); | 42 | passcode = cfg.readEntry("passcode"); |
43 | passcode_poweron->setChecked(cfg.readBoolEntry("passcode_poweron",FALSE)); | 43 | passcode_poweron->setChecked(cfg.readBoolEntry("passcode_poweron",FALSE)); |
44 | cfg.setGroup("Sync"); | 44 | cfg.setGroup("Sync"); |
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(); |
57 | 67 | ||
58 | if ( sshAvailable() ) | 68 | if ( sshAvailable() ) |
59 | ssh->setChecked(cfg.readEntry("allow_ssh")); | 69 | ssh->setChecked(cfg.readEntry("allow_ssh")); |
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 { |
73 | autoLogin=true; | 83 | autoLogin=true; |
74 | } | 84 | } |
75 | 85 | ||
76 | cfg.setGroup("SyncMode"); | 86 | cfg.setGroup("SyncMode"); |
77 | int mode = cfg.readNumEntry("Mode",2); // Default to Sharp | 87 | int mode = cfg.readNumEntry("Mode",2); // Default to Sharp |
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 | } |
91 | 102 | ||
92 | Security::~Security() | 103 | Security::~Security() |
93 | { | 104 | { |
94 | } | 105 | } |
95 | 106 | ||
96 | 107 | ||
97 | void Security::updateGUI() | 108 | void Security::updateGUI() |
98 | { | 109 | { |
99 | bool empty = passcode.isEmpty(); | 110 | bool empty = passcode.isEmpty(); |
100 | 111 | ||
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 | ||
112 | void Security::show() | 122 | void Security::show() |
113 | { | 123 | { |
114 | //valid=FALSE; | 124 | //valid=FALSE; |
115 | setEnabled(FALSE); | 125 | setEnabled(FALSE); |
116 | SecurityBase::show(); | 126 | SecurityBase::show(); |
117 | if ( passcode.isEmpty() ) { | 127 | if ( passcode.isEmpty() ) { |
118 | // could insist... | 128 | // could insist... |
119 | //changePassCode(); | 129 | //changePassCode(); |
120 | //if ( passcode.isEmpty() ) | 130 | //if ( passcode.isEmpty() ) |
121 | //reject(); | 131 | //reject(); |
122 | } else { | 132 | } else { |
123 | if (!valid) // security passcode was not asked yet, so ask now | 133 | if (!valid) // security passcode was not asked yet, so ask now |
124 | { | 134 | { |
125 | QString pc = enterPassCode(tr("Enter passcode")); | 135 | QString pc = enterPassCode(tr("Enter passcode")); |
126 | if ( pc != passcode ) { | 136 | if ( pc != passcode ) { |
127 | QMessageBox::critical(this, tr("Passcode incorrect"), | 137 | QMessageBox::critical(this, tr("Passcode incorrect"), |
128 | tr("The passcode entered is incorrect.\nAccess denied")); | 138 | tr("The passcode entered is incorrect.\nAccess denied")); |
129 | reject(); | 139 | reject(); |
130 | return; | 140 | return; |
131 | } | 141 | } |
132 | } | 142 | } |
133 | } | 143 | } |
134 | setEnabled(TRUE); | 144 | setEnabled(TRUE); |
135 | valid=TRUE; | 145 | valid=TRUE; |
136 | } | 146 | } |
137 | 147 | ||
138 | void Security::accept() | 148 | void Security::accept() |
139 | { | 149 | { |
140 | applySecurity(); | 150 | applySecurity(); |
@@ -219,86 +229,107 @@ void Security::loadUsers ( void ) | |||
219 | 229 | ||
220 | void Security::toggleAutoLogin(bool val) | 230 | void Security::toggleAutoLogin(bool val) |
221 | { | 231 | { |
222 | autoLogin=val; | 232 | autoLogin=val; |
223 | userlist->setEnabled(val); | 233 | userlist->setEnabled(val); |
224 | if (!autoLogin) | 234 | if (!autoLogin) |
225 | autoLoginName=userlist->currentText(); | 235 | autoLoginName=userlist->currentText(); |
226 | } | 236 | } |
227 | 237 | ||
228 | 238 | ||
229 | 239 | ||
230 | 240 | ||
231 | void Security::setSyncNet(const QString& sn) | 241 | void Security::setSyncNet(const QString& sn) |
232 | { | 242 | { |
233 | int auth_peer,auth_peer_bits; | 243 | int auth_peer,auth_peer_bits; |
234 | parseNet(sn,auth_peer,auth_peer_bits); | 244 | parseNet(sn,auth_peer,auth_peer_bits); |
235 | selectNet(auth_peer,auth_peer_bits); | 245 | selectNet(auth_peer,auth_peer_bits); |
236 | } | 246 | } |
237 | 247 | ||
238 | void Security::applySecurity() | 248 | void Security::applySecurity() |
239 | { | 249 | { |
240 | if ( valid ) { | 250 | if ( valid ) { |
241 | Config cfg("Security"); | 251 | Config cfg("Security"); |
242 | cfg.setGroup("Passcode"); | 252 | cfg.setGroup("Passcode"); |
243 | cfg.writeEntry("passcode",passcode); | 253 | cfg.writeEntry("passcode",passcode); |
244 | cfg.writeEntry("passcode_poweron",passcode_poweron->isChecked()); | 254 | cfg.writeEntry("passcode_poweron",passcode_poweron->isChecked()); |
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()); |
258 | // ### write ssh/telnet sys config files | 270 | // ### write ssh/telnet sys config files |
259 | */ | 271 | */ |
260 | 272 | ||
261 | QString configFile = QPEApplication::qpeDir() + "/etc/opie-login.conf"; | 273 | QString configFile = QPEApplication::qpeDir() + "/etc/opie-login.conf"; |
262 | Config loginCfg(configFile,Config::File); | 274 | Config loginCfg(configFile,Config::File); |
263 | loginCfg.setGroup("General"); | 275 | loginCfg.setGroup("General"); |
264 | 276 | ||
265 | if (autoLogin) { | 277 | if (autoLogin) { |
266 | loginCfg.writeEntry("AutoLogin",autoLoginName); | 278 | loginCfg.writeEntry("AutoLogin",autoLoginName); |
267 | } else { | 279 | } else { |
268 | loginCfg.removeEntry("AutoLogin"); | 280 | loginCfg.removeEntry("AutoLogin"); |
269 | } | 281 | } |
270 | 282 | ||
271 | } | 283 | } |
272 | } | 284 | } |
285 | void 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 | ||
274 | void Security::changeLoginName( int idx ) | 305 | void Security::changeLoginName( int idx ) |
275 | { | 306 | { |
276 | autoLoginName = userlist->text(idx);; | 307 | autoLoginName = userlist->text(idx);; |
277 | updateGUI(); | 308 | updateGUI(); |
278 | } | 309 | } |
279 | 310 | ||
280 | void Security::changePassCode() | 311 | void Security::changePassCode() |
281 | { | 312 | { |
282 | QString new1; | 313 | QString new1; |
283 | QString new2; | 314 | QString new2; |
284 | 315 | ||
285 | do { | 316 | do { |
286 | new1 = enterPassCode(tr("Enter new passcode")); | 317 | new1 = enterPassCode(tr("Enter new passcode")); |
287 | if ( new1.isNull() ) | 318 | if ( new1.isNull() ) |
288 | return; | 319 | return; |
289 | new2 = enterPassCode(tr("Re-enter new passcode")); | 320 | new2 = enterPassCode(tr("Re-enter new passcode")); |
290 | if ( new2.isNull() ) | 321 | if ( new2.isNull() ) |
291 | return; | 322 | return; |
292 | } while (new1 != new2); | 323 | } while (new1 != new2); |
293 | 324 | ||
294 | passcode = new1; | 325 | passcode = new1; |
295 | updateGUI(); | 326 | updateGUI(); |
296 | } | 327 | } |
297 | 328 | ||
298 | void Security::clearPassCode() | 329 | void Security::clearPassCode() |
299 | { | 330 | { |
300 | passcode = QString::null; | 331 | passcode = QString::null; |
301 | updateGUI(); | 332 | updateGUI(); |
302 | } | 333 | } |
303 | 334 | ||
304 | 335 | ||
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 | |||
@@ -17,55 +17,56 @@ | |||
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef SECURITY_H | 20 | #ifndef SECURITY_H |
21 | #define SECURITY_H | 21 | #define SECURITY_H |
22 | 22 | ||
23 | #include "securitybase.h" | 23 | #include "securitybase.h" |
24 | 24 | ||
25 | class QPEDialogListener; | 25 | class QPEDialogListener; |
26 | 26 | ||
27 | class Security : public SecurityBase | 27 | class Security : public SecurityBase |
28 | { | 28 | { |
29 | Q_OBJECT | 29 | Q_OBJECT |
30 | 30 | ||
31 | public: | 31 | public: |
32 | static QString appName() { return QString::fromLatin1("security"); } | 32 | static QString appName() { return QString::fromLatin1("security"); } |
33 | Security( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 33 | Security( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
34 | ~Security(); | 34 | ~Security(); |
35 | 35 | ||
36 | void show(); | 36 | void show(); |
37 | 37 | ||
38 | protected: | 38 | protected: |
39 | void accept(); | 39 | void accept(); |
40 | void applySecurity(); | 40 | void applySecurity(); |
41 | void done(int); | 41 | void done(int); |
42 | 42 | ||
43 | private slots: | 43 | private 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 | ||
51 | private: | 52 | private: |
52 | void loadUsers(void); | 53 | void loadUsers(void); |
53 | bool telnetAvailable() const; | 54 | bool telnetAvailable() const; |
54 | bool sshAvailable() const; | 55 | bool sshAvailable() const; |
55 | void updateGUI(); | 56 | void updateGUI(); |
56 | 57 | ||
57 | static void parseNet(const QString& sn,int& auth_peer,int& auth_peer_bits); | 58 | static void parseNet(const QString& sn,int& auth_peer,int& auth_peer_bits); |
58 | void selectNet(int auth_peer,int auth_peer_bits); | 59 | void selectNet(int auth_peer,int auth_peer_bits); |
59 | 60 | ||
60 | QString enterPassCode(const QString&); | 61 | QString enterPassCode(const QString&); |
61 | QString passcode; | 62 | QString passcode; |
62 | bool valid; | 63 | bool valid; |
63 | bool autoLogin; | 64 | bool autoLogin; |
64 | QString autoLoginName; | 65 | QString autoLoginName; |
65 | 66 | ||
66 | QPEDialogListener *dl; | 67 | QPEDialogListener *dl; |
67 | }; | 68 | }; |
68 | 69 | ||
69 | 70 | ||
70 | #endif // SECURITY_H | 71 | #endif // SECURITY_H |
71 | 72 | ||
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 | |||
@@ -1,46 +1,46 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>SecurityBase</class> | 2 | <class>SecurityBase</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QDialog</class> | 4 | <class>QDialog</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>SecurityBase</cstring> | 7 | <cstring>SecurityBase</cstring> |
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> |
21 | </property> | 21 | </property> |
22 | <property> | 22 | <property> |
23 | <name>layoutMargin</name> | 23 | <name>layoutMargin</name> |
24 | </property> | 24 | </property> |
25 | <property> | 25 | <property> |
26 | <name>layoutSpacing</name> | 26 | <name>layoutSpacing</name> |
27 | </property> | 27 | </property> |
28 | <vbox> | 28 | <vbox> |
29 | <property stdset="1"> | 29 | <property stdset="1"> |
30 | <name>margin</name> | 30 | <name>margin</name> |
31 | <number>0</number> | 31 | <number>0</number> |
32 | </property> | 32 | </property> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>spacing</name> | 34 | <name>spacing</name> |
35 | <number>0</number> | 35 | <number>0</number> |
36 | </property> | 36 | </property> |
37 | <widget> | 37 | <widget> |
38 | <class>QTabWidget</class> | 38 | <class>QTabWidget</class> |
39 | <property stdset="1"> | 39 | <property stdset="1"> |
40 | <name>name</name> | 40 | <name>name</name> |
41 | <cstring>TabWidget2</cstring> | 41 | <cstring>TabWidget2</cstring> |
42 | </property> | 42 | </property> |
43 | <property> | 43 | <property> |
44 | <name>layoutMargin</name> | 44 | <name>layoutMargin</name> |
45 | </property> | 45 | </property> |
46 | <widget> | 46 | <widget> |
@@ -253,65 +253,65 @@ | |||
253 | </property> | 253 | </property> |
254 | <property stdset="1"> | 254 | <property stdset="1"> |
255 | <name>orientation</name> | 255 | <name>orientation</name> |
256 | <enum>Vertical</enum> | 256 | <enum>Vertical</enum> |
257 | </property> | 257 | </property> |
258 | <property stdset="1"> | 258 | <property stdset="1"> |
259 | <name>sizeType</name> | 259 | <name>sizeType</name> |
260 | <enum>Expanding</enum> | 260 | <enum>Expanding</enum> |
261 | </property> | 261 | </property> |
262 | <property> | 262 | <property> |
263 | <name>sizeHint</name> | 263 | <name>sizeHint</name> |
264 | <size> | 264 | <size> |
265 | <width>20</width> | 265 | <width>20</width> |
266 | <height>20</height> | 266 | <height>20</height> |
267 | </size> | 267 | </size> |
268 | </property> | 268 | </property> |
269 | </spacer> | 269 | </spacer> |
270 | </vbox> | 270 | </vbox> |
271 | </widget> | 271 | </widget> |
272 | <widget> | 272 | <widget> |
273 | <class>QWidget</class> | 273 | <class>QWidget</class> |
274 | <property stdset="1"> | 274 | <property stdset="1"> |
275 | <name>name</name> | 275 | <name>name</name> |
276 | <cstring>tab</cstring> | 276 | <cstring>tab</cstring> |
277 | </property> | 277 | </property> |
278 | <attribute> | 278 | <attribute> |
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> |
292 | <class>QGroupBox</class> | 292 | <class>QGroupBox</class> |
293 | <property stdset="1"> | 293 | <property stdset="1"> |
294 | <name>name</name> | 294 | <name>name</name> |
295 | <cstring>GroupBox2</cstring> | 295 | <cstring>GroupBox2</cstring> |
296 | </property> | 296 | </property> |
297 | <property stdset="1"> | 297 | <property stdset="1"> |
298 | <name>title</name> | 298 | <name>title</name> |
299 | <string>Sync</string> | 299 | <string>Sync</string> |
300 | </property> | 300 | </property> |
301 | <vbox> | 301 | <vbox> |
302 | <property stdset="1"> | 302 | <property stdset="1"> |
303 | <name>margin</name> | 303 | <name>margin</name> |
304 | <number>11</number> | 304 | <number>11</number> |
305 | </property> | 305 | </property> |
306 | <property stdset="1"> | 306 | <property stdset="1"> |
307 | <name>spacing</name> | 307 | <name>spacing</name> |
308 | <number>6</number> | 308 | <number>6</number> |
309 | </property> | 309 | </property> |
310 | <widget> | 310 | <widget> |
311 | <class>QLabel</class> | 311 | <class>QLabel</class> |
312 | <property stdset="1"> | 312 | <property stdset="1"> |
313 | <name>name</name> | 313 | <name>name</name> |
314 | <cstring>TextLabel1_2</cstring> | 314 | <cstring>TextLabel1_2</cstring> |
315 | </property> | 315 | </property> |
316 | <property stdset="1"> | 316 | <property stdset="1"> |
317 | <name>text</name> | 317 | <name>text</name> |
@@ -353,64 +353,94 @@ | |||
353 | <name>text</name> | 353 | <name>text</name> |
354 | <string>10.0.0.0/8</string> | 354 | <string>10.0.0.0/8</string> |
355 | </property> | 355 | </property> |
356 | </item> | 356 | </item> |
357 | <item> | 357 | <item> |
358 | <property> | 358 | <property> |
359 | <name>text</name> | 359 | <name>text</name> |
360 | <string>1.0.0.0/8</string> | 360 | <string>1.0.0.0/8</string> |
361 | </property> | 361 | </property> |
362 | </item> | 362 | </item> |
363 | <item> | 363 | <item> |
364 | <property> | 364 | <property> |
365 | <name>text</name> | 365 | <name>text</name> |
366 | <string>Any</string> | 366 | <string>Any</string> |
367 | </property> | 367 | </property> |
368 | </item> | 368 | </item> |
369 | <item> | 369 | <item> |
370 | <property> | 370 | <property> |
371 | <name>text</name> | 371 | <name>text</name> |
372 | <string>None</string> | 372 | <string>None</string> |
373 | </property> | 373 | </property> |
374 | </item> | 374 | </item> |
375 | <property stdset="1"> | 375 | <property stdset="1"> |
376 | <name>name</name> | 376 | <name>name</name> |
377 | <cstring>syncnet</cstring> | 377 | <cstring>syncnet</cstring> |
378 | </property> | 378 | </property> |
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> |
391 | </item> | 421 | </item> |
392 | <item> | 422 | <item> |
393 | <property> | 423 | <property> |
394 | <name>text</name> | 424 | <name>text</name> |
395 | <string>Opie 1.0</string> | 425 | <string>Opie 1.0</string> |
396 | </property> | 426 | </property> |
397 | </item> | 427 | </item> |
398 | <item> | 428 | <item> |
399 | <property> | 429 | <property> |
400 | <name>text</name> | 430 | <name>text</name> |
401 | <string>Both</string> | 431 | <string>Both</string> |
402 | </property> | 432 | </property> |
403 | </item> | 433 | </item> |
404 | <property stdset="1"> | 434 | <property stdset="1"> |
405 | <name>name</name> | 435 | <name>name</name> |
406 | <cstring>syncModeCombo</cstring> | 436 | <cstring>syncModeCombo</cstring> |
407 | </property> | 437 | </property> |
408 | </widget> | 438 | </widget> |
409 | </vbox> | 439 | </vbox> |
410 | </widget> | 440 | </widget> |
411 | <spacer> | 441 | <spacer> |
412 | <property> | 442 | <property> |
413 | <name>name</name> | 443 | <name>name</name> |
414 | <cstring>Spacer1</cstring> | 444 | <cstring>Spacer1</cstring> |
415 | </property> | 445 | </property> |
416 | <property stdset="1"> | 446 | <property stdset="1"> |