diff options
author | Nathan Kinder <nkinder@redhat.com> | 2009-01-12 16:26:14 +0000 |
---|---|---|
committer | Nathan Kinder <nkinder@redhat.com> | 2009-01-12 16:26:14 +0000 |
commit | c11820adf38ce4ffaeb216622eeabd60fa3bf6d2 (patch) | |
tree | 7d2d4304ede8853869e68558a0f67635db142e84 | |
parent | 7b6d01ea23b3c7968c3e1a6f45e76d39e6d123ca (diff) | |
download | ds-c11820adf38ce4ffaeb216622eeabd60fa3bf6d2.tar.gz ds-c11820adf38ce4ffaeb216622eeabd60fa3bf6d2.tar.xz ds-c11820adf38ce4ffaeb216622eeabd60fa3bf6d2.zip |
Resolves: 170461
Summary: Remove dependency on Term::ReadKey for password prompting in Perl scripts.
-rw-r--r-- | ldap/admin/src/scripts/template-bak2db.pl.in | 20 | ||||
-rw-r--r-- | ldap/admin/src/scripts/template-db2bak.pl.in | 20 | ||||
-rw-r--r-- | ldap/admin/src/scripts/template-db2index.pl.in | 20 | ||||
-rw-r--r-- | ldap/admin/src/scripts/template-db2ldif.pl.in | 22 | ||||
-rw-r--r-- | ldap/admin/src/scripts/template-fixup-memberof.pl.in | 20 | ||||
-rw-r--r-- | ldap/admin/src/scripts/template-ldif2db.pl.in | 20 | ||||
-rw-r--r-- | ldap/admin/src/scripts/template-ns-accountstatus.pl.in | 20 | ||||
-rw-r--r-- | ldap/admin/src/scripts/template-ns-activate.pl.in | 20 | ||||
-rw-r--r-- | ldap/admin/src/scripts/template-ns-inactivate.pl.in | 20 | ||||
-rw-r--r-- | ldap/admin/src/scripts/template-schema-reload.pl.in | 20 |
10 files changed, 91 insertions, 111 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); diff --git a/ldap/admin/src/scripts/template-db2bak.pl.in b/ldap/admin/src/scripts/template-db2bak.pl.in index 54ddf49a..fac526d2 100644 --- a/ldap/admin/src/scripts/template-db2bak.pl.in +++ b/ldap/admin/src/scripts/template-db2bak.pl.in @@ -88,17 +88,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); diff --git a/ldap/admin/src/scripts/template-db2index.pl.in b/ldap/admin/src/scripts/template-db2index.pl.in index 94d2bfa9..e993d881 100644 --- a/ldap/admin/src/scripts/template-db2index.pl.in +++ b/ldap/admin/src/scripts/template-db2index.pl.in @@ -127,17 +127,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 "" ) diff --git a/ldap/admin/src/scripts/template-db2ldif.pl.in b/ldap/admin/src/scripts/template-db2ldif.pl.in index 127c72fe..af5f0d7e 100644 --- a/ldap/admin/src/scripts/template-db2ldif.pl.in +++ b/ldap/admin/src/scripts/template-db2ldif.pl.in @@ -179,17 +179,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 (($instances[0] eq "" && $included[0] eq "") || $rootdn eq "" || $passwd eq "") { &usage; exit(1); } ($s, $m, $h, $dy, $mn, $yr, $wdy, $ydy, $r) = localtime(time); @@ -262,7 +260,7 @@ if ($verbose != 0) { $vstr = "-v"; } $ENV{'PATH'} = "$prefix@ldapsdk_bindir@:$prefix/usr/bin:@ldapsdk_bindir@:/usr/bin"; $ENV{'LD_LIBRARY_PATH'} = "$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@:/usr/lib"; $ENV{'SHLIB_PATH'} = "$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@:/usr/lib"; -print("Exported ldif file: ${ldiffile}\n"); +print("Exporting to ldif file: ${ldiffile}\n"); open(FOO, "| ldapmodify $vstr -h {{SERVER-NAME}} -p {{SERVER-PORT}} -D \"$rootdn\" -w \"$passwd\" -a" ); print(FOO "$entry"); close(FOO); diff --git a/ldap/admin/src/scripts/template-fixup-memberof.pl.in b/ldap/admin/src/scripts/template-fixup-memberof.pl.in index db866293..3f04d4a1 100644 --- a/ldap/admin/src/scripts/template-fixup-memberof.pl.in +++ b/ldap/admin/src/scripts/template-fixup-memberof.pl.in @@ -118,17 +118,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 "" || $basedn_arg eq "" ) diff --git a/ldap/admin/src/scripts/template-ldif2db.pl.in b/ldap/admin/src/scripts/template-ldif2db.pl.in index 15793e79..1d99123a 100644 --- a/ldap/admin/src/scripts/template-ldif2db.pl.in +++ b/ldap/admin/src/scripts/template-ldif2db.pl.in @@ -167,17 +167,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 (($instance eq "" && $included[0] eq "") || $ldiffiles[0] eq "" || $rootdn eq "" || $passwd eq "") { &usage; exit(1); } ($s, $m, $h, $dy, $mn, $yr, $wdy, $ydy, $r) = localtime(time); diff --git a/ldap/admin/src/scripts/template-ns-accountstatus.pl.in b/ldap/admin/src/scripts/template-ns-accountstatus.pl.in index d6e28d0b..258a6027 100644 --- a/ldap/admin/src/scripts/template-ns-accountstatus.pl.in +++ b/ldap/admin/src/scripts/template-ns-accountstatus.pl.in @@ -463,17 +463,15 @@ if ($pwfile ne ""){ close(RPASS); } elsif ($rootpw 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'); -# $rootpw = ReadLine(0); -# chomp($rootpw); -# ReadMode('normal'); + print "Bind Password: "; + # Disable console echo + system("stty -echo"); + # read the answer + $rootpw = <STDIN>; + # Enable console echo + system("stty echo"); + print "\n"; + chop($rootpw); # trim trailing newline } if( $rootpw eq "" ) diff --git a/ldap/admin/src/scripts/template-ns-activate.pl.in b/ldap/admin/src/scripts/template-ns-activate.pl.in index d6e28d0b..258a6027 100644 --- a/ldap/admin/src/scripts/template-ns-activate.pl.in +++ b/ldap/admin/src/scripts/template-ns-activate.pl.in @@ -463,17 +463,15 @@ if ($pwfile ne ""){ close(RPASS); } elsif ($rootpw 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'); -# $rootpw = ReadLine(0); -# chomp($rootpw); -# ReadMode('normal'); + print "Bind Password: "; + # Disable console echo + system("stty -echo"); + # read the answer + $rootpw = <STDIN>; + # Enable console echo + system("stty echo"); + print "\n"; + chop($rootpw); # trim trailing newline } if( $rootpw eq "" ) diff --git a/ldap/admin/src/scripts/template-ns-inactivate.pl.in b/ldap/admin/src/scripts/template-ns-inactivate.pl.in index d6e28d0b..258a6027 100644 --- a/ldap/admin/src/scripts/template-ns-inactivate.pl.in +++ b/ldap/admin/src/scripts/template-ns-inactivate.pl.in @@ -463,17 +463,15 @@ if ($pwfile ne ""){ close(RPASS); } elsif ($rootpw 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'); -# $rootpw = ReadLine(0); -# chomp($rootpw); -# ReadMode('normal'); + print "Bind Password: "; + # Disable console echo + system("stty -echo"); + # read the answer + $rootpw = <STDIN>; + # Enable console echo + system("stty echo"); + print "\n"; + chop($rootpw); # trim trailing newline } if( $rootpw eq "" ) diff --git a/ldap/admin/src/scripts/template-schema-reload.pl.in b/ldap/admin/src/scripts/template-schema-reload.pl.in index f9dc29d0..d4a510f0 100644 --- a/ldap/admin/src/scripts/template-schema-reload.pl.in +++ b/ldap/admin/src/scripts/template-schema-reload.pl.in @@ -108,17 +108,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 "" ) |