qubespolicy: implement --just-evaluate and --assume-yes-for-ask options
Those were registered in the parser, but ignored otherwise. The main (and only?) purpose of them is to evaluate policy when pasting some text between domains. Fixes QubesOS/qubes-issues#2985
This commit is contained in:
parent
5d0a2fe463
commit
b3c92c475a
@ -66,6 +66,14 @@ def main(args=None):
|
||||
try:
|
||||
policy = qubespolicy.Policy(args.service_name)
|
||||
action = policy.evaluate(system_info, args.domain, args.target)
|
||||
if args.assume_yes_for_ask and action.action == qubespolicy.Action.ask:
|
||||
action.action = qubespolicy.Action.allow
|
||||
if args.just_evaluate:
|
||||
return {
|
||||
qubespolicy.Action.allow: 0,
|
||||
qubespolicy.Action.deny: 1,
|
||||
qubespolicy.Action.ask: 1,
|
||||
}[action.action]
|
||||
if action.action == qubespolicy.Action.ask:
|
||||
# late import to save on time for allow/deny actions
|
||||
import pydbus
|
||||
|
Loading…
Reference in New Issue
Block a user