*
*******************************************************************/
+#include <unistd.h> // cloase, usleep
+
#include <cerrno>
#include <csignal>
+#include <cstdio> // snprintf
#include "configproto.h"
#include "blowfish.h"
+#ifndef ENODATA
+// FreeBSD 4.* - suxx
+#define ENODATA -1
+#endif
+
enum CONF_STATE
{
confHdr,
state = confHdr;
return ENODATA;
}
-currAdmin.SetAdminIP(adminIP);
+currAdmin->SetIP(adminIP);
adminLogin = login;
state = confLoginCipher;
return 0;
total += ret;
}
-if (currAdmin.GetLogin() == "")
+if (currAdmin->GetLogin() == "")
{
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++)
{
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;
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)
{
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())
{
}
}
k = 0;// new node
- li++;
+ ++li;
}
if (answerList.empty()) {
{
char s[255];
answerList.clear();
-sprintf(s, "<Error value=\"%s\"/>", text);
+snprintf(s, 255, "<Error value=\"%s\"/>", text);
answerList.push_back(s);
}
//-----------------------------------------------------------------------------