Bug 1382053

Summary: Need to have validation for idrange names
Product: Red Hat Enterprise Linux 7 Reporter: Sudhir Menon <sumenon>
Component: ipaAssignee: IPA Maintainers <ipa-maint>
Status: CLOSED ERRATA QA Contact: Kaleem <ksiddiqu>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.3CC: mbabinsk, pvoborni, rcritten, tkrizek
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ipa-4.5.0-6.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 09:42:02 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 Sudhir Menon 2016-10-05 15:32:19 UTC
Description of problem: Need to have validation for idrange name


Version-Release number of selected component (if applicable):
ipa-server-4.4.0-12.el7.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Ensure two-way trust is added with IPA server
2. Now run the below command with empty domain name.

#ipa idrange-add _id_range2 --dom-name= --rid-base=200000 --base-id=55 --range-size=5

3. Check the message on the console

Actual results:
[root@master]# ipa idrange-add _id_range2 --dom-name= --rid-base=200000 --base-id=55 --range-size=5
ipa: ERROR: an internal error has occurred

error_log

[Wed Oct 05 20:44:44.789504 2016] [:error] [pid 30073]   File "/usr/lib/python2.7/site-packages/ipaserver/plugins/idrange.py", line 421, in pre_callback
[Wed Oct 05 20:44:44.789506 2016] [:error] [pid 30073]     options['ipanttrusteddomainname'])
[Wed Oct 05 20:44:44.789509 2016] [:error] [pid 30073]   File "/usr/lib/python2.7/site-packages/ipaserver/plugins/idrange.py", line 354, in get_trusted_domain_sid_from_name
[Wed Oct 05 20:44:44.789519 2016] [:error] [pid 30073]     sid = domain_validator.get_sid_from_domain_name(name)
[Wed Oct 05 20:44:44.789522 2016] [:error] [pid 30073]   File "/usr/lib/python2.7/site-packages/ipaserver/dcerpc.py", line 342, in get_sid_from_domain_name
[Wed Oct 05 20:44:44.789525 2016] [:error] [pid 30073]     if name in domains:
[Wed Oct 05 20:44:44.789527 2016] [:error] [pid 30073]   File "/usr/lib/python2.7/site-packages/ipapython/ipautil.py", line 671, in __contains__
[Wed Oct 05 20:44:44.789530 2016] [:error] [pid 30073]     return super(CIDict, self).__contains__(key.lower())
[Wed Oct 05 20:44:44.789532 2016] [:error] [pid 30073] AttributeError: 'NoneType' object has no attribute 'lower'
[Wed Oct 05 20:44:44.789938 2016] [:error] [pid 30073] ipa: INFO: [jsonserver_session] admin: idrange_add/1(u'_id_range2', ipabaseid=55, ipaidrangesize=5, ipabaserid=200000, ipanttrusteddomainname=None, version=u'2.213'): AttributeError
 
Expected results:
Internal error should be fixed.

Additional info:

Comment 3 Petr Vobornik 2016-10-14 12:19:39 UTC
Upstream ticket:
https://fedorahosted.org/freeipa/ticket/6404

Comment 8 Sudhir Menon 2017-05-15 13:05:57 UTC
Internal error is no more displayed.
Tested on RHEL7.4 using 

ipa-server-4.5.0-11.el7.x86_64
389-ds-base-1.3.6.1-13.el7.x86_64
pki-ca-10.4.1-4.el7.noarch
krb5-server-1.15.1-8.el7.x86_64
sssd-1.15.2-29.el7.x86_64


[root@master yum.repos.d]# ipa idrange-add _id_range2 --dom-name= --rid-base=200000 --base-id=55 --range-size=5
ipa: ERROR: invalid 'ID Range setup': Options secondary-rid-base and rid-base must be used together


[Mon May 15 09:04:04.426808 2017] [:error] [pid 27778] ipa: INFO: [jsonserver_session] admin: idrange_add/1(u'_id_range2', ipabaseid=55, ipaidrangesize=5, ipabaserid=200000, ipanttrusteddomainname=None, version=u'2.224'): ValidationError

Comment 9 errata-xmlrpc 2017-08-01 09:42:02 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.

https://access.redhat.com/errata/RHBA-2017:2304