diff options
author | Aurélien Lefebvre <alefebvre@mandriva.com> | 2009-08-17 12:49:43 +0000 |
---|---|---|
committer | Aurélien Lefebvre <alefebvre@mandriva.com> | 2009-08-17 12:49:43 +0000 |
commit | 178a5b2b34a1fb642740b51ae8b042b6e20a2231 (patch) | |
tree | f9eb7d42f36a8ac34e185f4235055771a8f58227 /perl-install | |
parent | 20b45a155458c3714496a1ffa6a87201140d76d5 (diff) | |
download | drakx-backup-do-not-use-178a5b2b34a1fb642740b51ae8b042b6e20a2231.tar drakx-backup-do-not-use-178a5b2b34a1fb642740b51ae8b042b6e20a2231.tar.gz drakx-backup-do-not-use-178a5b2b34a1fb642740b51ae8b042b6e20a2231.tar.bz2 drakx-backup-do-not-use-178a5b2b34a1fb642740b51ae8b042b6e20a2231.tar.xz drakx-backup-do-not-use-178a5b2b34a1fb642740b51ae8b042b6e20a2231.zip |
- diskdrake : store credentials in davfs2 secret file before mounting
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/NEWS | 1 | ||||
-rw-r--r-- | perl-install/fs/mount.pm | 3 | ||||
-rw-r--r-- | perl-install/fs/remote/davfs.pm | 16 |
3 files changed, 20 insertions, 0 deletions
diff --git a/perl-install/NEWS b/perl-install/NEWS index 0d1a0a7a5..e8ff46afe 100644 --- a/perl-install/NEWS +++ b/perl-install/NEWS @@ -1,5 +1,6 @@ - diskdrake o never pass username/password as options with davfs2 + o store credentials in davfs2 secret file before mounting - adduserdrake o now use password weakness display - added password weakness display feature in interactive diff --git a/perl-install/fs/mount.pm b/perl-install/fs/mount.pm index 3e2d36938..f7bea2ae4 100644 --- a/perl-install/fs/mount.pm +++ b/perl-install/fs/mount.pm @@ -73,6 +73,9 @@ sub mount { } elsif ($fs eq 'ext2' && !$b_rdonly) { fsck_ext2($dev, $o_wait_message); } elsif ($fs eq 'davfs2') { + require fs::remote::davfs; + # We have to store credentials in davfs2 secret file before mounting + fs::remote::davfs::mountpoint_credentials_save($where, \@mount_opt); # username and password options should be handled by /etc/davfs2/secrets file @mount_opt = grep { !/^(username|password)=/ } @mount_opt; } 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())); |