git.stg.codes
/
stg.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Handlers moved to separate file and added to compilation
[stg.git]
/
projects
/
stargazer
/
plugins
/
configuration
/
sgconfig
/
rsconf.cpp
diff --git
a/projects/stargazer/plugins/configuration/sgconfig/rsconf.cpp
b/projects/stargazer/plugins/configuration/sgconfig/rsconf.cpp
index 520aebf7cd1bfe81726b7c0896aea5e61a0bd4e4..479a135703f24edbdaff610732da870e5393e299 100644
(file)
--- a/
projects/stargazer/plugins/configuration/sgconfig/rsconf.cpp
+++ b/
projects/stargazer/plugins/configuration/sgconfig/rsconf.cpp
@@
-26,11
+26,19
@@
*
*******************************************************************/
*
*******************************************************************/
+#include <unistd.h> // cloase, usleep
+
#include <cerrno>
#include <csignal>
#include <cerrno>
#include <csignal>
+#include <cstdio> // snprintf
+#include "stg/blowfish.h"
#include "configproto.h"
#include "configproto.h"
-#include "blowfish.h"
+
+#ifndef ENODATA
+// FreeBSD 4.* - suxx
+#define ENODATA -1
+#endif
enum CONF_STATE
{
enum CONF_STATE
{
@@
-332,7
+340,7
@@
if (admins->FindAdmin(login, &currAdmin))
state = confHdr;
return ENODATA;
}
state = confHdr;
return ENODATA;
}
-currAdmin
.SetAdmin
IP(adminIP);
+currAdmin
->Set
IP(adminIP);
adminLogin = login;
state = confLoginCipher;
return 0;
adminLogin = login;
state = confLoginCipher;
return 0;
@@
-377,13
+385,13
@@
while (total < ADM_LOGIN_LEN)
total += ret;
}
total += ret;
}
-if (currAdmin
.
GetLogin() == "")
+if (currAdmin
->
GetLogin() == "")
{
state = confHdr;
return ENODATA;
}
{
state = confHdr;
return ENODATA;
}
-EnDecodeInit(currAdmin
.
GetPassword().c_str(), ADM_PASSWD_LEN, &ctx);
+EnDecodeInit(currAdmin
->
GetPassword().c_str(), ADM_PASSWD_LEN, &ctx);
for (int i = 0; i < ADM_LOGIN_LEN/8; i++)
{
for (int i = 0; i < ADM_LOGIN_LEN/8; i++)
{
@@
-397,7
+405,7
@@
if (currAdmin == admins->GetNoAdmin())
return 0;
}
return 0;
}
-if (strncmp(currAdmin
.
GetLogin().c_str(), login, ADM_LOGIN_LEN) != 0)
+if (strncmp(currAdmin
->
GetLogin().c_str(), login, ADM_LOGIN_LEN) != 0)
{
state = confHdr;
return ENODATA;
{
state = confHdr;
return ENODATA;
@@
-443,7
+451,7
@@
buffer[8] = 0;
requestList.clear();
BLOWFISH_CTX ctx;
requestList.clear();
BLOWFISH_CTX ctx;
-EnDecodeInit(currAdmin
.
GetPassword().c_str(), ADM_PASSWD_LEN, &ctx);
+EnDecodeInit(currAdmin
->
GetPassword().c_str(), ADM_PASSWD_LEN, &ctx);
while (1)
{
while (1)
{
@@
-500,7
+508,7
@@
int n = 0;
int k = 0;
int ret = 0;
int k = 0;
int ret = 0;
-EnDecodeInit(currAdmin
.
GetPassword().c_str(), ADM_PASSWD_LEN, &ctx);
+EnDecodeInit(currAdmin
->
GetPassword().c_str(), ADM_PASSWD_LEN, &ctx);
while (li != answerList.end())
{
while (li != answerList.end())
{
@@
-521,7
+529,7
@@
while (li != answerList.end())
}
}
k = 0;// new node
}
}
k = 0;// new node
-
li++
;
+
++li
;
}
if (answerList.empty()) {
}
if (answerList.empty()) {
@@
-540,7
+548,7
@@
void CONFIGPROTO::SendError(const char * text)
{
char s[255];
answerList.clear();
{
char s[255];
answerList.clear();
-s
printf(s
, "<Error value=\"%s\"/>", text);
+s
nprintf(s, 255
, "<Error value=\"%s\"/>", text);
answerList.push_back(s);
}
//-----------------------------------------------------------------------------
answerList.push_back(s);
}
//-----------------------------------------------------------------------------