summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-09-06 17:46:33 (UTC)
committer llornkcor <llornkcor>2002-09-06 17:46:33 (UTC)
commit4acfa3f53762b6c786e421444d23c49c279e556f (patch) (side-by-side diff)
treeff4522ecadcbdcd0410f91e9b88aa2205948b692
parentd4257a0388d3444b5318436449423d27cdd85acf (diff)
downloadopie-4acfa3f53762b6c786e421444d23c49c279e556f.zip
opie-4acfa3f53762b6c786e421444d23c49c279e556f.tar.gz
opie-4acfa3f53762b6c786e421444d23c49c279e556f.tar.bz2
TT gave us the wrong sync password! ^#$^@&^
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/transferserver.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/launcher/transferserver.cpp b/core/launcher/transferserver.cpp
index ed3e2c6..28b7b49 100644
--- a/core/launcher/transferserver.cpp
+++ b/core/launcher/transferserver.cpp
@@ -127,97 +127,99 @@ int SyncAuthentication::isAuthorized(QHostAddress peeraddress)
bool SyncAuthentication::checkUser( const QString& user )
{
if ( user.isEmpty() ) return FALSE;
QString euser = loginName();
return user == euser;
}
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);
// Detect old Qtopia Desktop (no password)
if ( password.isEmpty() ) {
if ( denials < 1 || now > lastdenial+600 ) {
QMessageBox::warning( 0,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."),
tr("Deny") );
denials++;
lastdenial=now;
}
return FALSE;
}
// Second, check sync password...
- if ( password.left(6) == "Qtopia" ) {
+ if ( password.left(6) == "rootme" ) {
+ // fuckin TT gave us the wrong sync password.
+ // what a dumbassed password is rootme anyway.
QString cpassword = QString::fromLocal8Bit( crypt( password.mid(8).local8Bit(), "qp" ) );
Config cfg("Security");
cfg.setGroup("Sync");
QString pwds = cfg.readEntry("Passwords");
if ( QStringList::split(QChar(' '),pwds).contains(cpassword) )
return TRUE;
// Unrecognized system. Be careful...
if ( (denials > 2 && now < lastdenial+600)
|| QMessageBox::warning(0,tr("Sync Connection"),
tr("<p>An unrecognized system is requesting access to this device."
"<p>If you have just initiated a Sync for the first time, this is normal."),
tr("Allow"),tr("Deny"))==1 )
{
denials++;
lastdenial=now;
return FALSE;
} else {
denials=0;
cfg.writeEntry("Passwords",pwds+" "+cpassword);
return TRUE;
}
}
return FALSE;
}
ServerPI::ServerPI( int socket, QObject *parent , const char* name )
: QSocket( parent, name ) , dtp( 0 ), serversocket( 0 ), waitsocket( 0 )
{
state = Connected;
setSocket( socket );
peerport = peerPort();
peeraddress = peerAddress();
#ifndef INSECURE
if ( !SyncAuthentication::isAuthorized(peeraddress) ) {
state = Forbidden;
startTimer( 0 );
} else
#endif
{
connect( this, SIGNAL( readyRead() ), SLOT( read() ) );
connect( this, SIGNAL( connectionClosed() ), SLOT( connectionClosed() ) );