Force app version not lower than daemon

This commit is contained in:
vvb2060
2022-06-09 12:23:49 +08:00
committed by John Wu
parent a250e2b56c
commit b9c93c66f6
3 changed files with 18 additions and 4 deletions

View File

@@ -105,7 +105,7 @@ int get_manager(int user_id, string *pkg, bool install) {
int dyn = open(app_path, O_RDONLY | O_CLOEXEC);
if (dyn < 0)
return false;
bool mismatch = default_cert && read_certificate(dyn) != *default_cert;
bool mismatch = default_cert && read_certificate(dyn, true) != *default_cert;
close(dyn);
if (mismatch) {
LOGE("pkg: dyn APK signature mismatch: %s\n", app_path);
@@ -226,7 +226,7 @@ int get_manager(int user_id, string *pkg, bool install) {
#if ENFORCE_SIGNATURE
string apk = find_apk_path(JAVA_PACKAGE_NAME);
int fd = xopen(apk.data(), O_RDONLY | O_CLOEXEC);
string cert = read_certificate(fd);
string cert = read_certificate(fd, true);
close(fd);
if (default_cert && cert != *default_cert) {
// Found APK with invalid signature, force replace with stub