summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/fileshareset
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/standalone/fileshareset')
-rwxr-xr-xperl-install/standalone/fileshareset25
1 files changed, 12 insertions, 13 deletions
diff --git a/perl-install/standalone/fileshareset b/perl-install/standalone/fileshareset
index 3da214333..9223d6f29 100755
--- a/perl-install/standalone/fileshareset
+++ b/perl-install/standalone/fileshareset
@@ -11,8 +11,7 @@ my $authorisation_group = 'fileshare';
########################################
-# fileshare utility $Id$
-# Copyright (C) 2001-2008 Mandriva (pixel@mandriva.com)
+# Copyright (C) 2001-2008 Mandriva (pixel)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -54,7 +53,7 @@ qq(You are not authorised to use fileshare'ing
To grant you the rights:
- put "RESTRICT=no" in $authorisation_file
- or put user "$username" in group "$authorisation_group");
-my $no_export_method = "can not export anything: no nfs, no smb";
+my $no_export_method = "cannot export anything: no nfs, no smb";
my %exit_codes = reverse(
1 => $non_authorised,
@@ -93,7 +92,7 @@ my @exports = (
if ($modify) {
my ($cmd, $dir) = @ARGV;
$< = $>;
- @ARGV == 2 && ($cmd eq '--add' || $cmd eq '--remove') or error($usage);
+ @ARGV == 2 && (member($cmd, qw(--add --remove))) or error($usage);
verify_mntpoint($dir);
@@ -142,7 +141,7 @@ my $F_lock;
sub read_conf {
my ($exclusive_lock) = @_;
open $F_lock, $authorisation_file; # do not care if it's missing
- flock($F_lock, $exclusive_lock ? 2 : 1) or die "can not lock";
+ flock($F_lock, $exclusive_lock ? 2 : 1) or die "cannot lock";
my %conf;
foreach (<$F_lock>) {
s/#.*//; # remove comments
@@ -153,7 +152,7 @@ sub read_conf {
$conf{$cmd} = $value || warn qq(suspicious line "$_" in $authorisation_file\n);
}
# no close $F_lock, keep it locked
- \%conf
+ \%conf;
}
sub check {
@@ -170,7 +169,7 @@ sub check {
# ok, access granted for everybody
} else {
my @l;
- while (@l = getgrent) {
+ while (@l = getgrent()) {
last if $l[0] eq $authorisation_group;
}
::member($username, split(' ', $l[3])) or ::error($non_authorised);
@@ -180,7 +179,7 @@ sub check {
################################################################################
package exports;
-sub find {
+sub _find {
my ($exports, $mntpoint) = @_;
foreach (@$exports) {
$_->{mntpoint} eq $mntpoint and return $_;
@@ -190,7 +189,7 @@ sub find {
sub add {
my ($exports, $mntpoint) = @_;
- find($exports, $mntpoint) and die 'add';
+ _find($exports, $mntpoint) and die 'add';
push @$exports, my $e = { mntpoint => $mntpoint };
$e;
}
@@ -267,7 +266,7 @@ sub write {
$_->{raw} = sprintf("%s %s\n", $mntpoint, $_->{options});
}
}
- open(my $F, ">$conf_file") or die "can not write $conf_file";
+ open(my $F, ">$conf_file") or die "cannot write $conf_file";
print $F $_->{raw} foreach @$nfs_exports;
}
@@ -323,7 +322,7 @@ sub write {
EOF
}
}
- open(my $F, ">$conf_file") or die "can not write $conf_file";
+ open(my $F, ">$conf_file") or die "cannot write $conf_file";
print $F $_->{raw} foreach @$smb_exports;
}
@@ -380,8 +379,8 @@ sub name_mangle {
last A;
}
}
- $_ or die "can not find a unique name";
- # can not find a unique name, dropping the last letter
+ $_ or die "cannot find a unique name";
+ # cannot find a unique name, dropping the last letter
s|(.*).|$1|;
}
}