author | zecke <zecke> | 2002-10-04 21:16:03 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-04 21:16:03 (UTC) |
commit | 10048c2dd7f7cd26c582d64b5e255b00b47de304 (patch) (side-by-side diff) | |
tree | 3b2a79d8218efe5f80d1b2e79e77b22cbc27c2ba | |
parent | dc0344e987ba9b386056dd7bab7c5e34922eff5c (diff) | |
download | opie-10048c2dd7f7cd26c582d64b5e255b00b47de304.zip opie-10048c2dd7f7cd26c582d64b5e255b00b47de304.tar.gz opie-10048c2dd7f7cd26c582d64b5e255b00b47de304.tar.bz2 |
Weird for some of you
_OS_LINUX_ does not get defined
so now it's a if !define(_OS_LINUX)
but this means you need to libuuid again
I don't know how to fix that right. I should ask tt
-rw-r--r-- | core/launcher/transferserver.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/core/launcher/transferserver.cpp b/core/launcher/transferserver.cpp index a20df2f..f9204ab 100644 --- a/core/launcher/transferserver.cpp +++ b/core/launcher/transferserver.cpp @@ -43,116 +43,116 @@ extern "C" { #include <qtextstream.h> #include <qdatastream.h> #include <qmessagebox.h> #include <qstringlist.h> #include <qfileinfo.h> #include <qregexp.h> //#include <qpe/qcopchannel_qws.h> #include <qpe/process.h> #include <qpe/global.h> #include <qpe/config.h> #include <qpe/contact.h> #include <qpe/quuid.h> #include <qpe/version.h> #ifdef QWS #include <qpe/qcopenvelope_qws.h> #endif #include "transferserver.h" #include "qprocess.h" const int block_size = 51200; TransferServer::TransferServer( Q_UINT16 port, QObject *parent , const char* name ) : QServerSocket( port, 1, parent, name ) { if ( !ok() ) qWarning( "Failed to bind to port %d", port ); } TransferServer::~TransferServer() { } void TransferServer::newConnection( int socket ) { (void) new ServerPI( socket, this ); } /* * small class in anonymous namespace * to generate a QUUid for us */ namespace { struct UidGen { QString uuid(); }; -#if defined(_OS_LINUX_) +#if !defined(_OS_LINUX_) + QString UidGen::uuid() { + uuid_t uuid; + uuid_generate( uuid ); + return QUUid( uuid ).toString(); + } +#else /* * linux got a /proc/sys/kernel/random/uuid file * it'll generate the uuids for us */ QString UidGen::uuid() { QFile file( "/proc/sys/kernel/random/uuid" ); if (!file.open(IO_ReadOnly ) ) return QString::null; QTextStream stream(&file); return "{" + stream.read().stripWhiteSpace() + "}"; } -#else - QString UidGen::uuid() { - uuid_t uuid; - uuid_generate( uuid ); - return QUUid( uuid ).toString(); - } #endif } QString SyncAuthentication::serverId() { Config cfg("Security"); cfg.setGroup("Sync"); QString r=cfg.readEntry("serverid"); if ( r.isEmpty() ) { UidGen gen; r = gen.uuid(); cfg.writeEntry("serverid", r ); } return r; } QString SyncAuthentication::ownerName() { QString vfilename = Global::applicationFileName("addressbook", "businesscard.vcf"); if (QFile::exists(vfilename)) { Contact c; c = Contact::readVCard( vfilename )[0]; return c.fullName(); } return ""; } QString SyncAuthentication::loginName() { struct passwd *pw; pw = getpwuid( geteuid() ); return QString::fromLocal8Bit( pw->pw_name ); } int SyncAuthentication::isAuthorized(QHostAddress peeraddress) { Config cfg("Security"); cfg.setGroup("Sync"); // QString allowedstr = cfg.readEntry("auth_peer","192.168.1.0"); uint auth_peer = cfg.readNumEntry("auth_peer",0xc0a80100); // QHostAddress allowed; // allowed.setAddress(allowedstr); // uint auth_peer = allowed.ip4Addr(); uint auth_peer_bits = cfg.readNumEntry("auth_peer_bits",24); uint mask = auth_peer_bits >= 32 // shifting by 32 is not defined |