Bug 170461
| Summary: | Command Line perl scripts need non-standard Term::ReadKey for -w - option | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Red Hat Directory Server | Reporter: | Orla Hegarty <ohegarty> | ||||
| Component: | Command Line Utilities | Assignee: | Nathan Kinder <nkinder> | ||||
| Status: | CLOSED CURRENTRELEASE | QA Contact: | Chandrasekar Kannan <ckannan> | ||||
| Severity: | medium | Docs Contact: | |||||
| Priority: | medium | ||||||
| Version: | 7.1 | CC: | benl, nhosoi, pgnet.trash, rmeggins, yzhang | ||||
| Target Milestone: | DS8.1 | ||||||
| Target Release: | --- | ||||||
| Hardware: | All | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | 8.1 | Doc Type: | Bug Fix | ||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2009-04-29 22:57:59 UTC | Type: | --- | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Bug Depends On: | |||||||
| Bug Blocks: | 152373, 249650, 493682 | ||||||
| Attachments: |
|
||||||
|
Description
Orla Hegarty
2005-10-11 22:34:03 UTC
The newer version of perl on all platform may be this already. That's a result of code in, apparently, a numbed of the utils ... e.g., in "ldif2db.pl" as well.
There's a hardcoded 'die' in the script, used if passwd == "-" (which is the prompt flag), that needs to be removed, and some lines that need to be uncommented.
It's an easy patch, e.g.:
--- /usr/lib64/dirsrv/slapd-auth/ldif2db.pl.ORIG 2008-09-11 07:56:50.000000000 -0700
+++ /usr/lib64/dirsrv/slapd-auth/ldif2db.pl 2008-09-11 07:57:47.000000000 -0700
@@ -167,17 +167,17 @@
close(RPASS);
} elsif ($passwd eq "-"){
# Read the password from terminal
- die "The '-w -' option requires an extension library (Term::ReadKey) which is not\n",
+# 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');
+ use Term::ReadKey;
+ print "Bind Password: ";
+ ReadMode('noecho');
+ $passwd = ReadLine(0);
+ chomp($passwd);
+ ReadMode('normal');
}
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);
Created attachment 328607 [details]
CVS Diffs
This patch removes the dependency on Term::ReadKey for password prompting in our Perl scripts and instead uses the same method that we use in the setup code for non-echoed password prompts.
Checked into ldapserver (HEAD). Thanks to Rich for his review! Checking in ldap/admin/src/scripts/template-bak2db.pl.in; /cvs/dirsec/ldapserver/ldap/admin/src/scripts/template-bak2db.pl.in,v <-- template-bak2db.pl.in new revision: 1.5; previous revision: 1.4 done Checking in ldap/admin/src/scripts/template-db2bak.pl.in; /cvs/dirsec/ldapserver/ldap/admin/src/scripts/template-db2bak.pl.in,v <-- template-db2bak.pl.in new revision: 1.8; previous revision: 1.7 done Checking in ldap/admin/src/scripts/template-db2index.pl.in; /cvs/dirsec/ldapserver/ldap/admin/src/scripts/template-db2index.pl.in,v <-- template-db2index.pl.in new revision: 1.6; previous revision: 1.5 done Checking in ldap/admin/src/scripts/template-db2ldif.pl.in; /cvs/dirsec/ldapserver/ldap/admin/src/scripts/template-db2ldif.pl.in,v <-- template-db2ldif.pl.in new revision: 1.7; previous revision: 1.6 done Checking in ldap/admin/src/scripts/template-fixup-memberof.pl.in; /cvs/dirsec/ldapserver/ldap/admin/src/scripts/template-fixup-memberof.pl.in,v <-- template-fixup-memberof.pl.in new revision: 1.2; previous revision: 1.1 done Checking in ldap/admin/src/scripts/template-ldif2db.pl.in; /cvs/dirsec/ldapserver/ldap/admin/src/scripts/template-ldif2db.pl.in,v <-- template-ldif2db.pl.in new revision: 1.5; previous revision: 1.4 done Checking in ldap/admin/src/scripts/template-ns-accountstatus.pl.in; /cvs/dirsec/ldapserver/ldap/admin/src/scripts/template-ns-accountstatus.pl.in,v <-- template-ns-accountstatus.pl.in new revision: 1.5; previous revision: 1.4 done Checking in ldap/admin/src/scripts/template-ns-activate.pl.in; /cvs/dirsec/ldapserver/ldap/admin/src/scripts/template-ns-activate.pl.in,v <-- template-ns-activate.pl.in new revision: 1.5; previous revision: 1.4 done Checking in ldap/admin/src/scripts/template-ns-inactivate.pl.in; /cvs/dirsec/ldapserver/ldap/admin/src/scripts/template-ns-inactivate.pl.in,v <-- template-ns-inactivate.pl.in new revision: 1.5; previous revision: 1.4 done Checking in ldap/admin/src/scripts/template-schema-reload.pl.in; /cvs/dirsec/ldapserver/ldap/admin/src/scripts/template-schema-reload.pl.in,v <-- template-schema-reload.pl.in new revision: 1.2; previous revision: 1.1 done verified as Nathan suggested : as long as "-w -" prompt out for password enter, we are good.
[root@mv32a-vm ~]# /usr/lib/dirsrv/slapd-mv32a-vm/bak2db.pl -w -
Bind Password:
Usage: /usr/lib/dirsrv/slapd-mv32a-vm/bak2db.pl [-v] -D rootdn { -w password | -w - | -j filename }
: -a dirname [-t dbtype]
Opts: -D rootdn - Directory Manager
: -w password - Directory Manager's password
: -w - - Prompt for Directory Manager's password
: -j filename - Read Directory Manager's password from file
: -a dirname - backup directory
: -t dbtype - database type (default: ldbm database)
: -n backend - name of backend instance to restore
: -v - verbose
[root@mv32a-vm ~]# /usr/lib/dirsrv/slapd-mv32a-vm/db2index.pl -w -
Bind Password: rehag
Usage: /usr/lib/dirsrv/slapd-mv32a-vm/db2index.pl [-v] -D rootdn { -w password | -w - | -j filename }
-n instance [-t attributeName[:indextypes[:matchingrules]]]
Opts: -D rootdn - Directory Manager
: -w password - Directory Manager's password
: -w - - Prompt for Directory Manager's password
: -j filename - Read Directory Manager's password from file
: -n instance - instance to be indexed
: -t attributeName[:indextypes[:matchingrules]]
- attributeName: name of the attribute to be indexed
If omitted, all the indexes defined
for that instance are generated.
- indextypes: comma separated index types
- matchingrules: comma separated matrules
Example: -t foo:eq,pres
: -T vlvAttributeName - vlvAttributeName: name of the vlv attribute to be indexed
: -v - verbose
An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on therefore solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHEA-2009-0455.html |