diff options
author | David Zeuthen <davidz@redhat.com> | 2012-05-24 11:26:34 -0400 |
---|---|---|
committer | David Zeuthen <davidz@redhat.com> | 2012-05-24 11:26:34 -0400 |
commit | be4c87252e8031c3427ca14ad036981f09fd6369 (patch) | |
tree | 54c5cad2694a7b5e5a2ee90bcbca3f8b9637f753 /test | |
parent | d11c872dc2f14fb4b1661740e311087aa188263d (diff) |
Terminate runaway scripts
Signed-off-by: David Zeuthen <davidz@redhat.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/data/etc/polkit-1/rules.d/10-testing.rules | 16 | ||||
-rw-r--r-- | test/polkitbackend/test-polkitbackendjsauthority.c | 7 |
2 files changed, 23 insertions, 0 deletions
diff --git a/test/data/etc/polkit-1/rules.d/10-testing.rules b/test/data/etc/polkit-1/rules.d/10-testing.rules index 4a35e48..1dba38a 100644 --- a/test/data/etc/polkit-1/rules.d/10-testing.rules +++ b/test/data/etc/polkit-1/rules.d/10-testing.rules @@ -134,3 +134,19 @@ polkit.addRule(function(action, subject, details) { } } }); + +polkit.addRule(function(action, subject, details) { + if (action == "net.company.run_away_script") { + try { + // The following code will never terminate so the runaway + // script killer will step in after 15 seconds and throw + // an exception... + while (true) + ; + } catch (error) { + if (error == "Terminating runaway script") + return "yes" + return "no"; + } + } +}); diff --git a/test/polkitbackend/test-polkitbackendjsauthority.c b/test/polkitbackend/test-polkitbackendjsauthority.c index 24e599e..728b433 100644 --- a/test/polkitbackend/test-polkitbackendjsauthority.c +++ b/test/polkitbackend/test-polkitbackendjsauthority.c @@ -278,6 +278,13 @@ static const RulesTestCase rules_test_cases[] = { NULL }, { + "runaway_script", + "net.company.run_away_script", + "unix-user:root", + POLKIT_IMPLICIT_AUTHORIZATION_AUTHORIZED, + NULL + }, + { "spawning_helper_timeout", "net.company.spawning.helper_timeout", "unix-user:root", |