瀏覽代碼

Bug 622907 - support piped passwords to perl-based maintenance commands

https://bugzilla.redhat.com/show_bug.cgi?id=622907
Resolves: bug 622907
Bug Description: support piped passwords to perl-based maintenance commands
Author: [email protected]
Reviewed by: rmeggins
Branch: master
Fix Description: Use -t STDIN to check if the terminal is a tty
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
Rich Megginson 14 年之前
父節點
當前提交
07d9cb2b67

+ 2 - 2
ldap/admin/src/scripts/template-bak2db.pl.in

@@ -93,11 +93,11 @@ if ($passwdfile ne ""){
 # Read the password from terminal
 	print "Bind Password: ";
 	# Disable console echo
-	system("stty -echo");
+	system("stty -echo") if -t STDIN;
 	# read the answer
 	$passwd = <STDIN>;
 	# Enable console echo
-	system("stty echo");
+	system("stty echo") if -t STDIN;
 	print "\n";
 	chop($passwd); # trim trailing newline
 }

+ 2 - 2
ldap/admin/src/scripts/template-db2bak.pl.in

@@ -90,11 +90,11 @@ if ($passwdfile ne ""){
 # Read the password from terminal
 	print "Bind Password: ";
 	# Disable console echo
-	system("stty -echo");
+	system("stty -echo") if -t STDIN;
 	# read the answer
 	$passwd = <STDIN>;
 	# Enable console echo
-	system("stty echo");
+	system("stty echo") if -t STDIN;
 	print "\n";
 	chop($passwd); # trim trailing newline
 }

+ 2 - 2
ldap/admin/src/scripts/template-db2index.pl.in

@@ -129,11 +129,11 @@ if ($passwdfile ne ""){
 # Read the password from terminal
 	print "Bind Password: ";
 	# Disable console echo
-	system("stty -echo");
+	system("stty -echo") if -t STDIN;
 	# read the answer
 	$passwd = <STDIN>;
 	# Enable console echo
-	system("stty echo");
+	system("stty echo") if -t STDIN;
 	print "\n";
 	chop($passwd); # trim trailing newline
 }

+ 2 - 2
ldap/admin/src/scripts/template-db2ldif.pl.in

@@ -181,11 +181,11 @@ if ($passwdfile ne ""){
 # Read the password from terminal
 	print "Bind Password: ";
 	# Disable console echo
-	system("stty -echo");
+	system("stty -echo") if -t STDIN;
 	# read the answer
 	$passwd = <STDIN>;
 	# Enable console echo
-	system("stty echo");
+	system("stty echo") if -t STDIN;
 	print "\n";
 	chop($passwd); # trim trailing newline
 }

+ 2 - 2
ldap/admin/src/scripts/template-fixup-linkedattrs.pl.in

@@ -111,11 +111,11 @@ if ($passwdfile ne ""){
 # Read the password from terminal
 	print "Bind Password: ";
 	# Disable console echo
-	system("stty -echo");
+	system("stty -echo") if -t STDIN;
 	# read the answer
 	$passwd = <STDIN>;
 	# Enable console echo
-	system("stty echo");
+	system("stty echo") if -t STDIN;
 	print "\n";
 	chop($passwd); # trim trailing newline
 }

+ 2 - 2
ldap/admin/src/scripts/template-fixup-memberof.pl.in

@@ -120,11 +120,11 @@ if ($passwdfile ne ""){
 # Read the password from terminal
 	print "Bind Password: ";
 	# Disable console echo
-	system("stty -echo");
+	system("stty -echo") if -t STDIN;
 	# read the answer
 	$passwd = <STDIN>;
 	# Enable console echo
-	system("stty echo");
+	system("stty echo") if -t STDIN;
 	print "\n";
 	chop($passwd); # trim trailing newline
 }

+ 2 - 2
ldap/admin/src/scripts/template-ldif2db.pl.in

@@ -169,11 +169,11 @@ if ($passwdfile ne ""){
 # Read the password from terminal
 	print "Bind Password: ";
 	# Disable console echo
-	system("stty -echo");
+	system("stty -echo") if -t STDIN;
 	# read the answer
 	$passwd = <STDIN>;
 	# Enable console echo
-	system("stty echo");
+	system("stty echo") if -t STDIN;
 	print "\n";
 	chop($passwd); # trim trailing newline
 }

+ 2 - 2
ldap/admin/src/scripts/template-ns-accountstatus.pl.in

@@ -465,11 +465,11 @@ if ($pwfile ne ""){
 # Read the password from terminal
 	print "Bind Password: ";
 	# Disable console echo
-	system("stty -echo");
+	system("stty -echo") if -t STDIN;
 	# read the answer
 	$rootpw = <STDIN>;
 	# Enable console echo
-	system("stty echo");
+	system("stty echo") if -t STDIN;
 	print "\n";
 	chop($rootpw); # trim trailing newline
 }

+ 2 - 2
ldap/admin/src/scripts/template-ns-activate.pl.in

@@ -465,11 +465,11 @@ if ($pwfile ne ""){
 # Read the password from terminal
 	print "Bind Password: ";
 	# Disable console echo
-	system("stty -echo");
+	system("stty -echo") if -t STDIN;
 	# read the answer
 	$rootpw = <STDIN>;
 	# Enable console echo
-	system("stty echo");
+	system("stty echo") if -t STDIN;
 	print "\n";
 	chop($rootpw); # trim trailing newline
 }

+ 2 - 2
ldap/admin/src/scripts/template-ns-inactivate.pl.in

@@ -465,11 +465,11 @@ if ($pwfile ne ""){
 # Read the password from terminal
 	print "Bind Password: ";
 	# Disable console echo
-	system("stty -echo");
+	system("stty -echo") if -t STDIN;
 	# read the answer
 	$rootpw = <STDIN>;
 	# Enable console echo
-	system("stty echo");
+	system("stty echo") if -t STDIN;
 	print "\n";
 	chop($rootpw); # trim trailing newline
 }

+ 2 - 2
ldap/admin/src/scripts/template-schema-reload.pl.in

@@ -110,11 +110,11 @@ if ($passwdfile ne ""){
 # Read the password from terminal
 	print "Bind Password: ";
 	# Disable console echo
-	system("stty -echo");
+	system("stty -echo") if -t STDIN;
 	# read the answer
 	$passwd = <STDIN>;
 	# Enable console echo
-	system("stty echo");
+	system("stty echo") if -t STDIN;
 	print "\n";
 	chop($passwd); # trim trailing newline
 }

+ 2 - 2
ldap/admin/src/scripts/template-syntax-validate.pl.in

@@ -120,11 +120,11 @@ if ($passwdfile ne ""){
 # Read the password from terminal
 	print "Bind Password: ";
 	# Disable console echo
-	system("stty -echo");
+	system("stty -echo") if -t STDIN;
 	# read the answer
 	$passwd = <STDIN>;
 	# Enable console echo
-	system("stty echo");
+	system("stty echo") if -t STDIN;
 	print "\n";
 	chop($passwd); # trim trailing newline
 }

+ 2 - 2
ldap/admin/src/scripts/template-usn-tombstone-cleanup.pl.in

@@ -124,11 +124,11 @@ if ($passwdfile ne ""){
 # Read the password from terminal
 	print "Bind Password: ";
 	# Disable console echo
-	system("stty -echo");
+	system("stty -echo") if -t STDIN;
 	# read the answer
 	$passwd = <STDIN>;
 	# Enable console echo
-	system("stty echo");
+	system("stty echo") if -t STDIN;
 	print "\n";
 	chop($passwd); # trim trailing newline
 }