X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/9c1f9c3a596a5262dab9b6b56f3380b44275fd6c..6fc966f73c8a80580d47881a60ed38a132921e5b:/projects/stargazer/plugins/store/postgresql/postgresql_store_admins.cpp diff --git a/projects/stargazer/plugins/store/postgresql/postgresql_store_admins.cpp b/projects/stargazer/plugins/store/postgresql/postgresql_store_admins.cpp index d14f3a4d..1e9db12d 100644 --- a/projects/stargazer/plugins/store/postgresql/postgresql_store_admins.cpp +++ b/projects/stargazer/plugins/store/postgresql/postgresql_store_admins.cpp @@ -21,8 +21,8 @@ /* * Administrators manipulation methods * - * $Revision: 1.2 $ - * $Date: 2009/06/09 12:32:39 $ + * $Revision: 1.3 $ + * $Date: 2010/11/08 10:10:24 $ * */ @@ -32,10 +32,10 @@ #include +#include "stg/locker.h" +#include "stg/admin_conf.h" +#include "stg/blowfish.h" #include "postgresql_store.h" -#include "stg_locker.h" -#include "admin_conf.h" -#include "blowfish.h" #define adm_enc_passwd "cjeifY8m3" @@ -134,10 +134,10 @@ for (int i = 0; i < ADM_PASSWD_LEN / 8; i++) cryptedPass[ADM_PASSWD_LEN] = 0; Encode12(encodedPass, cryptedPass, ADM_PASSWD_LEN); -std::string password = encodedPass; +std::string pass = encodedPass; std::string login = ac.login; -if (EscapeString(password)) +if (EscapeString(pass)) { printfd(__FILE__, "POSTGRESQL_STORE::SaveAdmin(): 'Failed to escape password'\n"); if (RollbackTransaction()) @@ -159,7 +159,7 @@ if (EscapeString(login)) std::stringstream query; query << "UPDATE tb_admins SET " - << "passwd = '" << password << "', " + << "passwd = '" << pass << "', " << "chg_conf = " << ac.priv.userConf << ", " << "chg_password = " << ac.priv.userPasswd << ", " << "chg_stat = " << ac.priv.userStat << ", " @@ -195,7 +195,7 @@ return 0; } //----------------------------------------------------------------------------- -int POSTGRESQL_STORE::RestoreAdmin(ADMIN_CONF * ac, const string & login) const +int POSTGRESQL_STORE::RestoreAdmin(ADMIN_CONF * ac, const std::string & login) const { STG_LOCKER lock(&mutex, __FILE__, __LINE__); @@ -234,7 +234,7 @@ if (EscapeString(elogin)) return -1; } -std::stringstream query; +std::ostringstream query; query << "SELECT login, passwd, \ chg_conf, chg_password, chg_stat, \ chg_cash, usr_add_del, chg_tariff, \ @@ -316,7 +316,7 @@ ac->password = adminPass; return 0; } //----------------------------------------------------------------------------- -int POSTGRESQL_STORE::AddAdmin(const string & login) const +int POSTGRESQL_STORE::AddAdmin(const std::string & login) const { STG_LOCKER lock(&mutex, __FILE__, __LINE__); @@ -351,7 +351,7 @@ if (EscapeString(elogin)) return -1; } -std::stringstream query; +std::ostringstream query; query << "INSERT INTO tb_admins \ (login, passwd, \ chg_conf, chg_password, chg_stat, \ @@ -386,7 +386,7 @@ if (CommitTransaction()) return 0; } //----------------------------------------------------------------------------- -int POSTGRESQL_STORE::DelAdmin(const string & login) const +int POSTGRESQL_STORE::DelAdmin(const std::string & login) const { STG_LOCKER lock(&mutex, __FILE__, __LINE__); @@ -421,7 +421,7 @@ if (EscapeString(elogin)) return -1; } -std::stringstream query; +std::ostringstream query; query << "DELETE FROM tb_admins WHERE login = '" << elogin << "'"; result = PQexec(connection, query.str().c_str());