aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--AdminPanel/LogViewer/init.pm31
-rw-r--r--AdminPanel/Rpmdragora/init.pm7
-rwxr-xr-xmodules/logviewer/logviewer.pl6
3 files changed, 41 insertions, 3 deletions
diff --git a/AdminPanel/LogViewer/init.pm b/AdminPanel/LogViewer/init.pm
new file mode 100644
index 00000000..1c961712
--- /dev/null
+++ b/AdminPanel/LogViewer/init.pm
@@ -0,0 +1,31 @@
+package AdminPanel::LogViewer::init;
+
+use strict;
+use warnings;
+use diagnostics;
+use English;
+use lib qw(/usr/lib/libDrakX);
+use common;
+use AdminPanel::Shared;
+use base qw(Exporter);
+
+our @EXPORT = qw(warn_about_user_mode
+ interactive_msg);
+
+sub interactive_msg {
+ my ($title, $contents) = @_;
+ return ask_YesOrNo($title, $contents);
+}
+
+sub warn_about_user_mode() {
+ my $title = N("Running in user mode");
+ my $msg = N("You are launching this program as a normal user.\n".
+ "You will not be able to read system logs which you do not have rights to,\n".
+ "but you may still browse all the others.");
+ if(($EUID != 0) and (!interactive_msg($title, $msg))) {
+ return 0;
+ }
+ return 1;
+}
+
+1;
diff --git a/AdminPanel/Rpmdragora/init.pm b/AdminPanel/Rpmdragora/init.pm
index 776ee4c0..34581bf2 100644
--- a/AdminPanel/Rpmdragora/init.pm
+++ b/AdminPanel/Rpmdragora/init.pm
@@ -157,9 +157,10 @@ $changelog_first = 1 if $rpmdragora_options{'changelog-first'};
sub warn_about_user_mode() {
my $title = N("Running in user mode");
- my $msg = N("You are launching this program as a normal user.
- You will not be able to perform modifications on the system,
- but you may still browse the existing database.");
+ my $msg = N("You are launching this program as a normal user.\n".
+ "You will not be able to perform modifications on the system,\n".
+ "but you may still browse the existing database.");
+
if(($EUID != 0) and (!AdminPanel::rpmdragora::interactive_msg($title, $msg))) {
return 0;
}
diff --git a/modules/logviewer/logviewer.pl b/modules/logviewer/logviewer.pl
index c0c0e705..79acc7ad 100755
--- a/modules/logviewer/logviewer.pl
+++ b/modules/logviewer/logviewer.pl
@@ -33,6 +33,7 @@ use yui;
#use AdminPanel::Privileges;
use AdminPanel::Shared;
+use AdminPanel::LogViewer::init;
### TODO icon
my $wm_icon = "/usr/share/mcc/themes/default/logdrake-mdk.png";
@@ -71,6 +72,11 @@ my $optFactory = yui::YUI::optionalWidgetFactory;
### MAIN DIALOG ###
my $my_win = $factory->createMainDialog;
+if(!warn_about_user_mode()) {
+ quit();
+ exit(0);
+}
+
my %files = (
"auth" => { file => "/var/log/auth.log", desc => N("_:this is the auth.log log file\nAuthentication") },