external/koush/Superuser
Revision | cd2f8cce8de56508afc0ae917d7094afec1dc6a8 (tree) |
---|---|
Time | 2018-02-02 11:14:23 |
Author | Chih-Wei Huang <cwhuang@linu...> |
Commiter | Chih-Wei Huang |
jni: correct the database path
It was moved to the device encrypted user data dir.
@@ -84,7 +84,7 @@ policy_t database_check(struct su_context *ctx) { | ||
84 | 84 | snprintf(query, sizeof(query), "select policy, until, command from uid_policy where uid=%d", ctx->from.uid); |
85 | 85 | int ret = sqlite3_open_v2(ctx->user.database_path, &db, SQLITE_OPEN_READONLY, NULL); |
86 | 86 | if (ret) { |
87 | - LOGE("sqlite3 open failure: %d", ret); | |
87 | + LOGE("sqlite3 open %s failure: %d", ctx->user.database_path, ret); | |
88 | 88 | sqlite3_close(db); |
89 | 89 | return INTERACTIVE; |
90 | 90 | } |
@@ -239,12 +239,10 @@ static void read_options(struct su_context *ctx) { | ||
239 | 239 | } |
240 | 240 | |
241 | 241 | static void user_init(struct su_context *ctx) { |
242 | - if (ctx->from.uid > 99999) { | |
242 | + if (ctx->user.multiuser_mode != MULTIUSER_MODE_NONE) { | |
243 | 243 | ctx->user.android_user_id = ctx->from.uid / 100000; |
244 | - if (ctx->user.multiuser_mode == MULTIUSER_MODE_USER) { | |
245 | - snprintf(ctx->user.database_path, PATH_MAX, "%s/%d/%s", REQUESTOR_USER_PATH, ctx->user.android_user_id, REQUESTOR_DATABASE_PATH); | |
246 | - snprintf(ctx->user.base_path, PATH_MAX, "%s/%d/%s", REQUESTOR_USER_PATH, ctx->user.android_user_id, REQUESTOR); | |
247 | - } | |
244 | + snprintf(ctx->user.database_path, PATH_MAX, "%s/%d/%s", REQUESTOR_USER_PATH, ctx->user.android_user_id, REQUESTOR_DATABASE_PATH); | |
245 | + snprintf(ctx->user.base_path, PATH_MAX, "%s/%d/%s", REQUESTOR_USER_PATH, ctx->user.android_user_id, REQUESTOR); | |
248 | 246 | } |
249 | 247 | } |
250 | 248 |
@@ -61,7 +61,7 @@ | ||
61 | 61 | #endif |
62 | 62 | #define REQUESTOR_DATA_PATH "/data/data/" |
63 | 63 | #define REQUESTOR_FILES_PATH REQUESTOR_DATA_PATH REQUESTOR "/files" |
64 | -#define REQUESTOR_USER_PATH "/data/user/" | |
64 | +#define REQUESTOR_USER_PATH "/data/user_de" | |
65 | 65 | #define REQUESTOR_CACHE_PATH "/dev/" REQUESTOR |
66 | 66 | #define REQUESTOR_DAEMON_PATH REQUESTOR_CACHE_PATH ".daemon" |
67 | 67 |