X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/7c36dd290e65ef4ad773543ce2641e1c83c28600..3305ea8a5e1e692032a8e1e07ccc860b550c336a:/projects/stargazer/plugins/configuration/sgconfig/rsconf.cpp?ds=sidebyside diff --git a/projects/stargazer/plugins/configuration/sgconfig/rsconf.cpp b/projects/stargazer/plugins/configuration/sgconfig/rsconf.cpp index 8d2ce153..479a1357 100644 --- a/projects/stargazer/plugins/configuration/sgconfig/rsconf.cpp +++ b/projects/stargazer/plugins/configuration/sgconfig/rsconf.cpp @@ -26,11 +26,14 @@ * *******************************************************************/ +#include // cloase, usleep + #include #include +#include // snprintf +#include "stg/blowfish.h" #include "configproto.h" -#include "blowfish.h" #ifndef ENODATA // FreeBSD 4.* - suxx @@ -337,7 +340,7 @@ if (admins->FindAdmin(login, &currAdmin)) state = confHdr; return ENODATA; } -currAdmin.SetAdminIP(adminIP); +currAdmin->SetIP(adminIP); adminLogin = login; state = confLoginCipher; return 0; @@ -382,13 +385,13 @@ while (total < ADM_LOGIN_LEN) 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++) { @@ -402,7 +405,7 @@ if (currAdmin == admins->GetNoAdmin()) 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; @@ -448,7 +451,7 @@ buffer[8] = 0; 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) { @@ -505,7 +508,7 @@ int n = 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()) { @@ -526,7 +529,7 @@ while (li != answerList.end()) } } k = 0;// new node - li++; + ++li; } if (answerList.empty()) { @@ -545,7 +548,7 @@ void CONFIGPROTO::SendError(const char * text) { char s[255]; answerList.clear(); -sprintf(s, "", text); +snprintf(s, 255, "", text); answerList.push_back(s); } //-----------------------------------------------------------------------------