From 178a5b2b34a1fb642740b51ae8b042b6e20a2231 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Lefebvre?= Date: Mon, 17 Aug 2009 12:49:43 +0000 Subject: - diskdrake : store credentials in davfs2 secret file before mounting --- perl-install/fs/remote/davfs.pm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'perl-install/fs/remote') diff --git a/perl-install/fs/remote/davfs.pm b/perl-install/fs/remote/davfs.pm index a35955827..8c2062c19 100644 --- a/perl-install/fs/remote/davfs.pm +++ b/perl-install/fs/remote/davfs.pm @@ -26,6 +26,22 @@ sub save_credentials { map { to_double_quoted($_->{mntpoint}, $_->{username}, $_->{password}, $_->{comment}) . "\n" } @$credentials); } +sub mountpoint_credentials_save { + my ($mntpoint, $mount_opt) = @_; + my @entries = read_credentials_raw(); + my $entry = find { $mntpoint eq $_->{mntpoint} } @entries; + die "mountpoint not found" if !$entry; + my %h; + foreach (@$mount_opt) { + my @var = split(/=/); + $h{$var[0]} = $var[1]; + } + foreach my $key qw(username password) { + $entry->{$key} = $h{$key}; + } + save_credentials(\@entries); +} + sub read_credentials_raw { from_double_quoted(cat_(secrets_file())); -- cgit v1.2.1