summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsamba_wizard/Samba.pm47
1 files changed, 21 insertions, 26 deletions
diff --git a/samba_wizard/Samba.pm b/samba_wizard/Samba.pm
index 6aab7962..40c26629 100755
--- a/samba_wizard/Samba.pm
+++ b/samba_wizard/Samba.pm
@@ -109,7 +109,7 @@ $o->{pages} = {
next => 'ask_services'
},
ask_netmask => {
- name => N("Access control") . "\n\n" . N("* Example 1: allow all IPs in 150.203.*.*; except one\nhosts allow = 150.203. EXCEPT 150.203.6.66") . "\n\n" . N("* Example 2: allow hosts that match the given network/netmask\nhosts allow = 150.203.15.0/255.255.255.0") . "\n\n" . N("* Example 3: allow a couple of hosts\nhosts allow = lapland, arvidsjaur") . "\n\n" . N("* Example 4: allow only hosts in NIS netgroup "foonet", but deny access from one particular host\nhosts allow = @foonet\nhosts deny = pirate") . "\n\n" . N("Note that access still requires suitable user-level passwords."),
+ name => N("Access control") . "\n\n" . N("* Example 1: allow all IPs in 150.203.*.*; except one\nhosts allow = 150.203. EXCEPT 150.203.6.66") . "\n\n" . N("* Example 2: allow hosts that match the given network/netmask\nhosts allow = 150.203.15.0/255.255.255.0") . "\n\n" . N("* Example 3: allow a couple of hosts\nhosts allow = lapland, arvidsjaur") . "\n\n" . N("* Example 4: allow only hosts in NIS netgroup \"foonet\", but deny access from one particular host\nhosts allow = \@foonet\nhosts deny = pirate") . "\n\n" . N("Note that access still requires suitable user-level passwords."),
pre => sub {
$o->{var}{wiz_hosts_allow} ||= get_allow_host();
$o->{var}{wiz_hosts_allow} ||= get_deny_host()
@@ -159,15 +159,15 @@ $o->{pages} = {
next => 'ask_dir'
},
ask_access => {
- name => N("File permissions") . "\n\n" . N("Type users or group separated by a comma (groups must be preceded by a '@') like this :\nroot, fred, @users, @wheel for each kind of permission.") . "\n\n",
+ name => N("File permissions") . "\n\n" . N("Type users or group separated by a comma (groups must be preceded by a '\@') like this :\nroot, fred, \@users, \@wheel for each kind of permission.") . "\n\n",
pre => sub {
$o->{var}{wiz_read_list} ||= get_read();
$o->{var}{wiz_write_list} ||= get_write()
},
post => \&check_users,
data => [
- { label => N("read list:"), help => N("root, fred, @users, @wheel"), val => \$o->{var}{wiz_read_list} },
- { label => N("write list:"), help => N("root, fred, @users, @wheel"), val => \$o->{var}{wiz_write_list} },
+ { label => N("read list:"), help => N("root, fred, \@users, \@wheel"), val => \$o->{var}{wiz_read_list} },
+ { label => N("write list:"), help => N("root, fred, \@users, \@wheel"), val => \$o->{var}{wiz_write_list} },
],
next => 'ask_printers'
},
@@ -233,7 +233,7 @@ sub new {
sub check {
$> and return 1;
- $wiz->{net}->is_dhcp() and return 2;
+ $wiz->{net}->is_dhcp and return 2;
0;
}
@@ -251,19 +251,17 @@ sub check_dir {
# for variables value is in value key and comment idem (no risque of conflict)
sub read_conf {
- my $self = {};
- my ($file) = @_;
- my $menu;
- my @tab;
- my %conf;
+ my $self = {};
+ my ($file) = @_;
+ my ($menu, @tab, %conf);
open(FH, $file) or die "$! ($file)";
while (<FH>) {
- if (/^(\s*\;?\s*)\[(.*)\].*/) {
+ if (/^(\s*;?\s*)\[(.*)\]/) {
$menu = $2;
$conf{$menu}{__comment} = $1;
}
- elsif (/^(?!\#)(\s*\;*\s*)(.*?)\s*=\s*(.*)\s*$/) {
+ elsif (/^(?!#)(\s*;*\s*)(.*?)\s*=\s*(.*)\s*$/) {
$conf{$menu}{$2}{value} = $3;
$conf{$menu}{$2}{comment} = $1;
}
@@ -277,17 +275,16 @@ sub read_conf {
# we parse @tab to check for values in the struct.
sub write_conf {
- my $self = shift;
- my ($file) = @_;
- my $menu;
+ my ($self, $file) = @_;
+ my $menu;
open(FH, "> $file") or die "$!";
foreach (@{$self->{tab}}) {
- if (/^\s*\;?\s*\[(.*)\].*/) {
+ if (/^\s*;?\s*\[(.*)\]/) {
$menu = $1;
print FH "$self->{conf}->{$menu}{__comment}\[$menu\]\n";
}
- elsif (/^(?!\#)\s*\;*\s*(.*?)\s*=/) {
+ elsif (/^(?!#)\s*;*\s*(.*?)\s*=/) {
print FH "$self->{conf}->{$menu}{$1}{comment}$1 = $self->{conf}->{$menu}{$1}{value}\n";
}
else {
@@ -298,8 +295,7 @@ sub write_conf {
#section has the name of the printer
sub add_printer {
- my $self = shift;
- my ($printer) = @_;
+ my ($self, $printer) = @_;
if (exists $self->{conf}{$printer}) {
$self->comment_menu($printer, " ");
@@ -319,7 +315,7 @@ sub list_printers {
my @list if 0;
return @list if @list;
- @list = sort grep /^(?!\#).+/, map {
+ @list = sort grep { /^(?!#).+/ } map {
my ($printer) = split(':', $_);
} cat_("/etc/printcap");
if (@list) {
@@ -335,10 +331,9 @@ sub check_users {
}
sub comment_menu {
- my $self = shift;
- my ($menu, $str) = @_;
+ my ($self, $menu, $str) = @_;
- return if (!$menu or !exists $self->{conf}->{$menu});
+ return if !$menu || !exists $self->{conf}->{$menu};
$self->{conf}{$menu}{__comment} = $str;
foreach (keys %{$self->{conf}->{$menu}}) {
($_ eq "__comment") and next;
@@ -386,7 +381,7 @@ sub get_printers {
for (my $i; $i < @{$o->{var}{wiz_box_list}}; $i++) {
$string .= "$o->{var}{list_printers}[$i]\n" if $o->{var}{wiz_box_list}[$i]
}
- "$string";
+ $string;
}
else {
"disabled";
@@ -431,12 +426,12 @@ sub get_dir {
}
sub get_file_sharing {
- return 0 if ($old->{conf}->{public}{__comment} =~ /\;|\#/);
+ return 0 if ($old->{conf}->{public}{__comment} =~ /;|#/);
1;
}
sub get_home_sharing {
- return 0 if ($old->{conf}->{homes}{__comment} =~ /\;|\#/);
+ return 0 if ($old->{conf}->{homes}{__comment} =~ /;|#/);
1;
}