aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--Rpmdrake/gui.pm2
-rw-r--r--rpmdrake.pm13
3 files changed, 13 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index 512d92ce..3e75e40c 100644
--- a/NEWS
+++ b/NEWS
@@ -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/_//; $_ } @_ }