RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1731081 - Label escaping bug for special characters breaks ipa dnszone-show
Summary: Label escaping bug for special characters breaks ipa dnszone-show
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: python-dns
Version: 8.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: 8.2
Assignee: Lumír Balhar
QA Contact: Jan Houska
URL:
Whiteboard:
Depends On:
Blocks: 1640091
TreeView+ depends on / blocked
 
Reported: 2019-07-18 09:51 UTC by Christian Heimes
Modified: 2020-04-28 16:44 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-04-28 16:44:32 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Fedora Pagure freeipa issue 7739 0 None None None 2019-07-18 09:51:58 UTC
Github rthalley dnspython issues 339 0 'None' closed Name.to_unicode does not escape special chars 2020-03-13 13:16:35 UTC
Red Hat Product Errata RHBA-2020:1789 0 None None None 2020-04-28 16:44:36 UTC

Description Christian Heimes 2019-07-18 09:51:59 UTC
Description of problem:
dns.name.Name 's to_unicode() method has a bug. It escapes special characters to wrong way. In DNS the email address admin.1 is encoded as admin\.1.example.com. The to_unicode() method drops the quoting and turns the email address into admin.com (encoded admin.1.example.com).

The issue causes problems with IdM and breaks ipa dnszone-show command.

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

How reproducible:
always

Steps to Reproduce:
$ python3
>>> import dns.name
>>> name = dns.name.from_text("admin\\.1.example.com")
>>> name
<DNS name admin\.1.example.com.>
>>> name.to_text()
'admin\\.1.example.com.'
>>> name.to_unicode()
'admin.1.example.com.'


Actual results:
name.to_unicode() returns 'admin.1.example.com.'

Expected results:
'admin\\.1.example.com.'

Additional info:
Upstream fix https://github.com/rthalley/dnspython/commit/c76aa6ac9969447220c8e807aa1e5640a6c12924

Comment 1 Christian Heimes 2019-07-18 10:01:07 UTC
The fix has been in upstream master for a while. Upstream has retired 1.x release series in favor of 2.0 with Python 3-only support. It may be necessary to backport the fix to 1.5 manually and maintain a patch.

Comment 2 Lumír Balhar 2019-08-28 11:47:55 UTC
I am going to take a look.

We have the reproducer available so it should be easy to test the fix and I am going to backport.

Comment 3 Lumír Balhar 2019-08-28 12:32:44 UTC
I've managed to backport the upstream patch to version 1.15 (RHEL8).

Scratch build: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=23218020
Commit (my fork, rhel-8.1.é branch): https://src.osci.redhat.com/fork/lbalhar/rpms/python-dns/commits/rhel-8.1.0

Verification
Old version:

# rpm -qi python3-dns
Name        : python3-dns
Version     : 1.15.0
Release     : 8.el8

# python3
Python 3.6.8 (default, Aug  6 2019, 19:43:07) 
[GCC 8.3.1 20190507 (Red Hat 8.3.1-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import dns.name
>>> name = dns.name.from_text("admin\\.1.example.com")
>>> name
<DNS name admin\.1.example.com.>
>>> name.to_text()
'admin\\.1.example.com.'
>>> name.to_unicode()
'admin.1.example.com.'

New version:

# rpm -qi python3-dns
Name        : python3-dns
Version     : 1.15.0
Release     : 9.el8

# python3
Python 3.6.8 (default, Aug  6 2019, 19:43:07) 
[GCC 8.3.1 20190507 (Red Hat 8.3.1-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import dns.name
>>> name = dns.name.from_text("admin\\.1.example.com")
>>> name
<DNS name admin\.1.example.com.>
>>> name.to_text()
'admin\\.1.example.com.'
>>> name.to_unicode()
'admin\\.1.example.com.'

Everything is ready and tested on RHEL 8.1 so the fix has to wait until there will be a branch for RHEL 8.2. But it's already ready for a review.

The backported patch also contains one new test for to_unicode() method and a lot of existing tests are already there so I think that no new tests are needed from QA.

Comment 5 Lumír Balhar 2019-10-16 04:55:17 UTC
Pull request is ready for review here: https://src.osci.redhat.com/rpms/python-dns/pull-request/2

The test is also backported in `tests/test_name.py` function `testToText12`.

Comment 6 Lumír Balhar 2019-10-22 12:59:55 UTC
PR merged. Build: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=24188082

Comment 8 Lumír Balhar 2019-10-23 13:44:24 UTC
Before I'll be able to add the build to the errata, I need to enable gating.

Gating configuration PR: https://src.osci.redhat.com/rpms/python-dns/pull-request/3
Beaker test configuration change and prove that it works well for this bug: https://src.osci.redhat.com/tests/python-dns/pull-request/1

Could you please help me to enable gating for this component?

Comment 9 Tomas Orsava 2019-10-24 10:52:14 UTC
Lumir, please also provide the command to start only the relevant upstream test that fixes the issue, so that QE can make a Regression test case for it.

Comment 10 Lumír Balhar 2019-10-25 05:11:17 UTC
Both PRs from comment#8 merged, release bumped.

New build (for gating): https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=24238288

Command to run the backported test: python3 -m unittest -v tests.test_name.NameTestCase.testToText12

Comment 14 errata-xmlrpc 2020-04-28 16:44:32 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-2020:1789


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