+sub on_add_hook {
+ my ($class, $storeid, $scfg, %sensitive) = @_;
+
+ if (defined($sensitive{password})) {
+ cifs_set_credentials($sensitive{password}, $storeid);
+ if (!exists($scfg->{username})) {
+ warn "storage $storeid: ignoring password parameter, no user set\n";
+ }
+ } else {
+ cifs_delete_credentials($storeid);
+ }
+
+ return;
+}
+
+sub on_update_hook {
+ my ($class, $storeid, $scfg, %sensitive) = @_;
+
+ return if !exists($sensitive{password});
+
+ if (defined($sensitive{password})) {
+ cifs_set_credentials($sensitive{password}, $storeid);
+ if (!exists($scfg->{username})) {
+ warn "storage $storeid: ignoring password parameter, no user set\n";
+ }
+ } else {
+ cifs_delete_credentials($storeid);
+ }
+
+ return;
+}
+
+sub on_delete_hook {
+ my ($class, $storeid, $scfg) = @_;
+
+ cifs_delete_credentials($storeid);
+
+ return;
+}
+