summaryrefslogtreecommitdiffstats
path: root/ldap/admin/src/scripts/template-bak2db.pl.in
diff options
context:
space:
mode:
authorNathan Kinder <nkinder@redhat.com>2009-01-12 16:26:14 +0000
committerNathan Kinder <nkinder@redhat.com>2009-01-12 16:26:14 +0000
commitc11820adf38ce4ffaeb216622eeabd60fa3bf6d2 (patch)
tree7d2d4304ede8853869e68558a0f67635db142e84 /ldap/admin/src/scripts/template-bak2db.pl.in
parent7b6d01ea23b3c7968c3e1a6f45e76d39e6d123ca (diff)
Resolves: 170461
Summary: Remove dependency on Term::ReadKey for password prompting in Perl scripts.
Diffstat (limited to 'ldap/admin/src/scripts/template-bak2db.pl.in')
-rw-r--r--ldap/admin/src/scripts/template-bak2db.pl.in20
1 files changed, 9 insertions, 11 deletions
diff --git a/ldap/admin/src/scripts/template-bak2db.pl.in b/ldap/admin/src/scripts/template-bak2db.pl.in
index 9a3fd6bc..0d057e7d 100644
--- a/ldap/admin/src/scripts/template-bak2db.pl.in
+++ b/ldap/admin/src/scripts/template-bak2db.pl.in
@@ -91,17 +91,15 @@ if ($passwdfile ne ""){
close(RPASS);
} elsif ($passwd eq "-"){
# Read the password from terminal
- die "The '-w -' option requires an extension library (Term::ReadKey) which is not\n",
- "part of the standard perl distribution. If you want to use it, you must\n",
- "download and install the module. You can find it at\n",
- "http://www.perl.com/CPAN/CPAN.html\n";
-# Remove the previous line and uncomment the following 6 lines once you have installed Term::ReadKey module.
-# use Term::ReadKey;
-# print "Bind Password: ";
-# ReadMode('noecho');
-# $passwd = ReadLine(0);
-# chomp($passwd);
-# ReadMode('normal');
+ print "Bind Password: ";
+ # Disable console echo
+ system("stty -echo");
+ # read the answer
+ $passwd = <STDIN>;
+ # Enable console echo
+ system("stty echo");
+ print "\n";
+ chop($passwd); # trim trailing newline
}
if ( $rootdn eq "" || $passwd eq "") { &usage; exit(1); }
($s, $m, $h, $dy, $mn, $yr, $wdy, $ydy, $r) = localtime(time);