Исходный код СУБД RuDB — свободной СУБД с открытым исходным кодом на базе PostgreSQL
rudb
2 days ago bd039d1e92813358c5c5a1e346b49074baf513f2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef DGRID_AUTH_H
#define DGRID_AUTH_H
 
#include <string>
#include <mutex>
 
namespace DGrid {
namespace SQL {
 
using SQL_result = std::vector<std::map<std::string, std::string> >;
 
bool openDBconnection();
void cleanupDBconnection();
 
std::string quote_string(std::string s);
bool exec_query(const std::string& query, SQL_result *result = nullptr);
bool read_user(const std::string& username, std::string& hash, std::string& salt);
bool save_user(const std::string username, const std::string& hash, const std::string& salt);
bool drop_user(const std::string username);
 
} // namespace SQL
 
std::string generate_salt();
std::string calc_passwd_hash(const std::string& user, const std::string& passwd, const std::string& salt);
bool checkUserPasswd(const std::string& user, const std::string& passwd, std::string& message);
DGridResult createUser(const std::string& user, const std::string& passwd, std::string& message);
DGridResult deleteUser(const std::string& user, std::string& message);
 
} // namespace DGrid
 
#endif // DGRID_SQL_H