summaryrefslogtreecommitdiff
path: root/core/launcher/transferserver.cpp
authorzecke <zecke>2004-02-21 13:09:17 (UTC)
committer zecke <zecke>2004-02-21 13:09:17 (UTC)
commit4024cfd1e32a43d82361d6ba9977fe64db88e3ce (patch) (unidiff)
tree1d2e0592a3df330a17d9a07cd2f29615ce5be595 /core/launcher/transferserver.cpp
parentaa11789fc4d735a04fac09063851753d8a57027b (diff)
downloadopie-4024cfd1e32a43d82361d6ba9977fe64db88e3ce.zip
opie-4024cfd1e32a43d82361d6ba9977fe64db88e3ce.tar.gz
opie-4024cfd1e32a43d82361d6ba9977fe64db88e3ce.tar.bz2
Fix up syncing mode
InetlliSync,Opie1.0,QtopiaNEW
Diffstat (limited to 'core/launcher/transferserver.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/launcher/transferserver.cpp28
1 files changed, 23 insertions, 5 deletions
diff --git a/core/launcher/transferserver.cpp b/core/launcher/transferserver.cpp
index 9cb9d7a..8367a62 100644
--- a/core/launcher/transferserver.cpp
+++ b/core/launcher/transferserver.cpp
@@ -173,57 +173,75 @@ bool SyncAuthentication::checkPassword( const QString& password )
173#ifdef ALLOW_UNIX_USER_FTP 173#ifdef ALLOW_UNIX_USER_FTP
174 // First, check system password... 174 // First, check system password...
175 175
176 struct passwd *pw = 0; 176 struct passwd *pw = 0;
177 struct spwd *spw = 0; 177 struct spwd *spw = 0;
178 178
179 pw = getpwuid( geteuid() ); 179 pw = getpwuid( geteuid() );
180 spw = getspnam( pw->pw_name ); 180 spw = getspnam( pw->pw_name );
181 181
182 QString cpwd = QString::fromLocal8Bit( pw->pw_passwd ); 182 QString cpwd = QString::fromLocal8Bit( pw->pw_passwd );
183 if ( cpwd == "x" && spw ) 183 if ( cpwd == "x" && spw )
184 cpwd = QString::fromLocal8Bit( spw->sp_pwdp ); 184 cpwd = QString::fromLocal8Bit( spw->sp_pwdp );
185 185
186 // Note: some systems use more than crypt for passwords. 186 // Note: some systems use more than crypt for passwords.
187 QString cpassword = QString::fromLocal8Bit( crypt( password.local8Bit(), cpwd.local8Bit() ) ); 187 QString cpassword = QString::fromLocal8Bit( crypt( password.local8Bit(), cpwd.local8Bit() ) );
188 if ( cpwd == cpassword ) 188 if ( cpwd == cpassword )
189 return TRUE; 189 return TRUE;
190#endif 190#endif
191 191
192 static int lastdenial=0; 192 static int lastdenial=0;
193 static int denials=0; 193 static int denials=0;
194 int now = time(0); 194 int now = time(0);
195 195
196 Config cfg("Security"); 196 Config cfg("Security");
197 cfg.setGroup("Sync"); 197 cfg.setGroup("SyncMode");
198 QString syncapp = cfg.readEntry("syncapp","Qtopia"); 198 int mode = cfg.readNumEntry("Mode", 0x02 );
199 199
200 //No password needed if the user really wants it 200 //No pass word needed if the user really needs it
201 if (syncapp == "IntelliSync") { 201 if (mode & 0x04) {
202 QMessageBox unauth(
203 tr("Sync Connection"),
204 tr("<qt><p>An unauthorized system is requesting access to this device."
205 "<p>You chose IntelliSync so you may I allow or deny this connection.</qt>" ),
206 QMessageBox::Warning,
207 QMessageBox::Ok, QMessageBox::Cancel|QMessageBox::Default, QMessageBox::NoButton,
208 0, QString::null, TRUE, WStyle_StaysOnTop);
209 unauth.setButtonText(QMessageBox::Ok, tr("Allow" ) );
210 unauth.setButtonText(QMessageBox::Cancel, tr("Deny"));
211 switch( unauth.exec() ) {
212 case QMessageBox::Ok:
202 return TRUE; 213 return TRUE;
214 break;
215 case QMessageBox::Cancel:
216 default:
217 denials++;
218 lastdenial=now;
219 return FALSE;
220 }
203 } 221 }
204 222
205 // Detect old Qtopia Desktop (no password) 223 // Detect old Qtopia Desktop (no password) and fail
206 if ( password.isEmpty() ) { 224 if ( password.isEmpty() ) {
207 if ( denials < 3 || now > lastdenial+600 ) { 225 if ( denials < 3 || now > lastdenial+600 ) {
208 QMessageBox unauth( 226 QMessageBox unauth(
209 tr("Sync Connection"), 227 tr("Sync Connection"),
210 tr("<p>An unauthorized system is requesting access to this device." 228 tr("<p>An unauthorized system is requesting access to this device."
211 "<p>If you are using a version of Qtopia Desktop older than 1.5.1, " 229 "<p>If you are using a version of Qtopia Desktop older than 1.5.1, "
212 "please upgrade or change the security setting to use IntelliSync." ), 230 "please upgrade or change the security setting to use IntelliSync." ),
213 QMessageBox::Warning, 231 QMessageBox::Warning,
214 QMessageBox::Cancel, QMessageBox::NoButton, QMessageBox::NoButton, 232 QMessageBox::Cancel, QMessageBox::NoButton, QMessageBox::NoButton,
215 0, QString::null, TRUE, WStyle_StaysOnTop); 233 0, QString::null, TRUE, WStyle_StaysOnTop);
216 unauth.setButtonText(QMessageBox::Cancel, tr("Deny")); 234 unauth.setButtonText(QMessageBox::Cancel, tr("Deny"));
217 unauth.exec(); 235 unauth.exec();
218 236
219 denials++; 237 denials++;
220 lastdenial=now; 238 lastdenial=now;
221 } 239 }
222 return FALSE; 240 return FALSE;
223 241
224 } 242 }
225 243
226 // Second, check sync password... 244 // Second, check sync password...
227 245
228 static int lock=0; 246 static int lock=0;
229 if ( lock ) return FALSE; 247 if ( lock ) return FALSE;