author | zecke <zecke> | 2004-12-20 21:58:55 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-12-20 21:58:55 (UTC) |
commit | 5f35158ba0e7c2813768aaab6d6ad478dc0271a1 (patch) (side-by-side diff) | |
tree | a4d6e8000e14ecd4e48ffee18fba733f78fbd0a7 | |
parent | 7479e7ac142eb830329fb08f16179bb3aca642e5 (diff) | |
download | opie-5f35158ba0e7c2813768aaab6d6ad478dc0271a1.zip opie-5f35158ba0e7c2813768aaab6d6ad478dc0271a1.tar.gz opie-5f35158ba0e7c2813768aaab6d6ad478dc0271a1.tar.bz2 |
Restore lost change
-Kill Config instance in different scope for the same file
-Work when a ftp client sends -la in a listdir request
-rw-r--r-- | core/launcher/transferserver.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/core/launcher/transferserver.cpp b/core/launcher/transferserver.cpp index 1d4ca40..2b2e435 100644 --- a/core/launcher/transferserver.cpp +++ b/core/launcher/transferserver.cpp @@ -219,33 +219,32 @@ bool SyncAuthentication::checkPassword( const QString& password ) } return FALSE; } // Second, check sync password... static int lock=0; if ( lock ) return FALSE; ++lock; /* * we need to support old Sync software and QtopiaDesktop */ if ( password.left(6) == "Qtopia" || password.left(6) == "rootme" ) { - Config cfg( "Security" ); cfg.setGroup("Sync"); QStringList pwds = cfg.readListEntry("Passwords",' '); for (QStringList::ConstIterator it=pwds.begin(); it!=pwds.end(); ++it) { #ifndef Q_OS_WIN32 QString cpassword = QString::fromLocal8Bit( crypt( password.mid(8).local8Bit(), (*it).left(2).latin1() ) ); #else // ### revise QString cpassword(""); #endif if ( *it == cpassword ) { lock--; return TRUE; } } @@ -367,34 +366,36 @@ void ServerPI::connectionClosed() void ServerPI::send( const QString& msg ) { QTextStream os( this ); os << msg << endl; //odebug << "Reply: " << msg << "" << oendl; } void ServerPI::read() { while ( canReadLine() ) process( readLine().stripWhiteSpace() ); } bool ServerPI::checkReadFile( const QString& file ) { QString filename; - - if ( file[0] != "/" ) + + if ( file.length() == 1 && file[0] == "/" ) + filename = file; + else if ( file[0] != "/" ) filename = directory.path() + "/" + file; else filename = file; QFileInfo fi( filename ); return ( fi.exists() && fi.isReadable() ); } bool ServerPI::checkWriteFile( const QString& file ) { QString filename; if ( file[0] != "/" ) filename = directory.path() + "/" + file; else filename = file; @@ -684,32 +685,35 @@ void ServerPI::process( const QString& message ) else { QDir dir; if ( dir.mkdir( absFilePath( args ), TRUE ) ) send( "250 Requested file action okay, completed." ); // No tr else send( "550 Requested action not taken" ); // No tr } } // print working directory (PWD) else if ( cmd == "PWD" ) { send( "257 \"" + directory.path() +"\"" ); } // list (LIST) else if ( cmd == "LIST" ) { + if ( args == "-la" ) + args = QString::null; + if ( sendList( absFilePath( args ) ) ) send( "150 File status okay" ); // No tr else send( "500 Syntax error, command unrecognized" ); // No tr } // size (SIZE) else if ( cmd == "SIZE" ) { QString filePath = absFilePath( args ); QFileInfo fi( filePath ); bool gzipfile = backupRestoreGzip( filePath ); if ( !fi.exists() && !gzipfile ) send( "500 Syntax error, command unrecognized" ); // No tr else { if ( !gzipfile ) send( "213 " + QString::number( fi.size() ) ); |