diff --git a/retroshare-nogui/src/menu/menu.cc b/retroshare-nogui/src/menu/menu.cc index 46852a4f3..39cdc1e9e 100644 --- a/retroshare-nogui/src/menu/menu.cc +++ b/retroshare-nogui/src/menu/menu.cc @@ -27,6 +27,7 @@ #include #include +#include #include "util/rsstring.h" diff --git a/retroshare-nogui/src/ssh/rssshd.cc b/retroshare-nogui/src/ssh/rssshd.cc index ff1ca5294..895cc318b 100644 --- a/retroshare-nogui/src/ssh/rssshd.cc +++ b/retroshare-nogui/src/ssh/rssshd.cc @@ -32,7 +32,7 @@ clients must be made or how a client should react. RsSshd *rsSshd = NULL; // External Reference Variable. // NB: This must be called EARLY before all the threads are launched. -RsSshd *RsSshd::InitRsSshd(std::string portStr, std::string rsakeyfile) +RsSshd *RsSshd::InitRsSshd(const std::string &portStr, const std::string &rsakeyfile) { #if LIBSSH_VERSION_INT >= SSH_VERSION_INT(0,5,0) ssh_threads_set_callbacks(ssh_threads_get_pthread()); @@ -58,13 +58,15 @@ RsSshd::RsSshd(std::string portStr) mBindState = 0; mRpcSystem = NULL; + mSession = NULL; + setSleepPeriods(0.01, 0.1); return; } -int RsSshd::init(std::string pathrsakey) +int RsSshd::init(const std::string &pathrsakey) { mBind=ssh_bind_new(); @@ -117,7 +119,11 @@ void RsSshd::run() } } cleanupSession(); +#ifndef WINDOWS_SYS sleep(5); // have a break; +#else + Sleep(5000); // have a break; +#endif } } @@ -628,7 +634,7 @@ int RsSshd::setSleepPeriods(float busy, float idle) /* PASSWORDS */ /***********************************************************************************/ -int RsSshd::auth_password(char *name, char *pwd) +int RsSshd::auth_password(const char *name, const char *pwd) { #ifdef ALLOW_CLEARPWDS if (auth_password_basic(name, pwd)) @@ -726,7 +732,7 @@ int RsSshd::adduserpwdhash(std::string username, std::string hash) } -int RsSshd::auth_password_hashed(char *name, char *pwd) +int RsSshd::auth_password_hashed(const char *name, const char *pwd) { std::string username(name); std::string password(pwd); diff --git a/retroshare-nogui/src/ssh/rssshd.h b/retroshare-nogui/src/ssh/rssshd.h index 07f289d2a..4033907c3 100644 --- a/retroshare-nogui/src/ssh/rssshd.h +++ b/retroshare-nogui/src/ssh/rssshd.h @@ -71,7 +71,7 @@ class RsSshd: public RsThread, public RpcComms public: // NB: This must be called EARLY before all the threads are launched. -static RsSshd *InitRsSshd(std::string portstr, std::string rsakeyfile); +static RsSshd *InitRsSshd(const std::string &portstr, const std::string &rsakeyfile); // Interface. @@ -101,7 +101,7 @@ int adduserpwdhash(std::string username, std::string hash); private: RsSshd(std::string portStr); /* private constructor => so can only create with */ -int init(std::string pathrsakey); +int init(const std::string &pathrsakey); // High level operations. int listenConnect(); @@ -122,8 +122,8 @@ int cleanupSession(); int cleanupAll(); /* Password Checking */ -int auth_password(char *name, char *pwd); -int auth_password_hashed(char *name, char *pwd); +int auth_password(const char *name, const char *pwd); +int auth_password_hashed(const char *name, const char *pwd); #ifdef ALLOW_CLEARPWDS int auth_password_basic(char *name, char *pwd); #endif // ALLOW_CLEARPWDS