mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Fixed crash with uninitialized pointer RsSshd::mSession.
Fixed some compile errors on Windows. git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5693 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
d4bf742268
commit
02f8d27b6e
@ -27,6 +27,7 @@
|
||||
#include <retroshare/rsiface.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <time.h>
|
||||
|
||||
#include "util/rsstring.h"
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user