Fix bug in DB query wrapper
This commit is contained in:
parent
c9f390d6e0
commit
2ab999f4ca
@ -195,7 +195,7 @@ static int settings_cb(void *v, int col_num, char **data, char **col_name) {
|
||||
|
||||
int get_db_settings(db_settings *dbs, int key) {
|
||||
char *err;
|
||||
if (key > 0) {
|
||||
if (key >= 0) {
|
||||
char query[128];
|
||||
sprintf(query, "SELECT key, value FROM settings WHERE key='%s'", DB_SETTING_KEYS[key]);
|
||||
err = db_exec(query, settings_cb, dbs);
|
||||
@ -225,7 +225,7 @@ static int strings_cb(void *v, int col_num, char **data, char **col_name) {
|
||||
|
||||
int get_db_strings(db_strings *str, int key) {
|
||||
char *err;
|
||||
if (key > 0) {
|
||||
if (key >= 0) {
|
||||
char query[128];
|
||||
sprintf(query, "SELECT key, value FROM strings WHERE key='%s'", DB_STRING_KEYS[key]);
|
||||
err = db_exec(query, strings_cb, str);
|
||||
|
@ -136,8 +136,8 @@ struct su_access {
|
||||
********************/
|
||||
|
||||
sqlite3 *get_magiskdb(sqlite3 *&db);
|
||||
int get_db_settings(db_settings *dbs, int key);
|
||||
int get_db_strings(db_strings *str, int key);
|
||||
int get_db_settings(db_settings *dbs, int key = -1);
|
||||
int get_db_strings(db_strings *str, int key = -1);
|
||||
int get_uid_policy(int uid, struct su_access *su);
|
||||
int validate_manager(char *alt_pkg, int userid, struct stat *st);
|
||||
void exec_sql(int client);
|
||||
|
@ -60,8 +60,8 @@ static void *info_collector(void *node) {
|
||||
|
||||
static void database_check(su_info *info) {
|
||||
int uid = info->uid;
|
||||
get_db_settings(&info->cfg, 0);
|
||||
get_db_strings(&info->str, 0);
|
||||
get_db_settings(&info->cfg);
|
||||
get_db_strings(&info->str);
|
||||
|
||||
// Check multiuser settings
|
||||
switch (info->cfg[SU_MULTIUSER_MODE]) {
|
||||
|
Loading…
Reference in New Issue
Block a user