manager: Add the ability to get a list of active managers
This commit is contained in:
@@ -139,6 +139,10 @@ int ksu_get_manager_signature_index(uid_t uid)
|
||||
int signature_index = -1;
|
||||
int i;
|
||||
|
||||
if (ksu_manager_uid != KSU_INVALID_UID && uid == ksu_manager_uid) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!is_dynamic_sign_enabled()) {
|
||||
return -1;
|
||||
}
|
||||
@@ -156,6 +160,7 @@ int ksu_get_manager_signature_index(uid_t uid)
|
||||
return signature_index;
|
||||
}
|
||||
|
||||
|
||||
static void clear_all_managers(void)
|
||||
{
|
||||
unsigned long flags;
|
||||
@@ -442,6 +447,40 @@ void ksu_dynamic_sign_exit(void)
|
||||
pr_info("Dynamic sign exited with persistent storage\n");
|
||||
}
|
||||
|
||||
// Get active managers for multi-manager APKs
|
||||
int ksu_get_active_managers(struct manager_list_info *info)
|
||||
{
|
||||
unsigned long flags;
|
||||
int i, count = 0;
|
||||
|
||||
if (!info) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (ksu_manager_uid != KSU_INVALID_UID && count < 2) {
|
||||
info->managers[count].uid = ksu_manager_uid;
|
||||
info->managers[count].signature_index = 1;
|
||||
count++;
|
||||
}
|
||||
|
||||
if (is_dynamic_sign_enabled()) {
|
||||
spin_lock_irqsave(&managers_lock, flags);
|
||||
|
||||
for (i = 0; i < MAX_MANAGERS && count < 2; i++) {
|
||||
if (active_managers[i].is_active) {
|
||||
info->managers[count].uid = active_managers[i].uid;
|
||||
info->managers[count].signature_index = active_managers[i].signature_index;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&managers_lock, flags);
|
||||
}
|
||||
|
||||
info->count = count;
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct sdesc {
|
||||
struct shash_desc shash;
|
||||
char ctx[];
|
||||
|
||||
Reference in New Issue
Block a user