Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 25ed46d0 authored by Oliver Scott's avatar Oliver Scott Committed by Michael Bestas
Browse files

Clear calling identity when setting restricted networking mode UID firewall rules

* NetworkManager setFirewallUidRule checks that the caller is system uid

* Public service entry points are already protected with MANAGE_NETWORK_POLICY permission so simply clear calling identity around NetworkPolicyManagerService setUidFirewallRule() call to resolve crash for secondary users during settings change.

Change-Id: I2fb22e77c0afa67acfbb5b9d57173df5aefb0d57
parent ae36a827
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -4198,8 +4198,13 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
        if (mRestrictedNetworkingMode) {
            // Note: setUidFirewallRule also updates mUidFirewallRestrictedModeRules.
            // In this case, default firewall rules can also be added.
            long token = Binder.clearCallingIdentity();
            try {
                setUidFirewallRule(FIREWALL_CHAIN_RESTRICTED, uid,
                        getRestrictedModeFirewallRule(newUidRule));
            } finally {
                Binder.restoreCallingIdentity(token);
            }
        }
    }