mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-26 16:09:35 -05:00
Added Ben's patches:
* Compilation for FreeBSD. * Notes that MT is not cryptographically secure. * modified sorting of DHT Window. Only one change that I didn't commit: bitdht { - LIBS += ../../libbitdht/src/lib/libbitdht.a - PRE_TARGETDEPS *= ../../libbitdht/src/lib/libbitdht.a + LIBS += ../../libbitdht/src/libbitdht.a + PRE_TARGETDEPS *= ../../libbitdht/src/libbitdht.a } As this would have broken compilation on the other platforms. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4619 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
bb9f362458
commit
5ea8cfb67d
@ -12,6 +12,9 @@ static bool auto_seed = bdRandom::seed( (time(NULL) + ((uint32_t) pthread_self()
|
|||||||
#else
|
#else
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
static bool auto_seed = bdRandom::seed( (time(NULL) + pthread_mach_thread_np(pthread_self())*0x1293fe + (getpid()^0x113ef76b))^0x18e34a12 ) ;
|
static bool auto_seed = bdRandom::seed( (time(NULL) + pthread_mach_thread_np(pthread_self())*0x1293fe + (getpid()^0x113ef76b))^0x18e34a12 ) ;
|
||||||
|
#elif defined(__FreeBSD__)
|
||||||
|
// since this is completely insecure anyway, just kludge for now
|
||||||
|
static bool auto_seed = bdRandom::seed(time(NULL));
|
||||||
#else
|
#else
|
||||||
static bool auto_seed = bdRandom::seed( (time(NULL) + pthread_self()*0x1293fe + (getpid()^0x113ef76b))^0x18e34a12 ) ;
|
static bool auto_seed = bdRandom::seed( (time(NULL) + pthread_self()*0x1293fe + (getpid()^0x113ef76b))^0x18e34a12 ) ;
|
||||||
#endif
|
#endif
|
||||||
|
@ -32,12 +32,15 @@
|
|||||||
// - thread safe
|
// - thread safe
|
||||||
// - system independant
|
// - system independant
|
||||||
// - fast
|
// - fast
|
||||||
// - cryptographically safe
|
// - NOT CRYPTOGRAPHICALLY SAFE
|
||||||
|
// - DO NOT USE FOR ANYTHING REQUIRING STRONG RANDOMNESS
|
||||||
//
|
//
|
||||||
// The implementation is adapted from the Mersenne Twister page of Wikipedia.
|
// The implementation is adapted from the Mersenne Twister page of Wikipedia.
|
||||||
//
|
//
|
||||||
// http://en.wikipedia.org/wiki/Mersenne_twister
|
// http://en.wikipedia.org/wiki/Mersenne_twister
|
||||||
|
|
||||||
|
// FIXME(ben): MT is not cryptographically safe.
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "util/bdthreads.h"
|
#include "util/bdthreads.h"
|
||||||
|
|
||||||
@ -68,4 +71,4 @@ class bdRandom
|
|||||||
static std::vector<uint32_t> MT ;
|
static std::vector<uint32_t> MT ;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -19,8 +19,6 @@
|
|||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static const time_t UPLOAD_CHUNK_MAPS_TIME = 20 ; // time to ask for a new chunkmap from uploaders in seconds.
|
static const time_t UPLOAD_CHUNK_MAPS_TIME = 20 ; // time to ask for a new chunkmap from uploaders in seconds.
|
||||||
|
|
||||||
ftFileProvider::ftFileProvider(const std::string& path, uint64_t size, const std::string& hash)
|
ftFileProvider::ftFileProvider(const std::string& path, uint64_t size, const std::string& hash)
|
||||||
|
@ -316,6 +316,18 @@ mac {
|
|||||||
#INCLUDEPATH += . $${UPNPC_DIR} $${GPGME_DIR}/src $${GPG_ERROR_DIR}/src
|
#INCLUDEPATH += . $${UPNPC_DIR} $${GPGME_DIR}/src $${GPG_ERROR_DIR}/src
|
||||||
}
|
}
|
||||||
|
|
||||||
|
freebsd-* {
|
||||||
|
INCLUDEPATH *= /usr/local/include/gpgme
|
||||||
|
INCLUDEPATH *= /usr/local/include/glib-2.0
|
||||||
|
|
||||||
|
QMAKE_CXXFLAGS *= -Dfseeko64=fseeko -Dftello64=ftello -Dstat64=stat -Dstatvfs64=statvfs -Dfopen64=fopen
|
||||||
|
|
||||||
|
#libupnp implementation files
|
||||||
|
HEADERS += upnp/UPnPBase.h
|
||||||
|
SOURCES += upnp/UPnPBase.cpp
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
################################### COMMON stuff ##################################
|
################################### COMMON stuff ##################################
|
||||||
|
|
||||||
HEADERS += dbase/cachestrapper.h \
|
HEADERS += dbase/cachestrapper.h \
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include "rsloginhandler.h"
|
#include "rsloginhandler.h"
|
||||||
#include "util/rsdir.h"
|
#include "util/rsdir.h"
|
||||||
|
|
||||||
#ifdef UBUNTU
|
#if defined(UBUNTU) || defined(__FreeBSD__)
|
||||||
#include <gnome-keyring-1/gnome-keyring.h>
|
#include <gnome-keyring-1/gnome-keyring.h>
|
||||||
|
|
||||||
GnomeKeyringPasswordSchema my_schema = {
|
GnomeKeyringPasswordSchema my_schema = {
|
||||||
@ -119,7 +119,7 @@ bool RsLoginHandler::tryAutoLogin(const std::string& ssl_id,std::string& ssl_pas
|
|||||||
|
|
||||||
/******************************** WINDOWS/UNIX SPECIFIC PART ******************/
|
/******************************** WINDOWS/UNIX SPECIFIC PART ******************/
|
||||||
#ifndef WINDOWS_SYS /* UNIX */
|
#ifndef WINDOWS_SYS /* UNIX */
|
||||||
#ifdef UBUNTU
|
#if defined(UBUNTU) || defined(__FreeBSD__)
|
||||||
|
|
||||||
gchar *passwd = NULL;
|
gchar *passwd = NULL;
|
||||||
|
|
||||||
@ -196,7 +196,7 @@ bool RsLoginHandler::tryAutoLogin(const std::string& ssl_id,std::string& ssl_pas
|
|||||||
/******************** OSX KeyChain stuff *****************************/
|
/******************** OSX KeyChain stuff *****************************/
|
||||||
#else /* UNIX, but not UBUNTU or APPLE */
|
#else /* UNIX, but not UBUNTU or APPLE */
|
||||||
|
|
||||||
FILE* helpFile = RsDirUtil::rs_fopen(getAutologinFileName.c_str(), "r");
|
FILE* helpFile = RsDirUtil::rs_fopen(getAutologinFileName(ssl_id).c_str(), "r");
|
||||||
|
|
||||||
if(helpFile == NULL){
|
if(helpFile == NULL){
|
||||||
std::cerr << "\nFailed to open help file\n" << std::endl;
|
std::cerr << "\nFailed to open help file\n" << std::endl;
|
||||||
@ -361,7 +361,7 @@ bool RsLoginHandler::enableAutoLogin(const std::string& ssl_id,const std::string
|
|||||||
|
|
||||||
/******************************** WINDOWS/UNIX SPECIFIC PART ******************/
|
/******************************** WINDOWS/UNIX SPECIFIC PART ******************/
|
||||||
#ifndef WINDOWS_SYS /* UNIX */
|
#ifndef WINDOWS_SYS /* UNIX */
|
||||||
#ifdef UBUNTU
|
#if defined(UBUNTU) || defined(__FreeBSD__)
|
||||||
if(GNOME_KEYRING_RESULT_OK == gnome_keyring_store_password_sync(&my_schema, NULL, (gchar*)("RetroShare password for SSL Id "+ssl_id).c_str(),(gchar*)ssl_passwd.c_str(),"RetroShare SSL Id",ssl_id.c_str(),NULL))
|
if(GNOME_KEYRING_RESULT_OK == gnome_keyring_store_password_sync(&my_schema, NULL, (gchar*)("RetroShare password for SSL Id "+ssl_id).c_str(),(gchar*)ssl_passwd.c_str(),"RetroShare SSL Id",ssl_id.c_str(),NULL))
|
||||||
{
|
{
|
||||||
std::cerr << "Stored passwd " << "************************" << " into gnome keyring" << std::endl;
|
std::cerr << "Stored passwd " << "************************" << " into gnome keyring" << std::endl;
|
||||||
|
@ -12,6 +12,9 @@ static bool auto_seed = RSRandom::seed( (time(NULL) + ((uint32_t) pthread_self()
|
|||||||
#else
|
#else
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
static bool auto_seed = RSRandom::seed( (time(NULL) + pthread_mach_thread_np(pthread_self())*0x1293fe + (getpid()^0x113ef76b))^0x18e34a12 ) ;
|
static bool auto_seed = RSRandom::seed( (time(NULL) + pthread_mach_thread_np(pthread_self())*0x1293fe + (getpid()^0x113ef76b))^0x18e34a12 ) ;
|
||||||
|
#elif defined(__FreeBSD__)
|
||||||
|
// since this is completely insecure anyway, just kludge for now
|
||||||
|
static bool auto_seed = RSRandom::seed(time(NULL));
|
||||||
#else
|
#else
|
||||||
static bool auto_seed = RSRandom::seed( (time(NULL) + pthread_self()*0x1293fe + (getpid()^0x113ef76b))^0x18e34a12 ) ;
|
static bool auto_seed = RSRandom::seed( (time(NULL) + pthread_self()*0x1293fe + (getpid()^0x113ef76b))^0x18e34a12 ) ;
|
||||||
#endif
|
#endif
|
||||||
|
@ -25,7 +25,8 @@
|
|||||||
// - thread safe
|
// - thread safe
|
||||||
// - system independant
|
// - system independant
|
||||||
// - fast
|
// - fast
|
||||||
// - cryptographically safe
|
// - NOT CRYPTOGRAPHICALLY SAFE
|
||||||
|
// - DO NOT USE FOR ANYTHING REQUIRING STRONG RANDOMNESS
|
||||||
//
|
//
|
||||||
// The implementation is adapted from the Mersenne Twister page of Wikipedia.
|
// The implementation is adapted from the Mersenne Twister page of Wikipedia.
|
||||||
//
|
//
|
||||||
|
@ -146,6 +146,15 @@ macx {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
freebsd-* {
|
||||||
|
INCLUDEPATH *= /usr/local/include/gpgme
|
||||||
|
LIBS *= ../../libretroshare/src/libretroshare.a
|
||||||
|
LIBS *= -lssl
|
||||||
|
LIBS *= -lgpgme
|
||||||
|
LIBS *= -lupnp
|
||||||
|
LIBS *= -lgnome-keyring
|
||||||
|
}
|
||||||
|
|
||||||
############################## Common stuff ######################################
|
############################## Common stuff ######################################
|
||||||
|
|
||||||
# On Linux systems that alredy have libssl and libcrypto it is advisable
|
# On Linux systems that alredy have libssl and libcrypto it is advisable
|
||||||
@ -156,6 +165,10 @@ macx {
|
|||||||
bitdht {
|
bitdht {
|
||||||
LIBS += ../../libbitdht/src/lib/libbitdht.a
|
LIBS += ../../libbitdht/src/lib/libbitdht.a
|
||||||
PRE_TARGETDEPS *= ../../libbitdht/src/lib/libbitdht.a
|
PRE_TARGETDEPS *= ../../libbitdht/src/lib/libbitdht.a
|
||||||
|
|
||||||
|
#For FreeBSD to need to use these ones.
|
||||||
|
#LIBS += ../../libbitdht/src/libbitdht.a
|
||||||
|
#PRE_TARGETDEPS *= ../../libbitdht/src/libbitdht.a
|
||||||
}
|
}
|
||||||
|
|
||||||
win32 {
|
win32 {
|
||||||
|
@ -653,8 +653,6 @@ void DhtWindow::updateRelays()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/****************************/
|
/****************************/
|
||||||
|
|
||||||
|
|
||||||
@ -666,6 +664,25 @@ void DhtWindow::updateRelays()
|
|||||||
#define DTW_COL_SEND 5
|
#define DTW_COL_SEND 5
|
||||||
#define DTW_COL_RECV 6
|
#define DTW_COL_RECV 6
|
||||||
|
|
||||||
|
class DhtTreeWidgetItem : public QTreeWidgetItem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual bool operator<(const QTreeWidgetItem &other) const
|
||||||
|
{
|
||||||
|
int column = treeWidget()->sortColumn();
|
||||||
|
if (column == DTW_COL_RECV || column == DTW_COL_SEND
|
||||||
|
|| column == DTW_COL_BUCKET)
|
||||||
|
{
|
||||||
|
QString t1 = text(column);
|
||||||
|
QString t2 = other.text(column);
|
||||||
|
t1 = t1.left(t1.indexOf(' '));
|
||||||
|
t2 = t2.left(t2.indexOf(' '));
|
||||||
|
return t1.toLong() < t2.toLong();
|
||||||
|
}
|
||||||
|
return text(column) < other.text(column);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
void DhtWindow::updateDhtPeers()
|
void DhtWindow::updateDhtPeers()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -698,7 +715,7 @@ void DhtWindow::updateDhtPeers()
|
|||||||
QTreeWidgetItem *dht_item = NULL;
|
QTreeWidgetItem *dht_item = NULL;
|
||||||
|
|
||||||
/* insert */
|
/* insert */
|
||||||
dht_item = new QTreeWidgetItem();
|
dht_item = new DhtTreeWidgetItem();
|
||||||
|
|
||||||
int dist = it->mBucket;
|
int dist = it->mBucket;
|
||||||
std::ostringstream buckstr;
|
std::ostringstream buckstr;
|
||||||
|
Loading…
Reference in New Issue
Block a user