summaryrefslogtreecommitdiffstats
path: root/perl-install/fs/remote/davfs.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/fs/remote/davfs.pm')
-rw-r--r--perl-install/fs/remote/davfs.pm16
1 files changed, 8 insertions, 8 deletions
diff --git a/perl-install/fs/remote/davfs.pm b/perl-install/fs/remote/davfs.pm
index 5df0fe771..890530cb9 100644
--- a/perl-install/fs/remote/davfs.pm
+++ b/perl-install/fs/remote/davfs.pm
@@ -1,4 +1,4 @@
-package fs::remote::davfs; # $Id: smb.pm 231184 2007-10-24 14:36:29Z pixel $
+package fs::remote::davfs;
use strict;
use diagnostics;
@@ -6,7 +6,7 @@ use diagnostics;
use common;
use fs::mount_options;
-sub secrets_file { "$::prefix/etc/davfs2/secrets" }
+sub secrets_file() { "$::prefix/etc/davfs2/secrets" }
sub fstab_entry_to_credentials {
my ($part) = @_;
@@ -14,7 +14,7 @@ sub fstab_entry_to_credentials {
my ($options, $unknown) = fs::mount_options::unpack($part);
my %h = map { $_ => delete $options->{"$_="} } qw(username password);
foreach (qw(username password)) {
- $h{$_} = 'nobody' if !$h{$_};
+ $h{$_} ||= 'nobody';
}
$h{mntpoint} = $part->{mntpoint} or return;
fs::mount_options::pack_($part, $options, $unknown), \%h;
@@ -25,7 +25,7 @@ sub save_credentials {
@$credentials or return;
output_with_perm(secrets_file(), 0600,
- map { to_double_quoted($_->{mntpoint}, $_->{username}, $_->{password}, $_->{comment}) . "\n" } @$credentials);
+ map { to_double_quoted($_->{mntpoint}, $_->{username}, $_->{password}) . "\n" } @$credentials);
}
sub mountpoint_credentials_save {
@@ -45,7 +45,7 @@ sub mountpoint_credentials_save {
}
-sub read_credentials_raw {
+sub read_credentials_raw() {
from_double_quoted(cat_(secrets_file()));
}
@@ -66,12 +66,12 @@ sub from_double_quoted {
my ($file) = @_;
my @l;
my @lines = split("\n",$file);
- foreach (@lines){
+ foreach (@lines) {
my ($mnt, $user, $pass, $comment);
if (/^\s*(#.*)?$/) {
$comment = $1;
} else {
- if(/^(?:"((?:\\.|[^"])*)"|((?:\\.|[^"\s#])+))\s+(?:"((?:\\.|[^"])*)"|((?:\\.|[^"\s#])+))(?:\s+(?:"((?:\\.|[^"])*)"|((?:\\.|[^"\s#])+)))?(?:\s*|\s*(#.*))?$/) {
+ if (/^(?:"((?:\\.|[^"])*)"|((?:\\.|[^"\s#])+))\s+(?:"((?:\\.|[^"])*)"|((?:\\.|[^"\s#])+))(?:\s+(?:"((?:\\.|[^"])*)"|((?:\\.|[^"\s#])+)))?(?:\s*|\s*(#.*))?$/) {
$mnt = "$1$2";
$mnt =~ s/\\(.)/$1/g;
$user = "$3$4";
@@ -83,7 +83,7 @@ sub from_double_quoted {
die "bad entry $_";
}
}
- push @l, {'mntpoint'=>$mnt, 'username'=>$user, 'password'=>$pass, 'comment'=>$comment};
+ push @l, { 'mntpoint' => $mnt, 'username' => $user, 'password' => $pass, 'comment' => $comment };
}
@l;
}