diff options
author | Thierry Vignaud <tv@mandriva.org> | 2008-10-06 19:37:22 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mandriva.org> | 2008-10-06 19:37:22 +0000 |
commit | 1edd490cf871b214aafeab61d1c91cf33ec0f995 (patch) | |
tree | aa20986528c884f8f383bf29282228a3dab677cb | |
parent | dd270712ddaeaff4f1a4afd9c3447824b8fc7317 (diff) | |
download | rpmdrake-1edd490cf871b214aafeab61d1c91cf33ec0f995.tar rpmdrake-1edd490cf871b214aafeab61d1c91cf33ec0f995.tar.gz rpmdrake-1edd490cf871b214aafeab61d1c91cf33ec0f995.tar.bz2 rpmdrake-1edd490cf871b214aafeab61d1c91cf33ec0f995.tar.xz rpmdrake-1edd490cf871b214aafeab61d1c91cf33ec0f995.zip |
(run_as_user) open help & bug report as user instead of as root (#44497)
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | Rpmdrake/gui.pm | 2 | ||||
-rw-r--r-- | rpmdrake.pm | 13 |
3 files changed, 13 insertions, 3 deletions
@@ -1,4 +1,5 @@ - do not ask sources on startup +- open help & bug report as user instead of as root (#44497) - edit_urpm_sources: o move "add media" menu entries from the "Options" menu into the "File" menu (#44601) diff --git a/Rpmdrake/gui.pm b/Rpmdrake/gui.pm index f65007f7..7c613326 100644 --- a/Rpmdrake/gui.pm +++ b/Rpmdrake/gui.pm @@ -914,7 +914,7 @@ sub sort_callback { sub run_help_callback { my (undef, $url) = @_; - run_program::raw({ detach => 1, setuid => get_parent_uid() }, 'www-browser', $url); + run_as_user('www-browser', $url); } 1; diff --git a/rpmdrake.pm b/rpmdrake.pm index aa3e6241..267f9cd4 100644 --- a/rpmdrake.pm +++ b/rpmdrake.pm @@ -937,17 +937,26 @@ sub add_distrib_update_media { ); } +sub run_as_user { + if (my $user = $ENV{USERHELPER_UID} && getpwuid($ENV{USERHELPER_UID})) { + run_program::raw({ detach => 1 }, 'su', $user, '-c', join(' ', @_)); + } else { + run_program::raw({ detach => 1 }, @_); + } +} + + sub open_help { my ($mode) = @_; use run_program; - run_program::raw({ detach => 1 }, 'drakhelp', '--id', $mode ? "software-management-$mode" : 'software-management'); + run_as_user('drakhelp', '--id', $mode ? "software-management-$mode" : 'software-management'); N("Help launched in background"); statusbar_msg(N("The help window has been started, it should appear shortly on your desktop."), 1); } sub run_drakbug { my ($id) = @_; - run_program::raw({ detach => 1 }, 'drakbug', '--report', $id); + run_as_user('drakbug', '--report', $id); } sub strip_first_underscore { join '', map { s/_//; $_ } @_ } |