diff options
| author | Sylvain Pineau <sylvain.pineau@canonical.com> | 2014-12-03 12:32:35 +0100 |
|---|---|---|
| committer | Sylvain Pineau <sylvain.pineau@canonical.com> | 2014-12-03 12:32:35 +0100 |
| commit | 5a0a3631844ed4d2d354617bb1d7cdfd4d59d571 (patch) | |
| tree | 8f15c44046bb0c562559c999741e0ddb127e8700 /bin | |
| parent | dbc2a9411de52e75bf8f56e0021ed6b713e1716b (diff) | |
providers:checkbox:bin:pm_test: Ensure that ~/.config/autostart is not owned by root
pm_test has to be run by the root user, by using pkexec or sudo. Problem is that if ~/.config/autostart does not exists the script did make it without chown it back to the normal user. The fix just calls os.chown() on both .config and autostart with normal uid/gid Fixes: https://bugs.launchpad.net/plainbox-provider-checkbox/+bug/1382321
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/pm_test | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/bin/pm_test b/bin/pm_test index 18c0def8..e4b8fc04 100755 --- a/bin/pm_test +++ b/bin/pm_test @@ -617,6 +617,11 @@ Hidden=false autostart_directory = os.path.join(config_directory, 'autostart') if not os.path.exists(autostart_directory): os.makedirs(autostart_directory) + user_id = os.getenv('PKEXEC_UID') or os.getenv('SUDO_UID') + group_id = os.getenv('PKEXEC_UID') or os.getenv('SUDO_GID') + if user_id: + os.chown(config_directory, int(user_id), int(group_id)) + os.chown(autostart_directory, int(user_id), int(group_id)) basename = '{0}.desktop'.format(os.path.basename(__file__)) self.desktop_filename = os.path.join(autostart_directory, |
