diff options
author | Arnaud Desmons <adesmons@mandriva.com> | 2002-09-20 13:44:31 +0000 |
---|---|---|
committer | Arnaud Desmons <adesmons@mandriva.com> | 2002-09-20 13:44:31 +0000 |
commit | 52e9e0a13a2c4ffdc01d0ffbbe04dc6fb553367a (patch) | |
tree | 2690d7cc2f610119502ece3bb0d7ee81235e3bfc /nfs_wizard/scripts/NFSConf.pm | |
parent | 3deedd8cfcb55bde89687dca84b3130f1439f62b (diff) | |
download | drakwizard-52e9e0a13a2c4ffdc01d0ffbbe04dc6fb553367a.tar drakwizard-52e9e0a13a2c4ffdc01d0ffbbe04dc6fb553367a.tar.gz drakwizard-52e9e0a13a2c4ffdc01d0ffbbe04dc6fb553367a.tar.bz2 drakwizard-52e9e0a13a2c4ffdc01d0ffbbe04dc6fb553367a.tar.xz drakwizard-52e9e0a13a2c4ffdc01d0ffbbe04dc6fb553367a.zip |
added chooser for access restriction
Diffstat (limited to 'nfs_wizard/scripts/NFSConf.pm')
-rw-r--r-- | nfs_wizard/scripts/NFSConf.pm | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/nfs_wizard/scripts/NFSConf.pm b/nfs_wizard/scripts/NFSConf.pm index 942380d9..673f571a 100644 --- a/nfs_wizard/scripts/NFSConf.pm +++ b/nfs_wizard/scripts/NFSConf.pm @@ -8,20 +8,42 @@ use strict; my $o = DrakconnectConf->new(); +sub network_mask { + my $wiz_ip_server = $o->get_from_known_dev("IP"); + my $mask = $o->get_from_known_dev("Mask"); + $mask = $mask ? $mask : "255.255.255.0"; + $wiz_ip_server = $wiz_ip_server ? $wiz_ip_server : "192.168.1.0"; + "$1.$2.$3.0/$mask" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; +} + +sub chooser { + if ($ENV{wiz_nfs_level} == 1) { + do_it(); + } + $ENV{wiz_nfs_level}; +} + sub do_it { + my $line; my $file = "/etc/exports"; - my $ip = "$1.$2.$3.0" if $o->get_from_known_dev("IP") =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; - my $mask = $o->get_from_known_dev("Mask"); - my $line = "$ENV{wiz_nfs_dir} $ip/$mask(rw,no_root_squash)\n"; + chomp($ENV{wiz_nfs_dir}); + -f $file and cp_af($file, $file.".orig"); + if ($ENV{wiz_nfs_level} == 2) { + my $mask = $o->get_from_known_dev("Mask"); + $line = "$ENV{wiz_nfs_dir} $ENV{wiz_netmask}(rw,no_root_squash)\n"; + } + else { + $line = "$ENV{wiz_nfs_dir} *(rw,no_root_squash)\n"; + } + print "$line\n"; my $t; - foreach (cat_($file)) { - if (/^\s*(?!\#)\s*\$ENV{wiz_nfs_dir}.*/) { + if (/.*(?!\#).*$ENV{wiz_nfs_dir}\s.*/) { $t = $_; last; } } - if ($t) { substInFile { s|$t|\#$&$line|} $file } - else { append_to_file($file, $line) } + if ($t) {substInFile { s|.*(?!\#).*$ENV{wiz_nfs_dir}\s.*|\#$&|} $file } + append_to_file($file, $line); system("/usr/sbin/exportfs -a") } |