X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/c3d4d096451b5c683492e81574b302e5486950e1..8e80bb9cec2c90dd61f810fb1525932a434288eb:/projects/stargazer/plugins/store/firebird/firebird_store_admins.cpp diff --git a/projects/stargazer/plugins/store/firebird/firebird_store_admins.cpp b/projects/stargazer/plugins/store/firebird/firebird_store_admins.cpp index ae0b9e6d..bb0bc0f4 100644 --- a/projects/stargazer/plugins/store/firebird/firebird_store_admins.cpp +++ b/projects/stargazer/plugins/store/firebird/firebird_store_admins.cpp @@ -26,26 +26,27 @@ * */ -#include -#include - -using namespace std; - #include "firebird_store.h" + #include "stg/ibpp.h" +#include "stg/admin_conf.h" #include "stg/blowfish.h" +#include "stg/common.h" + +#include +#include #define adm_enc_passwd "cjeifY8m3" //----------------------------------------------------------------------------- -int FIREBIRD_STORE::GetAdminsList(vector * adminsList) const +int FIREBIRD_STORE::GetAdminsList(std::vector * adminsList) const { STG_LOCKER lock(&mutex); IBPP::Transaction tr = IBPP::TransactionFactory(db, IBPP::amRead, til, tlr); IBPP::Statement st = IBPP::StatementFactory(db, tr); -string login; +std::string login; try { @@ -70,7 +71,7 @@ catch (IBPP::Exception & ex) return 0; } //----------------------------------------------------------------------------- -int FIREBIRD_STORE::SaveAdmin(const ADMIN_CONF & ac) const +int FIREBIRD_STORE::SaveAdmin(const STG::AdminConf & ac) const { STG_LOCKER lock(&mutex); @@ -84,10 +85,10 @@ BLOWFISH_CTX ctx; memset(cryptedPass, 0, ADM_PASSWD_LEN + 1); strncpy(adminPass, ac.password.c_str(), ADM_PASSWD_LEN); -EnDecodeInit(adm_enc_passwd, sizeof(adm_enc_passwd), &ctx); +InitContext(adm_enc_passwd, sizeof(adm_enc_passwd), &ctx); for (int i = 0; i < ADM_PASSWD_LEN / 8; i++) - EncodeString(cryptedPass + 8 * i, adminPass + 8 * i, &ctx); + EncryptBlock(cryptedPass + 8 * i, adminPass + 8 * i, &ctx); cryptedPass[ADM_PASSWD_LEN] = 0; Encode12(encodedPass, cryptedPass, ADM_PASSWD_LEN); @@ -128,7 +129,7 @@ catch (IBPP::Exception & ex) return 0; } //----------------------------------------------------------------------------- -int FIREBIRD_STORE::RestoreAdmin(ADMIN_CONF * ac, const string & login) const +int FIREBIRD_STORE::RestoreAdmin(STG::AdminConf * ac, const std::string & login) const { STG_LOCKER lock(&mutex); @@ -181,17 +182,17 @@ if (ac->password == "") } Decode21(cryptedPass, ac->password.c_str()); -EnDecodeInit(adm_enc_passwd, sizeof(adm_enc_passwd), &ctx); +InitContext(adm_enc_passwd, sizeof(adm_enc_passwd), &ctx); for (int i = 0; i < ADM_PASSWD_LEN / 8; i++) { - DecodeString(adminPass + 8 * i, cryptedPass + 8 * i, &ctx); + DecryptBlock(adminPass + 8 * i, cryptedPass + 8 * i, &ctx); } ac->password = adminPass; return 0; } //----------------------------------------------------------------------------- -int FIREBIRD_STORE::AddAdmin(const string & login) const +int FIREBIRD_STORE::AddAdmin(const std::string & login) const { STG_LOCKER lock(&mutex); @@ -229,7 +230,7 @@ catch (IBPP::Exception & ex) return 0; } //----------------------------------------------------------------------------- -int FIREBIRD_STORE::DelAdmin(const string & login) const +int FIREBIRD_STORE::DelAdmin(const std::string & login) const { STG_LOCKER lock(&mutex);