cifs: use add/delete hooks

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht
2018-07-02 15:54:45 +02:00
committed by Wolfgang Bumiller
parent 3932ca0d1b
commit ab5e32bb1d
2 changed files with 18 additions and 10 deletions

View File

@ -141,6 +141,23 @@ sub check_config {
# Storage implementation
sub on_add_hook {
my ($class, $storeid, $scfg, %param) = @_;
if (my $password = $param{password}) {
cifs_set_credentials($password, $storeid);
}
}
sub on_delete_hook {
my ($class, $storeid, $scfg) = @_;
my $cred_file = cifs_cred_file_name($storeid);
if (-f $cred_file) {
unlink($cred_file) or warn "removing cifs credientials '$cred_file' failed: $!\n";
}
}
sub status {
my ($class, $storeid, $scfg, $cache) = @_;