summaryrefslogtreecommitdiff
authorzecke <zecke>2002-09-06 21:35:13 (UTC)
committer zecke <zecke>2002-09-06 21:35:13 (UTC)
commite95e14f056ce6be658a4fd0d4737168431e92d88 (patch) (unidiff)
tree732f0a69b2063dc6c54444486223fd99879da72c
parent5536f65e60b3c662d2da3636e617faaad02522db (diff)
downloadopie-e95e14f056ce6be658a4fd0d4737168431e92d88.zip
opie-e95e14f056ce6be658a4fd0d4737168431e92d88.tar.gz
opie-e95e14f056ce6be658a4fd0d4737168431e92d88.tar.bz2
Remove the libuuid dependency for Linux targets...
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcher.pro2
-rw-r--r--core/launcher/opie-taskbar.control2
-rw-r--r--core/launcher/transferserver.cpp59
3 files changed, 49 insertions, 14 deletions
diff --git a/core/launcher/launcher.pro b/core/launcher/launcher.pro
index bae5c51..5b32bc3 100644
--- a/core/launcher/launcher.pro
+++ b/core/launcher/launcher.pro
@@ -100,5 +100,5 @@ INCLUDEPATH += ../../rsync
100 DEPENDPATH+= ../../rsync 100 DEPENDPATH+= ../../rsync
101 TARGET = qpe 101 TARGET = qpe
102 LIBS += -lqpe -lcrypt -lopie -luuid 102 LIBS += -lqpe -lcrypt -lopie
103 103
104TRANSLATIONS = ../../i18n/de/qpe.ts \ 104TRANSLATIONS = ../../i18n/de/qpe.ts \
diff --git a/core/launcher/opie-taskbar.control b/core/launcher/opie-taskbar.control
index ce73d8b..e9338fb 100644
--- a/core/launcher/opie-taskbar.control
+++ b/core/launcher/opie-taskbar.control
@@ -5,5 +5,5 @@ Maintainer: Project Opie <opie@handhelds.org>
5Architecture: arm 5Architecture: arm
6Version: $QPE_VERSION-$SUB_VERSION.1 6Version: $QPE_VERSION-$SUB_VERSION.1
7Depends: qt-embedded (>=$QTE_VERSION), libuuid1 7Depends: qt-embedded (>=$QTE_VERSION)
8Description: Launcher for Opie 8Description: Launcher for Opie
9 The "finder" or "explorer", or whatever you want to call it. 9 The "finder" or "explorer", or whatever you want to call it.
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
@@ -26,4 +26,6 @@
26#include <shadow.h> 26#include <shadow.h>
27 27
28#ifndef _OS_LINUX_
29
28extern "C" { 30extern "C" {
29#include <uuid/uuid.h> 31#include <uuid/uuid.h>
@@ -31,4 +33,6 @@ extern "C" {
31} 33}
32 34
35#endif // not defined linux
36
33#if defined(_OS_LINUX_) 37#if defined(_OS_LINUX_)
34#include <shadow.h> 38#include <shadow.h>
@@ -77,4 +81,35 @@ void TransferServer::newConnection( int socket )
77} 81}
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()
80{ 115{
@@ -83,7 +118,7 @@ QString SyncAuthentication::serverId()
83 QString r=cfg.readEntry("serverid"); 118 QString r=cfg.readEntry("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 }
89 return r; 124 return r;
@@ -116,5 +151,5 @@ int SyncAuthentication::isAuthorized(QHostAddress peeraddress)
116// QString allowedstr = cfg.readEntry("auth_peer","192.168.1.0"); 151// QString allowedstr = cfg.readEntry("auth_peer","192.168.1.0");
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;
120// allowed.setAddress(allowedstr); 155// allowed.setAddress(allowedstr);
@@ -174,5 +209,5 @@ bool SyncAuthentication::checkPassword( const QString& password )
174 // Second, check sync password... 209 // Second, check sync 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
178 * prefixed. Qtopia prefix will suceed 213 * prefixed. Qtopia prefix will suceed
@@ -181,5 +216,5 @@ bool SyncAuthentication::checkPassword( const QString& password )
181 */ 216 */
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" ) );
185 Config cfg("Security"); 220 Config cfg("Security");
@@ -225,9 +260,9 @@ ServerPI::ServerPI( int socket, QObject *parent , const char* name )
225 startTimer( 0 ); 260 startTimer( 0 );
226 } else 261 } else
227#endif 262#endif
228 { 263 {
229 connect( this, SIGNAL( readyRead() ), SLOT( read() ) ); 264 connect( this, SIGNAL( readyRead() ), SLOT( read() ) );
230 connect( this, SIGNAL( connectionClosed() ), SLOT( connectionClosed() ) ); 265 connect( this, SIGNAL( connectionClosed() ), SLOT( connectionClosed() ) );
231 266
232 passiv = FALSE; 267 passiv = FALSE;
233 for( int i = 0; i < 4; i++ ) 268 for( int i = 0; i < 4; i++ )
@@ -628,5 +663,5 @@ void ServerPI::process( const QString& message )
628 send( "213 " + QString::number(guess) ); 663 send( "213 " + QString::number(guess) );
629 } 664 }
630 } 665 }
631 } 666 }
632 } 667 }
@@ -1178,5 +1213,5 @@ void ServerDTP::readyRead()
1178 if ( !gzipProc->isRunning() ) 1213 if ( !gzipProc->isRunning() )
1179 gzipProc->start(); 1214 gzipProc->start();
1180 1215
1181 QByteArray s; 1216 QByteArray s;
1182 s.resize( bytesAvailable() ); 1217 s.resize( bytesAvailable() );
@@ -1261,5 +1296,5 @@ void ServerDTP::sendGzipFile( const QString &fn,
1261 SIGNAL( readyReadStdout() ), SLOT( gzipTarBlock() ) ); 1296 SIGNAL( readyReadStdout() ), SLOT( gzipTarBlock() ) );
1262 1297
1263 gzipProc->setArguments( "gzip" ); 1298 gzipProc->setArguments( "gzip" );
1264 connect( gzipProc, SIGNAL( readyReadStdout() ), 1299 connect( gzipProc, SIGNAL( readyReadStdout() ),
1265 SLOT( writeTargzBlock() ) ); 1300 SLOT( writeTargzBlock() ) );
@@ -1307,5 +1342,5 @@ void ServerDTP::retrieveGzipFile( const QString &fn )
1307 mode = RetrieveGzipFile; 1342 mode = RetrieveGzipFile;
1308 1343
1309 gzipProc->setArguments( "gunzip" ); 1344 gzipProc->setArguments( "gunzip" );
1310 connect( gzipProc, SIGNAL( readyReadStdout() ), 1345 connect( gzipProc, SIGNAL( readyReadStdout() ),
1311 SLOT( tarExtractBlock() ) ); 1346 SLOT( tarExtractBlock() ) );