Bug 1255851 - Shell CLI fails with usage errors if an argument containing white spaces is given
Shell CLI fails with usage errors if an argument containing white spaces is g...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: 389-ds-base (Show other bugs)
7.0
Unspecified Unspecified
high Severity unspecified
: rc
: ---
Assigned To: Noriko Hosoi
Viktor Ashirov
:
: 1255850 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-08-21 13:01 EDT by Noriko Hosoi
Modified: 2015-11-19 06:44 EST (History)
4 users (show)

See Also:
Fixed In Version: 389-ds-base-1.3.4.0-14.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-11-19 06:44:06 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Noriko Hosoi 2015-08-21 13:01:40 EDT
This bug is created as a clone of upstream ticket:
https://fedorahosted.org/389/ticket/48254

For instance, if db2index is run against the standard browsing index, it fails.
{{{
sh -x /usr/sbin/db2index -Z SERVERID -n userRoot -T "by MCC ou=People dc=example dc=com"

+ /usr/sbin/ns-slapd db2index -D /etc/dirsrv/slapd-SERVERID -n userRoot= -T by MCC ou=People dc=example dc=com
usage: ns-slapd db2index -D configdir -n backend-instance-name [-d debuglevel] {-t attributetype}* {-T VLV Search Name}*
}}}


There are 2 issues.
{{{
1. '=' is accidentally added to "userRoot"
2. "by MCC ou=People dc=example dc=com" is not passed as one string, but as separate words.
}}}
Comment 1 Noriko Hosoi 2015-08-21 13:02:20 EDT
Justification: since CLI db2index is not usable, we should fix it.
Comment 2 Viktor Ashirov 2015-08-22 12:00:35 EDT
*** Bug 1255850 has been marked as a duplicate of this bug. ***
Comment 5 Noriko Hosoi 2015-08-25 21:29:50 EDT
Steps to verify:
1. sh -x db2index -Z YOURID -n userRoot -t cn
If it does not fail with "userRoot=", one bug is verified.
+ /usr/sbin/ns-slapd db2index -D /etc/dirsrv/slapd-YOURID -n userRoot=

2. Run following CLIs with args including white spaces.  For instance, most of them takes "-s SUFFIX", where SUFFIX could be "dc=example, dc=com".  Or directory name could be 'dir with spaces".
  /usr/sbin/db2index
  /usr/sbin/bak2db
  /usr/sbin/db2bak
  /usr/sbin/db2index
  /usr/sbin/db2ldif
  /usr/sbin/ldif2db
  /usr/sbin/vlvindex
If no syntax error is returned, the fix is verified.
Comment 6 Amita Sharma 2015-09-15 03:46:02 EDT
1. Issue1 tested

 sh -x db2index -Z /etc/dirsrv/slapd-dhcp201-167 -n userRoot -t cn
++ /usr/sbin/ns-slapd db2index -D /etc/dirsrv/slapd-dhcp201-167 -n userRoot -t cn
[15/Sep/2015:12:51:06 +051800] - WARNING: Import is running with nsslapd-db-private-import-mem on; No other process is allowed to access the database
[15/Sep/2015:12:51:06 +051800] - check_and_set_import_cache: pagesize: 4096, pages: 471032, procpages: 58158
[15/Sep/2015:12:51:06 +051800] - Import allocates 753648KB import cache.
[15/Sep/2015:12:51:06 +051800] - userRoot: Indexing attribute: cn
[15/Sep/2015:12:51:06 +051800] - userRoot: Finished indexing.
[15/Sep/2015:12:51:06 +051800] - All database threads now stopped

2. White spaces tested::

[root@dhcp201-167 export]# db2index -Z slapd-dhcp201-167 -n redhatdb -s "dc=redhat, dc=com" -t cn
[15/Sep/2015:13:00:49 +051800] - WARNING: Import is running with nsslapd-db-private-import-mem on; No other process is allowed to access the database
[15/Sep/2015:13:00:49 +051800] - check_and_set_import_cache: pagesize: 4096, pages: 471032, procpages: 58306
[15/Sep/2015:13:00:49 +051800] - Import allocates 753648KB import cache.
[15/Sep/2015:13:00:49 +051800] - redhatdb: Indexing attribute: cn
[15/Sep/2015:13:00:49 +051800] - redhatdb: Finished indexing.
[15/Sep/2015:13:00:49 +051800] - All database threads now stopped

[root@dhcp201-167 export]# /usr/sbin/db2ldif -Z slapd-dhcp201-167 -n redhatdb -s "dc=redhat, dc=com"Exported ldif file: /var/lib/dirsrv/slapd-dhcp201-167/ldif/dhcp201-167-redhatdb-redhat-2015_09_15_130421.ldif
ldiffile: /var/lib/dirsrv/slapd-dhcp201-167/ldif/dhcp201-167-redhatdb-redhat-2015_09_15_130421.ldif
[15/Sep/2015:13:04:21 +051800] - All database threads now stopped

 /usr/sbin/ldif2db -Z slapd-dhcp201-167 -n redhatdb -s "dc=redhat, dc=com" -i /export/data.ldif 
importing data ...
[15/Sep/2015:13:07:25 +051800] - import redhatdb: Created ancestorid index (new idl).
[15/Sep/2015:13:07:25 +051800] - import redhatdb: Flushing caches...
[15/Sep/2015:13:07:25 +051800] - import redhatdb: Closing files...
[15/Sep/2015:13:07:25 +051800] - All database threads now stopped
[15/Sep/2015:13:07:25 +051800] - import redhatdb: Import complete.  Processed 105 entries (105 were skipped) in 7 seconds. (15.00 entries/sec)

[root@dhcp201-167 export]# vlvindex -Z slapd-dhcp201-167 -n redhatdb -s "dc=redhat, dc=com" -T myVLVIndex 
[15/Sep/2015:13:10:04 +051800] - WARNING: Import is running with nsslapd-db-private-import-mem on; No other process is allowed to access the database
[15/Sep/2015:13:10:04 +051800] - check_and_set_import_cache: pagesize: 4096, pages: 471032, procpages: 58305
[15/Sep/2015:13:10:04 +051800] - Import allocates 753648KB import cache

Hence VERIFIED.

[root@dhcp201-167 export]# rpm -qa | grep 389
389-ds-base-1.3.4.0-15.el7.x86_64
389-ds-base-debuginfo-1.3.4.0-1.el7.x86_64
389-ds-base-libs-1.3.4.0-15.el7.x86_64
Comment 7 errata-xmlrpc 2015-11-19 06:44:06 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-2351.html

Note You need to log in before you can comment on or make changes to this bug.