summaryrefslogtreecommitdiff
path: root/core/launcher/transferserver.cpp
Side-by-side diff
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 )
#ifdef ALLOW_UNIX_USER_FTP
// First, check system password...
struct passwd *pw = 0;
struct spwd *spw = 0;
pw = getpwuid( geteuid() );
spw = getspnam( pw->pw_name );
QString cpwd = QString::fromLocal8Bit( pw->pw_passwd );
if ( cpwd == "x" && spw )
cpwd = QString::fromLocal8Bit( spw->sp_pwdp );
// Note: some systems use more than crypt for passwords.
QString cpassword = QString::fromLocal8Bit( crypt( password.local8Bit(), cpwd.local8Bit() ) );
if ( cpwd == cpassword )
return TRUE;
#endif
static int lastdenial=0;
static int denials=0;
int now = time(0);
Config cfg("Security");
- cfg.setGroup("Sync");
- QString syncapp = cfg.readEntry("syncapp","Qtopia");
+ cfg.setGroup("SyncMode");
+ int mode = cfg.readNumEntry("Mode", 0x02 );
- //No password needed if the user really wants it
- if (syncapp == "IntelliSync") {
+ //No pass word needed if the user really needs it
+ if (mode & 0x04) {
+ QMessageBox unauth(
+ tr("Sync Connection"),
+ tr("<qt><p>An unauthorized system is requesting access to this device."
+ "<p>You chose IntelliSync so you may I allow or deny this connection.</qt>" ),
+ QMessageBox::Warning,
+ QMessageBox::Ok, QMessageBox::Cancel|QMessageBox::Default, QMessageBox::NoButton,
+ 0, QString::null, TRUE, WStyle_StaysOnTop);
+ unauth.setButtonText(QMessageBox::Ok, tr("Allow" ) );
+ unauth.setButtonText(QMessageBox::Cancel, tr("Deny"));
+ switch( unauth.exec() ) {
+ case QMessageBox::Ok:
return TRUE;
+ break;
+ case QMessageBox::Cancel:
+ default:
+ denials++;
+ lastdenial=now;
+ return FALSE;
+ }
}
- // Detect old Qtopia Desktop (no password)
+ // Detect old Qtopia Desktop (no password) and fail
if ( password.isEmpty() ) {
if ( denials < 3 || now > lastdenial+600 ) {
QMessageBox unauth(
tr("Sync Connection"),
tr("<p>An unauthorized system is requesting access to this device."
"<p>If you are using a version of Qtopia Desktop older than 1.5.1, "
"please upgrade or change the security setting to use IntelliSync." ),
QMessageBox::Warning,
QMessageBox::Cancel, QMessageBox::NoButton, QMessageBox::NoButton,
0, QString::null, TRUE, WStyle_StaysOnTop);
unauth.setButtonText(QMessageBox::Cancel, tr("Deny"));
unauth.exec();
denials++;
lastdenial=now;
}
return FALSE;
}
// Second, check sync password...
static int lock=0;
if ( lock ) return FALSE;