Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1520601

Summary: ypmatch - queries don't match unless the request is all lower-case
Product: Red Hat Enterprise Linux 7 Reporter: Eugene Keck <ekeck>
Component: yp-toolsAssignee: Petr Kubat <pkubat>
Status: CLOSED WONTFIX QA Contact: qe-baseos-daemons
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3CC: databases-maint, ekeck, hhorak, mmuzila
Target Milestone: rcKeywords: Patch
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-19 06:48:53 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:
Attachments:
Description Flags
proposed patch none

Description Eugene Keck 2017-12-04 19:56:03 UTC
Description of problem:
Queries don't match unless the request is all lower-case and should be case-insensitive to match Solaris client behavior.

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

How reproducible:
Always

Steps to Reproduce:
1. Setup hosts map in NIS

Actual results:
Match only if using lower case

Expected results:
Match with any case

Additional info:

# cat /var/yp/maps/hosts 
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.10 NAME1.EXAMPLE.LOCAL NAME1
192.168.1.11 name2.example.local name2
192.168.1.12 nAmE3.eXaMpLe.LoCaL nAmE3

# ypmatch name1 hosts
192.168.1.10 NAME1.EXAMPLE.LOCAL NAME1

# ypmatch name2 hosts
192.168.1.11 name2.example.local name2

# ypmatch name3 hosts
192.168.1.12 nAmE3.eXaMpLe.LoCaL nAmE3  

# ypmatch NAME1 hosts
Can't match key NAME1 in map hosts.byname. Reason: No such key in map

# ypmatch NAME2 hosts
Can't match key NAME2 in map hosts.byname. Reason: No such key in map

# ypmatch nAmE3 hosts
Can't match key nAmE3 in map hosts.byname. Reason: No such key in map

Comment 2 Petr Kubat 2017-12-05 09:10:01 UTC
Thanks for the report.

Will take a look at this. Since ypserv returns a proper response for mixed case hosts entry even when lowercase key is used for ypmatch, transforming the input key to lowercase before sending the request will likely do the trick.

Comment 4 Petr Kubat 2018-01-08 07:56:40 UTC
Actually not as easy of a fix as first thought since transforming every key to lowercase before calling ypmatch would break other map lookups as they could be case sensitive.

Comment 5 Petr Kubat 2018-01-08 11:50:08 UTC
Created attachment 1378489 [details]
proposed patch

Proposed a fix upstream:
https://github.com/thkukuk/libnsl/pull/7

Also attaching the same fix for our version of NIS.

Comment 7 Petr Kubat 2018-01-10 12:51:01 UTC
Also to work around the issue one can remove makedbm's `-l` option inside the Makefile used to generate the maps (hosts.byname rule). This will make sure the keys inside the maps will not get transformed to lowercase when they are built from the source files.