summaryrefslogtreecommitdiff
path: root/core/launcher/transferserver.cpp
authorzecke <zecke>2002-09-06 21:35:13 (UTC)
committer zecke <zecke>2002-09-06 21:35:13 (UTC)
commite95e14f056ce6be658a4fd0d4737168431e92d88 (patch) (unidiff)
tree732f0a69b2063dc6c54444486223fd99879da72c /core/launcher/transferserver.cpp
parent5536f65e60b3c662d2da3636e617faaad02522db (diff)
downloadopie-e95e14f056ce6be658a4fd0d4737168431e92d88.zip
opie-e95e14f056ce6be658a4fd0d4737168431e92d88.tar.gz
opie-e95e14f056ce6be658a4fd0d4737168431e92d88.tar.bz2
Remove the libuuid dependency for Linux targets...
Diffstat (limited to 'core/launcher/transferserver.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/transferserver.cpp59
1 files changed, 47 insertions, 12 deletions
diff --git a/core/launcher/transferserver.cpp b/core/launcher/transferserver.cpp
index 9d18b7b..a20df2f 100644
--- a/core/launcher/transferserver.cpp
+++ b/core/launcher/transferserver.cpp
@@ -27,2 +27,4 @@
27 27
28#ifndef _OS_LINUX_
29
28extern "C" { 30extern "C" {
@@ -32,2 +34,4 @@ extern "C" {
32 34
35#endif // not defined linux
36
33#if defined(_OS_LINUX_) 37#if defined(_OS_LINUX_)
@@ -78,2 +82,33 @@ void TransferServer::newConnection( int socket )
78 82
83/*
84 * small class in anonymous namespace
85 * to generate a QUUid for us
86 */
87namespace {
88 struct UidGen {
89 QString uuid();
90 };
91#if defined(_OS_LINUX_)
92 /*
93 * linux got a /proc/sys/kernel/random/uuid file
94 * it'll generate the uuids for us
95 */
96 QString UidGen::uuid() {
97 QFile file( "/proc/sys/kernel/random/uuid" );
98 if (!file.open(IO_ReadOnly ) )
99 return QString::null;
100
101 QTextStream stream(&file);
102
103 return "{" + stream.read().stripWhiteSpace() + "}";
104 }
105#else
106 QString UidGen::uuid() {
107 uuid_t uuid;
108 uuid_generate( uuid );
109 return QUUid( uuid ).toString();
110 }
111#endif
112}
113
79QString SyncAuthentication::serverId() 114QString SyncAuthentication::serverId()
@@ -84,5 +119,5 @@ QString SyncAuthentication::serverId()
84 if ( r.isEmpty() ) { 119 if ( r.isEmpty() ) {
85 uuid_t uuid; 120 UidGen gen;
86 uuid_generate( uuid ); 121 r = gen.uuid();
87 cfg.writeEntry("serverid",(r = QUuid( uuid ).toString())); 122 cfg.writeEntry("serverid", r );
88 } 123 }
@@ -117,3 +152,3 @@ int SyncAuthentication::isAuthorized(QHostAddress peeraddress)
117 uint auth_peer = cfg.readNumEntry("auth_peer",0xc0a80100); 152 uint auth_peer = cfg.readNumEntry("auth_peer",0xc0a80100);
118 153
119// QHostAddress allowed; 154// QHostAddress allowed;
@@ -175,3 +210,3 @@ bool SyncAuthentication::checkPassword( const QString& password )
175 QString pass = password.left(6); 210 QString pass = password.left(6);
176 /* old QtopiaDesktops are sending 211 /* old QtopiaDesktops are sending
177 * rootme newer versions got a Qtopia 212 * rootme newer versions got a Qtopia
@@ -182,3 +217,3 @@ bool SyncAuthentication::checkPassword( const QString& password )
182 if ( pass == "rootme" || pass == "Qtopia") { 217 if ( pass == "rootme" || pass == "Qtopia") {
183 218
184 QString cpassword = QString::fromLocal8Bit( crypt( password.mid(8).local8Bit(), "qp" ) ); 219 QString cpassword = QString::fromLocal8Bit( crypt( password.mid(8).local8Bit(), "qp" ) );
@@ -226,3 +261,3 @@ ServerPI::ServerPI( int socket, QObject *parent , const char* name )
226 } else 261 } else
227#endif 262#endif
228 { 263 {
@@ -230,3 +265,3 @@ ServerPI::ServerPI( int socket, QObject *parent , const char* name )
230 connect( this, SIGNAL( connectionClosed() ), SLOT( connectionClosed() ) ); 265 connect( this, SIGNAL( connectionClosed() ), SLOT( connectionClosed() ) );
231 266
232 passiv = FALSE; 267 passiv = FALSE;
@@ -629,3 +664,3 @@ void ServerPI::process( const QString& message )
629 } 664 }
630 } 665 }
631 } 666 }
@@ -1179,3 +1214,3 @@ void ServerDTP::readyRead()
1179 gzipProc->start(); 1214 gzipProc->start();
1180 1215
1181 QByteArray s; 1216 QByteArray s;
@@ -1262,3 +1297,3 @@ void ServerDTP::sendGzipFile( const QString &fn,
1262 1297
1263 gzipProc->setArguments( "gzip" ); 1298 gzipProc->setArguments( "gzip" );
1264 connect( gzipProc, SIGNAL( readyReadStdout() ), 1299 connect( gzipProc, SIGNAL( readyReadStdout() ),
@@ -1308,3 +1343,3 @@ void ServerDTP::retrieveGzipFile( const QString &fn )
1308 1343
1309 gzipProc->setArguments( "gunzip" ); 1344 gzipProc->setArguments( "gunzip" );
1310 connect( gzipProc, SIGNAL( readyReadStdout() ), 1345 connect( gzipProc, SIGNAL( readyReadStdout() ),