[pve-devel] [PATCH storage 03/11] Add helper function for extract CIFS credentials.
Wolfgang Link
w.link at proxmox.com
Tue Mar 13 15:11:03 CET 2018
---
PVE/API2/Storage/Config.pm | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/PVE/API2/Storage/Config.pm b/PVE/API2/Storage/Config.pm
index aa8c931..fa8d4de 100755
--- a/PVE/API2/Storage/Config.pm
+++ b/PVE/API2/Storage/Config.pm
@@ -12,6 +12,7 @@ use HTTP::Status qw(:constants);
use Storable qw(dclone);
use PVE::JSONSchema qw(get_standard_option);
use PVE::RPCEnvironment;
+use Term::ReadLine;
use PVE::RESTHandler;
@@ -36,6 +37,21 @@ my $api_storage_config = sub {
return $scfg;
};
+my $extract_cifs_credentials = sub {
+ my ($param) = @_;
+
+ my $password = extract_param($param, 'password');
+
+ if (!defined($password)) {
+ my $term = new Term::ReadLine ('pvesm');
+ my $attribs = $term->Attribs;
+ $attribs->{redisplay_function} = $attribs->{shadow_redisplay};
+ $password = $term->readline('Enter password: ');
+ }
+
+ return "password=$password\n";
+};
+
__PACKAGE__->register_method ({
name => 'index',
path => '',
--
2.11.0
More information about the pve-devel
mailing list