Bug 887015

Summary: ipa netgroup-mod --setattr with empty value returns internal server error
Product: Red Hat Enterprise Linux 7 Reporter: Scott Poore <spoore>
Component: ipaAssignee: Martin Kosek <mkosek>
Status: CLOSED CURRENTRELEASE QA Contact: IDM QE LIST <seceng-idm-qe-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.0CC: dpal, jgalipea, mkosek, xdong
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-01-16 15:17:24 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Scott Poore 2012-12-13 20:21:39 UTC
Description of problem:

ipa netgroup-mod (and maybe others) commands for setattr with empty value returns an internal server error like this:

[root@rhel6-1 ~]# ipa netgroup-add testng1 --desc=desc
------------------------
Added netgroup "testng1"
------------------------
  Netgroup name: testng1
  Description: desc
  NIS domain name: testrelm.com
  IPA unique ID: 3661ef20-418d-11e2-9258-525400640001


[root@rhel6-1 ~]# ipa netgroup-mod --setattr=memberuser="" testng1
ipa: ERROR: an internal error has occurred

[root@rhel6-1 httpd]# ipa netgroup-mod --setattr=memberhost="" testng1
ipa: ERROR: an internal error has occurred

And maybe others?

Version-Release number of selected component (if applicable):

ipa-server-3.0.0-10.el6.x86_64

How reproducible:

Always

Steps to Reproduce:
1. Setup IPA Server
2. ipa netgroup-add testng1 --desc="test netgroup"
3. ipa netgroup-add-member testng1 --users=admin
4. ipa netgroup-mod testng1 --setattr=memberuser=""
5. ipa netgroup-mod testng1 --setattr=memberhost=""
  
Actual results:

Internal Server Errors

Expected results:

Normal error message.

For #4, I'd also expected the users for testng1 to be deleted so they're now empty.

Additional info:

/var/log/httpd/error_log:

[Sat Dec 08 17:16:07 2012] [error] Traceback (most recent call last):
[Sat Dec 08 17:16:07 2012] [error]   File "/usr/lib/python2.6/site-packages/ipaserver/rpcserver.py", line 334, in wsgi_execute
[Sat Dec 08 17:16:07 2012] [error]     result = self.Command[name](*args, **options)
[Sat Dec 08 17:16:07 2012] [error]   File "/usr/lib/python2.6/site-packages/ipalib/frontend.py", line 435, in __call__
[Sat Dec 08 17:16:07 2012] [error]     ret = self.run(*args, **options)
[Sat Dec 08 17:16:07 2012] [error]   File "/usr/lib/python2.6/site-packages/ipalib/frontend.py", line 747, in run
[Sat Dec 08 17:16:07 2012] [error]     return self.execute(*args, **options)
[Sat Dec 08 17:16:07 2012] [error]   File "/usr/lib/python2.6/site-packages/ipalib/plugins/baseldap.py", line 1303, in execute
[Sat Dec 08 17:16:07 2012] [error]     self.process_attr_options(entry_attrs, dn, keys, options)
[Sat Dec 08 17:16:07 2012] [error]   File "/usr/lib/python2.6/site-packages/ipalib/plugins/baseldap.py", line 864, in process_attr_options
[Sat Dec 08 17:16:07 2012] [error]     setdict = self._convert_2_dict(ldap, options.get('setattr', []))
[Sat Dec 08 17:16:07 2012] [error]   File "/usr/lib/python2.6/site-packages/ipalib/plugins/baseldap.py", line 817, in _convert_2_dict
[Sat Dec 08 17:16:07 2012] [error]     value = DN(value)
[Sat Dec 08 17:16:07 2012] [error]   File "/usr/lib/python2.6/site-packages/ipapython/dn.py", line 1221, in __init__
[Sat Dec 08 17:16:07 2012] [error]     self.rdns = self._rdns_from_sequence(args)
[Sat Dec 08 17:16:07 2012] [error]   File "/usr/lib/python2.6/site-packages/ipapython/dn.py", line 1263, in _rdns_from_sequence
[Sat Dec 08 17:16:07 2012] [error]     rdn = self._rdn_from_value(item)
[Sat Dec 08 17:16:07 2012] [error]   File "/usr/lib/python2.6/site-packages/ipapython/dn.py", line 1257, in _rdn_from_value
[Sat Dec 08 17:16:07 2012] [error]     value.__class__.__name__)
[Sat Dec 08 17:16:07 2012] [error] TypeError: must be str,unicode,tuple, or RDN, got NoneType instead
[Sat Dec 08 17:16:07 2012] [error] ipa: INFO: admin: netgroup_mod(u'testng1', setattr=(u'memberuser=',), rights=False, all=False, raw=False, version=u'2.46'): TypeError

Comment 2 Dmitri Pal 2012-12-14 01:01:18 UTC
Upstream ticket:
https://fedorahosted.org/freeipa/ticket/3301

Comment 3 RHEL Program Management 2012-12-17 06:48:36 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 5 Xiyang Dong 2013-11-08 15:34:07 UTC
Verified:
[root@rhel7 ipa-netgroup-cli]# rpm -q ipa-server
ipa-server-3.2.2-1.el7.x86_64

[root@rhel7 ipa-netgroup-cli]# ipa netgroup-add testng1 --desc="test netgroup"
------------------------
Added netgroup "testng1"
------------------------
  Netgroup name: testng1
  Description: test netgroup
  NIS domain name: testrelm.com
  IPA unique ID: f487a662-4884-11e3-9e0f-5254008fd102
[root@rhel7 ipa-netgroup-cli]# ipa netgroup-add-member testng1 --users=admin
  Netgroup name: testng1
  Description: test netgroup
  NIS domain name: testrelm.com
  Member User: admin
-------------------------
Number of members added 1
-------------------------
[root@rhel7 ipa-netgroup-cli]# ipa netgroup-mod testng1 --setattr=memberuser=""
---------------------------
Modified netgroup "testng1"
---------------------------
  Netgroup name: testng1
  Description: test netgroup
  NIS domain name: testrelm.com
[root@rhel7 ipa-netgroup-cli]# ipa netgroup-mod testng1 --setattr=memberhost=""
ipa: ERROR: no modifications to be performed

Comment 6 Martin Kosek 2015-01-16 15:17:24 UTC
This issue is not reproducible with current FreeIPA/IdM version (4.1):

# ipa netgroup-add testng1 --desc=desc
------------------------
Added netgroup "testng1"
------------------------
  Netgroup name: testng1
  Description: desc
  NIS domain name: mkosek-f21.test
  IPA unique ID: 064533f2-9d2e-11e4-b15d-001a4a104e33

# ipa netgroup-mod --setattr=memberuser="" testng1
ipa: ERROR: no modifications to be performed

# ipa netgroup-mod --setattr=memberhost="" testng1
ipa: ERROR: no modifications to be performed


Closing the bug.