Bug 798792

Summary: ipa netgroup-find options set to space return internal errors
Product: Red Hat Enterprise Linux 6 Reporter: Scott Poore <spoore>
Component: ipaAssignee: Rob Crittenden <rcritten>
Status: CLOSED ERRATA QA Contact: IDM QE LIST <seceng-idm-qe-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.3CC: dpal, jgalipea, mkosek
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ipa-2.2.0-5.el6 Doc Type: Bug Fix
Doc Text:
No documentation needed.
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-20 13:20:04 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
/var/log/httpd/error_log entries relevant here, none

Description Scott Poore 2012-02-29 21:11:33 UTC
Created attachment 566655 [details]
/var/log/httpd/error_log entries relevant here,

Description of problem:

Several netgroup-find options return internal error when give as a space (" ").

# ipa netgroup-find --netgroups=" "
ipa: ERROR: an internal error has occurred

# ipa netgroup-find --no-netgroups=" "
ipa: ERROR: an internal error has occurred

# ipa netgroup-find --users=" "
ipa: ERROR: an internal error has occurred

# ipa netgroup-find --no-users=" "
ipa: ERROR: an internal error has occurred

# ipa netgroup-find --groups=" "
ipa: ERROR: an internal error has occurred

# ipa netgroup-find --no-groups=" "
ipa: ERROR: an internal error has occurred

# ipa netgroup-find --hosts=" "
ipa: ERROR: an internal error has occurred

# ipa netgroup-find --no-hosts=" "
ipa: ERROR: an internal error has occurred

# ipa netgroup-find --hostgroups=" "
ipa: ERROR: an internal error has occurred

# ipa netgroup-find --no-hostgroups=" "
ipa: ERROR: an internal error has occurred

# ipa netgroup-find --in-netgroups=" "
ipa: ERROR: an internal error has occurred

# ipa netgroup-find --not-in-netgroups=" "
ipa: ERROR: an internal error has occurred

Version-Release number of selected component (if applicable):
389-ds-base-1.2.10.1-1.el6.x86_64
389-ds-base-libs-1.2.10.1-1.el6.x86_64
ipa-server-2.2.0-102.20120220T2339zgit7fe095c.el6.x86_64


How reproducible:
always

Steps to Reproduce:
1. <setup ipa server>
2. kinit admin
3. <run one or more of the following>:
# ipa netgroup-find --netgroups=" "
# ipa netgroup-find --no-netgroups=" "
# ipa netgroup-find --users=" "
# ipa netgroup-find --no-users=" "
# ipa netgroup-find --groups=" "
# ipa netgroup-find --no-groups=" "
# ipa netgroup-find --hosts=" "
# ipa netgroup-find --no-hosts=" "
# ipa netgroup-find --hostgroups=" "
# ipa netgroup-find --no-hostgroups=" "
# ipa netgroup-find --in-netgroups=" "
# ipa netgroup-find --not-in-netgroups=" "

  
Actual results:

returns:  
ipa: ERROR: an internal error has occurred

Expected results:

something more like the following is what I expected to see (with OPTION replaced with the option from the command line):

ipa: ERROR: invalid '<OPTION>': Leading and trailing spaces are not allowed


Additional info:

/var/log/httpd/error_log entries in attachment

Comment 2 Rob Crittenden 2012-02-29 21:29:56 UTC
The traceback looks something like:

[Wed Feb 29 16:28:53 2012] [error] ipa: DEBUG: WSGI wsgi_dispatch.__call__:
[Wed Feb 29 16:28:53 2012] [error] ipa: DEBUG: WSGI xmlserver.__call__:
[Wed Feb 29 16:28:53 2012] [error] ipa: DEBUG: Created connection context.ldap2
[Wed Feb 29 16:28:53 2012] [error] ipa: DEBUG: WSGI WSGIExecutioner.__call__:
[Wed Feb 29 16:28:53 2012] [error] ipa: DEBUG: raw: netgroup_find(None, private=False, managed=False, all=False, raw=False, version=u'2.27', pkey_only=False, netgroup=None)
[Wed Feb 29 16:28:53 2012] [error] ipa: DEBUG: netgroup_find(None, private=False, managed=False, all=False, raw=False, version=u'2.27', pkey_only=False, netgroup=None)
[Wed Feb 29 16:28:53 2012] [error] ipa: ERROR: non-public: TypeError: 'NoneType' object is not iterable
[Wed Feb 29 16:28:53 2012] [error] Traceback (most recent call last):
[Wed Feb 29 16:28:53 2012] [error]   File "/usr/lib/python2.7/site-packages/ipaserver/rpcserver.py", line 314, in wsgi_execute
[Wed Feb 29 16:28:53 2012] [error]     result = self.Command[name](*args, **options)
[Wed Feb 29 16:28:53 2012] [error]   File "/usr/lib/python2.7/site-packages/ipalib/frontend.py", line 438, in __call__
[Wed Feb 29 16:28:53 2012] [error]     ret = self.run(*args, **options)
[Wed Feb 29 16:28:53 2012] [error]   File "/usr/lib/python2.7/site-packages/ipalib/frontend.py", line 696, in run
[Wed Feb 29 16:28:53 2012] [error]     return self.execute(*args, **options)
[Wed Feb 29 16:28:53 2012] [error]   File "/usr/lib/python2.7/site-packages/ipalib/plugins/baseldap.py", line 1815, in execute
[Wed Feb 29 16:28:53 2012] [error]     member_filter = self.get_member_filter(ldap, **options)
[Wed Feb 29 16:28:53 2012] [error]   File "/usr/lib/python2.7/site-packages/ipalib/plugins/baseldap.py", line 1747, in get_member_filter
[Wed Feb 29 16:28:53 2012] [error]     for pkey in options[param_name]:
[Wed Feb 29 16:28:53 2012] [error] TypeError: 'NoneType' object is not iterable
[Wed Feb 29 16:28:53 2012] [error] ipa: INFO: admin: netgroup_find(None, private=False, managed=False, all=False, raw=False, version=u'2.27', pkey_only=False, netgroup=None): TypeError
[Wed Feb 29 16:28:53 2012] [error] ipa: DEBUG: response: InternalError: an internal error has occurred
[Wed Feb 29 16:28:53 2012] [error] ipa: DEBUG: Destroyed connection context.ldap2

Invalid options are ignored, searching for spaces shouldn't be illegal.

Comment 3 Scott Poore 2012-03-01 00:03:02 UTC
I would have expected it to be illegal for the options that do not allow spaces.   I wouldn't have expected that in any of the cases I listed.

Still, if it is legal to search for spaces (even for types that don't allow spaces), shouldn't it have returned a normal message listing 0 entries returned?

Are the traceback errors a result of the types I listed being lists as opposed to more simple strings?

Thanks

Comment 4 Rob Crittenden 2012-03-01 15:35:35 UTC
We purposely do no validation on search strings. Otherwise, for example, to search on hosts you'd always have to search on the fqdn and not a substring.

I'm just guessing but I think the space is being optimized out and being set to None and that is why it is blowing up.

Comment 5 Scott Poore 2012-03-01 18:35:09 UTC
The --desc and --uuid options seem to check for spaces (leading/trailing at least).   Are those special cases?

# ipa netgroup-find --uuid=" "
ipa: ERROR: invalid 'uuid': Leading and trailing spaces are not allowed

# ipa netgroup-find --desc=" "
ipa: ERROR: invalid 'desc': Leading and trailing spaces are not allowed

Blowing up on None makes sense there from the TypeError message (if I understand what it's saying).

However, None seems to work on netgroup-add-member though?

# ipa netgroup-add-member test --netgroups=" "
  Netgroup name: test
  Description: desc
  NIS domain name: testrelm.com
  Member User: admin
-------------------------
Number of members added 0
-------------------------

/var/log/httpd/error_logs:

[Thu Mar 01 12:30:48 2012] [error] ipa: INFO: admin: netgroup_add_member(u'test', all=False, raw=False, version=u'2.26', netgroup=None): SUCCESS

So, is there something here that can be done to fix the internal errors?

Comment 6 Rob Crittenden 2012-03-01 19:10:17 UTC
No validation should be done on find options, that is a separate bug.

Yes, we will address the exception.

Comment 7 Martin Kosek 2012-03-02 07:33:21 UTC
Upstream ticket:
https://fedorahosted.org/freeipa/ticket/2479

Comment 8 Rob Crittenden 2012-03-14 20:39:35 UTC
Fixed upstream.

master: e9d68a7b001d23a7bac7cbf52e270c0723f1f69d

ipa-2-2: ea4047ec47130fb4e001896d997085da1ca510c2

Comment 11 Scott Poore 2012-03-22 20:28:05 UTC
Verified.

Version :: ipa-server-2.2.0-5.el6.x86_64

Automated Test Results ::

[root@ibm-x3655-04 ipa-netgroup-cli]# netgroup_bz_798792

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [   LOG    ] :: netgroup_bz_798792_1: ipa netgroup-find options set to space return internal errors (netgroups)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: [   PASS   ] :: Running 'ipa netgroup-find --netgroups=" " > /tmp/errormsg.out 2>&1'
:: [   PASS   ] :: BZ 798792 not found.

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [   LOG    ] :: netgroup_bz_798792_2: ipa netgroup-find options set to space return internal errors (no-netgroups)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: [   PASS   ] :: Running 'ipa netgroup-find --no-netgroups=" " > /tmp/errormsg.out 2>&1'
:: [   PASS   ] :: BZ 798792 not found.

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [   LOG    ] :: netgroup_bz_798792_3: ipa netgroup-find options set to space return internal errors (users)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: [   PASS   ] :: Running 'ipa netgroup-find --users=" " > /tmp/errormsg.out 2>&1'
:: [   PASS   ] :: BZ 798792 not found.

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [   LOG    ] :: netgroup_bz_798792_4: ipa netgroup-find options set to space return internal errors (no-users)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: [   PASS   ] :: Running 'ipa netgroup-find --no-users=" " > /tmp/errormsg.out 2>&1'
:: [   PASS   ] :: BZ 798792 not found.

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [   LOG    ] :: netgroup_bz_798792_5: ipa netgroup-find options set to space return internal errors (groups)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: [   PASS   ] :: Running 'ipa netgroup-find --groups=" " > /tmp/errormsg.out 2>&1'
:: [   PASS   ] :: BZ 798792 not found.

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [   LOG    ] :: netgroup_bz_798792_6: ipa netgroup-find options set to space return internal errors (no-groups)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: [   PASS   ] :: Running 'ipa netgroup-find --no-groups=" " > /tmp/errormsg.out 2>&1'
:: [   PASS   ] :: BZ 798792 not found.

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [   LOG    ] :: netgroup_bz_798792_7: ipa netgroup-find options set to space return internal errors (hosts)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: [   PASS   ] :: Running 'ipa netgroup-find --hosts=" " > /tmp/errormsg.out 2>&1'
:: [   PASS   ] :: BZ 798792 not found.

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [   LOG    ] :: netgroup_bz_798792_8: ipa netgroup-find options set to space return internal errors (no-hosts)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: [   PASS   ] :: Running 'ipa netgroup-find --no-hosts=" " > /tmp/errormsg.out 2>&1'
:: [   PASS   ] :: BZ 798792 not found.

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [   LOG    ] :: netgroup_bz_798792_9: ipa netgroup-find options set to space return internal errors (hostgroups)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: [   PASS   ] :: Running 'ipa netgroup-find --hostgroups=" " > /tmp/errormsg.out 2>&1'
:: [   PASS   ] :: BZ 798792 not found.

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [   LOG    ] :: netgroup_bz_798792_10: ipa netgroup-find options set to space return internal errors (no-hostgroups)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: [   PASS   ] :: Running 'ipa netgroup-find --no-hostgroups=" " > /tmp/errormsg.out 2>&1'
:: [   PASS   ] :: BZ 798792 not found.

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [   LOG    ] :: netgroup_bz_798792_11: ipa netgroup-find options set to space return internal errors (in-netgroups)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: [   PASS   ] :: Running 'ipa netgroup-find --in-netgroups=" " > /tmp/errormsg.out 2>&1'
:: [   PASS   ] :: BZ 798792 not found.

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [   LOG    ] :: netgroup_bz_798792_12: ipa netgroup-find options set to space return internal errors (not-in-netgroups)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: [   PASS   ] :: Running 'ipa netgroup-find --not-in-netgroups=" " > /tmp/errormsg.out 2>&1'
:: [   PASS   ] :: BZ 798792 not found.


Manual Test Results :: 
[root@ibm-x3655-04 ipa-netgroup-cli]# ipa netgroup-find --netgroups=" "
-------------------
0 netgroups matched
-------------------
----------------------------
Number of entries returned 0
----------------------------
[root@ibm-x3655-04 ipa-netgroup-cli]# ipa netgroup-find --no-netgroups=" "
-------------------
0 netgroups matched
-------------------
----------------------------
Number of entries returned 0
----------------------------
[root@ibm-x3655-04 ipa-netgroup-cli]# ipa netgroup-find --users=" "
-------------------
0 netgroups matched
-------------------
----------------------------
Number of entries returned 0
----------------------------
[root@ibm-x3655-04 ipa-netgroup-cli]# ipa netgroup-find --no-users=" "
-------------------
0 netgroups matched
-------------------
----------------------------
Number of entries returned 0
----------------------------
[root@ibm-x3655-04 ipa-netgroup-cli]# ipa netgroup-find --groups=" "
-------------------
0 netgroups matched
-------------------
----------------------------
Number of entries returned 0
----------------------------
[root@ibm-x3655-04 ipa-netgroup-cli]# ipa netgroup-find --no-groups=" "
-------------------
0 netgroups matched
-------------------
----------------------------
Number of entries returned 0
----------------------------
[root@ibm-x3655-04 ipa-netgroup-cli]# ipa netgroup-find --hosts=" "
-------------------
0 netgroups matched
-------------------
----------------------------
Number of entries returned 0
----------------------------
[root@ibm-x3655-04 ipa-netgroup-cli]# ipa netgroup-find --no-hosts=" "
-------------------
0 netgroups matched
-------------------
----------------------------
Number of entries returned 0
----------------------------
[root@ibm-x3655-04 ipa-netgroup-cli]# ipa netgroup-find --hostgroups=" "
-------------------
0 netgroups matched
-------------------
----------------------------
Number of entries returned 0
----------------------------
[root@ibm-x3655-04 ipa-netgroup-cli]# ipa netgroup-find --no-hostgroups=" "
-------------------
0 netgroups matched
-------------------
----------------------------
Number of entries returned 0
----------------------------
[root@ibm-x3655-04 ipa-netgroup-cli]# ipa netgroup-find --in-netgroups=" "
-------------------
0 netgroups matched
-------------------
----------------------------
Number of entries returned 0
----------------------------
[root@ibm-x3655-04 ipa-netgroup-cli]# ipa netgroup-find --not-in-netgroups=" "
-------------------
0 netgroups matched
-------------------
----------------------------
Number of entries returned 0
----------------------------

Comment 13 Martin Kosek 2012-04-24 13:32:15 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
No documentation needed.

Comment 15 errata-xmlrpc 2012-06-20 13:20:04 UTC
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.

http://rhn.redhat.com/errata/RHBA-2012-0819.html