Modernize database code (again)

This commit is contained in:
topjohnwu
2019-03-06 08:16:12 -05:00
parent 6597b7adc0
commit 370015a853
7 changed files with 141 additions and 181 deletions

View File

@@ -33,7 +33,7 @@ static inline const char *get_command(const struct su_request *to) {
static void silent_run(const char **args, struct su_info *info) {
char component[128];
sprintf(component, "%s/a.h", info->str[SU_MANAGER]);
sprintf(component, "%s/a.h", info->str[SU_MANAGER].data());
args[5] = component;
exec_t exec {
.pre_exec = []() -> void {

View File

@@ -23,9 +23,9 @@ public:
int count; /* Just a count for debugging purpose */
/* These values should be guarded with internal lock */
struct db_settings cfg;
struct db_strings str;
struct su_access access;
db_settings cfg;
db_strings str;
su_access access;
struct stat mgr_st;
/* These should be guarded with global cache lock */

View File

@@ -63,8 +63,8 @@ void su_info::deRef() {
static void database_check(su_info *info) {
int uid = info->uid;
get_db_settings(&info->cfg);
get_db_strings(&info->str);
get_db_settings(info->cfg);
get_db_strings(info->str);
// Check multiuser settings
switch (info->cfg[SU_MULTIUSER_MODE]) {
@@ -83,7 +83,7 @@ static void database_check(su_info *info) {
}
if (uid > 0)
get_uid_policy(uid, &info->access);
get_uid_policy(uid, info->access);
// We need to check our manager
if (info->access.log || info->access.notify)