Fix compile time warning.

In checkIncidentPermissions(), the intention of code is to bail out when
the caller do not have appropriate permission.

Logically, DEST_LOCAL and DEST_EXPLICIT should be checked separately.
In the current code, we would fall-through to DEST_EXPLICIT case, but
because permitted DEST_LOCAL callers (AID_SHELL and AID_ROOT) are also
permitted DEST_EXPLICIT callers, we will still get the Status:ok().

Test: build
Change-Id: I0f6121cb1aba7724306b99469f5ef97b4358ac7d
This commit is contained in:
Xin Li
2019-01-09 15:15:15 -08:00
parent dcfef16295
commit 3a039ff763

View File

@@ -82,6 +82,7 @@ static Status checkIncidentPermissions(const IncidentReportArgs& args) {
Status::EX_SECURITY,
"Calling process does not have permission to get local data.");
}
break;
case DEST_EXPLICIT:
if (callingUid != AID_SHELL && callingUid != AID_ROOT && callingUid != AID_STATSD &&
callingUid != AID_SYSTEM) {
@@ -91,6 +92,7 @@ static Status checkIncidentPermissions(const IncidentReportArgs& args) {
Status::EX_SECURITY,
"Calling process does not have permission to get explicit data.");
}
break;
}
return Status::ok();
}