Fix cross-user permission checks in print manager service.
The cross-user check was requesting both interact across users and interact across users all permissions which is too restrictive. Each one is sufficient. Further, if the app has one of these premissions but specifies a given user not current or current-self, the code was throwing while the correct actions is to return the requested user id as we alreay vetted the caller's permissions. bug:16398152 Change-Id: I1a4863eb7b05dababb66bac6e143b78dfad42b81
This commit is contained in:
committed by
Svetoslav Ganov
parent
57210c7a1a
commit
194db6ad91
@@ -734,7 +734,7 @@ public final class PrintManagerService extends SystemService {
|
||||
}
|
||||
if (mContext.checkCallingPermission(Manifest.permission.INTERACT_ACROSS_USERS_FULL)
|
||||
!= PackageManager.PERMISSION_GRANTED
|
||||
|| mContext.checkCallingPermission(Manifest.permission.INTERACT_ACROSS_USERS)
|
||||
&& mContext.checkCallingPermission(Manifest.permission.INTERACT_ACROSS_USERS)
|
||||
!= PackageManager.PERMISSION_GRANTED) {
|
||||
if (userId == UserHandle.USER_CURRENT_OR_SELF) {
|
||||
return callingUserId;
|
||||
@@ -746,8 +746,7 @@ public final class PrintManagerService extends SystemService {
|
||||
if (userId == UserHandle.USER_CURRENT || userId == UserHandle.USER_CURRENT_OR_SELF) {
|
||||
return mCurrentUserId;
|
||||
}
|
||||
throw new IllegalArgumentException("Calling user can be changed to only "
|
||||
+ "UserHandle.USER_CURRENT or UserHandle.USER_CURRENT_OR_SELF.");
|
||||
return userId;
|
||||
}
|
||||
|
||||
private String resolveCallingPackageNameEnforcingSecurity(String packageName) {
|
||||
|
||||
Reference in New Issue
Block a user