summaryrefslogtreecommitdiff
path: root/core/qws/transferserver.cpp
Side-by-side diff
Diffstat (limited to 'core/qws/transferserver.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/qws/transferserver.cpp31
1 files changed, 25 insertions, 6 deletions
diff --git a/core/qws/transferserver.cpp b/core/qws/transferserver.cpp
index 0337a94..239c824 100644
--- a/core/qws/transferserver.cpp
+++ b/core/qws/transferserver.cpp
@@ -20,29 +20,41 @@
#define _XOPEN_SOURCE
#include <pwd.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <time.h>
+
+#ifndef Q_OS_MACX
#include <shadow.h>
+#endif /* Q_OS_MACX */
/* we need the _OS_LINUX stuff first ! */
#include <qglobal.h>
#ifndef _OS_LINUX_
+// Is anybody able to review this ? The include "uuid/uuid.h" couldn't be found
+// anywhere ? Therfore I removed it completely..
+// I think it should be made permanentyl !? (eilers)
+#warning "Where should uuid/uuid.h be found ? Removed this part .. (eilers)"
+#if 0
extern "C"
{
#include <uuid/uuid.h>
#define UUID_H_INCLUDED
}
+#endif
+
#endif // not defined linux
#if defined(_OS_LINUX_)
#include <shadow.h>
+#elif defined(Q_OS_MACX)
+#include <stdlib.h>
#endif
#include <qdir.h>
#include <qfile.h>
#include <qtextstream.h>
#include <qdatastream.h>
@@ -88,21 +100,21 @@ void TransferServer::newConnection( int socket )
namespace
{
struct UidGen
{
QString uuid();
};
-#if !defined(_OS_LINUX_)
-
+#if defined(Q_OS_MACX)
QString UidGen::uuid()
{
- uuid_t uuid;
- uuid_generate( uuid );
- return QUUid( uuid ).toString();
+ srandom( random() );
+ QString numStr = QString::number( random() );
+
+ return "{" + numStr + "}";
}
-#else
+#elif defined(_OS_LINUX_)
/*
* linux got a /proc/sys/kernel/random/uuid file
* it'll generate the uuids for us
*/
QString UidGen::uuid()
{
@@ -111,12 +123,19 @@ QString UidGen::uuid()
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");