summaryrefslogtreecommitdiffstats
path: root/perl-install/printer.pm
diff options
context:
space:
mode:
authorTill Kamppeter <tkamppeter@mandriva.com>2001-09-17 15:18:24 +0000
committerTill Kamppeter <tkamppeter@mandriva.com>2001-09-17 15:18:24 +0000
commitfd08f5da3ac309d5733dca24be6ab2ba57e6dcc3 (patch)
tree3b26b2418448904825b17571bfe1a64604e3fcbf /perl-install/printer.pm
parent5d84b8b96d48ecfb62c8d3b665b4cb6d1db8ea2f (diff)
downloaddrakx-backup-do-not-use-fd08f5da3ac309d5733dca24be6ab2ba57e6dcc3.tar
drakx-backup-do-not-use-fd08f5da3ac309d5733dca24be6ab2ba57e6dcc3.tar.gz
drakx-backup-do-not-use-fd08f5da3ac309d5733dca24be6ab2ba57e6dcc3.tar.bz2
drakx-backup-do-not-use-fd08f5da3ac309d5733dca24be6ab2ba57e6dcc3.tar.xz
drakx-backup-do-not-use-fd08f5da3ac309d5733dca24be6ab2ba57e6dcc3.zip
Added handling of high and paranoid security levels.
Diffstat (limited to 'perl-install/printer.pm')
-rw-r--r--perl-install/printer.pm62
1 files changed, 62 insertions, 0 deletions
diff --git a/perl-install/printer.pm b/perl-install/printer.pm
index 09391ee77..eb0122dc0 100644
--- a/perl-install/printer.pm
+++ b/perl-install/printer.pm
@@ -188,6 +188,68 @@ sub network_status {
return 1;
}
+sub get_security_level {
+ # Get security level by reading /etc/profile (only after install).
+ # This is a preliminary solution until msec puts the security level
+ # definition into the correct file.
+ $file = "/etc/profile";
+ if (-f $file) {
+ local *F;
+ open F, "< $file" || return 0;
+ while (<F>) {
+ if ($_ =~ /^\s*SECURE_LEVEL=([0-5])\s*$/) {
+ close F;
+ return $1;
+ }
+ }
+ close F;
+ }
+ return 0;
+}
+
+
+sub spooler_in_security_level {
+ # Was the current spooler already added to the current security level?
+ my ($spooler, $level) = @_;
+ my $sp;
+ if (($spooler eq "lpr") || ($spooler eq "lprng")) {
+ $sp = "lpd";
+ } else {
+ $sp = $spooler;
+ }
+ $file = "$prefix/etc/security/msec/server.$level";
+ if (-f $file) {
+ local *F;
+ open F, "< $file" || return 0;
+ while (<F>) {
+ if ($_ =~ /^\s*$sp\s*$/) {
+ close F;
+ return 1;
+ }
+ }
+ close F;
+ }
+ return 0;
+}
+
+sub add_spooler_to_security_level {
+ my ($spooler, $level) = @_;
+ my $sp;
+ if (($spooler eq "lpr") || ($spooler eq "lprng")) {
+ $sp = "lpd";
+ } else {
+ $sp = $spooler;
+ }
+ $file = "$prefix/etc/security/msec/server.$level";
+ if (-f $file) {
+ local *F;
+ open F, ">> $file" || return 0;
+ print F "$sp\n";
+ close F;
+ }
+ return 1;
+}
+
sub files_exist {
my @files = @_;
for (@files) {