[pve-devel] [PATCH v3 manager] pvesh: use the CLIHandler's read_password

Wolfgang Bumiller w.bumiller at proxmox.com
Tue Sep 26 14:01:04 CEST 2017


---
 bin/pvesh | 18 ++----------------
 1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/bin/pvesh b/bin/pvesh
index 936a849b..0becd4d7 100755
--- a/bin/pvesh
+++ b/bin/pvesh
@@ -17,6 +17,7 @@ use PVE::INotify;
 use PVE::RPCEnvironment;
 use PVE::API2Tools;
 use PVE::API2;
+use PVE::CLIHandler;
 use JSON;
 
 PVE::INotify::inotify_init();
@@ -184,22 +185,7 @@ sub abs_path {
 }
 
 my $read_password = sub {
-    my $attribs = $term->Attribs;
-    my $old = $attribs->{redisplay_function};
-    $attribs->{redisplay_function} = $attribs->{shadow_redisplay};
-    my $input = $term->readline('password: ');
-    my $conf = $term->readline('Retype new password: ');
-    $attribs->{redisplay_function} = $old;
-
-    # remove password from history
-    if ($term->Features->{autohistory}) {
-	my $historyPosition = $term->where_history();
-	$term->remove_history($historyPosition);
-	$term->remove_history($historyPosition - 1);
-    }
-
-    die "Passwords do not match.\n" if ($input ne $conf);
-    return $input;
+    return PVE::CLIHandler::read_password($term);
 };
 
 sub reverse_map_cmd {
-- 
2.11.0





More information about the pve-devel mailing list