Bug 1223465

Summary: nss_getpwnam: does not ignore case when comparing domain names
Product: Red Hat Enterprise Linux 6 Reporter: Kyle Squizzato <ksquizza>
Component: nfs-utils-libAssignee: Steve Dickson <steved>
Status: CLOSED ERRATA QA Contact: Yongcheng Yang <yoyang>
Severity: high Docs Contact:
Priority: urgent    
Version: 6.6CC: cww, eguan, fs-qe, jherrman, jkurik, smayhew, tlavigne
Target Milestone: rcKeywords: ZStream
Target Release: 6.7   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: nfs-utils-lib-1.1.5-11.el6. Doc Type: Bug Fix
Doc Text:
The nss_getpwnam() function previously failed to find the intended password entry when the DNS domain name contained both upper-case and lower-case characters. This update ensures that character case is ignored when comparing domain names, and nss_getpwnam() is able to retrieve passwords as expected.
Story Points: ---
Clone Of:
: 1223764 (view as bug list) Environment:
Last Closed: 2015-07-22 06:28:04 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:
Bug Depends On:    
Bug Blocks: 1075802, 1223764    

Description Kyle Squizzato 2015-05-20 14:59:55 UTC
Description of problem:
nss_getpwnam: does not ignore case when comparing domain names

Version-Release number of selected component (if applicable):
nfs-utils-lib-1.1.5-9.el6.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Set domain name on NFS server to EXAMPLE.COM
2. Set domain name on NFS client to example.com 
3. Mount the share on the NFS server and attempt to list the contents of the share, idmapper will translate the user@domain strings to nobody

Actual results:
The domain name does not match and user@domain strings are translated to nobody 

Expected results:
The domain name should match regardless of upper or lower case characters

Additional info:
Please backport 

commit 0c1766af5bf125a56fbf589111aa2f3876a5d709
Author: Steve Dickson <steved>
Date:   Sat Nov 12 10:19:52 2011 -0500

    nss_getpwnam: ignore case when comparing domain names
    
    nss_getpwnam() fails to find the password entry when the
    DNS domain name has both upper and lower characters,
    which is wrong. Case need to be ignored when comparing
    domain names.
    
    Signed-off-by: Steve Dickson <steved>

This commit is present in RHEL7 and the behavior works as expected there: 

May 19 14:07:59 192.168.122.129 nfsidmap[21636]: nss_getpwnam: name 'exampleuser' domain 'example.com': resulting localname 'exampleuser'

Comment 2 Steve Dickson 2015-05-20 17:50:31 UTC
This is a one liner that is easily testable... 

looking for a QE ack and some PM acks...

Comment 6 Yongcheng Yang 2015-05-25 08:32:00 UTC
Verified on nfs-utils-lib-1.1.5-11.el6.x86_64 by hand

#####################################################
# Server: #
###########
[root@hp-dl385pg8-10 ~]# exportfs -v
/export_test  	<world>(rw,wdelay,no_root_squash,no_subtree_check,sec=sys,rw,no_root_squash,no_all_squash)
[root@hp-dl385pg8-10 ~]# touch /export_test/file_root
[root@hp-dl385pg8-10 ~]# su qa -c "touch /export_test/file_qa"
[root@hp-dl385pg8-10 ~]# ls -l /export_test/
total 0
-rw-r--r--. 1 qa   qa   0 May 25 16:17 file_qa
-rw-r--r--. 1 root root 0 May 25 16:16 file_root
[root@hp-dl385pg8-10 ~]# grep "^[^#]" /etc/idmapd.conf
[General]
Verbosity = 3
Domain = EXAMPLE.COM
[Mapping]
Nobody-User = test
Nobody-Group = test
[Translation]
Method = nsswitch
[root@hp-dl385pg8-10 ~]#

###########
# Client: #
###########
[root@hp-dl580g7-03 ~]# grep "^[^#]" /etc/idmapd.conf
[General]
Verbosity = 2
Domain = EXAMPLE.COM  >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> with same domain name
[Mapping]
Nobody-User = test
Nobody-Group = test
[Translation]
Method = nsswitch
 
[root@hp-dl580g7-03 ~]# nfsidmap -c
nfsidmap: clearing '165260bf I--Q---     1 perm 3f3f0000     0     0 keyring   .id_resolver_child_1: 4/4'
nfsidmap: clearing '38e2b7b7 I------     1 perm 1f030000     0     0 keyring   .id_resolver: 1/4'
[root@hp-dl580g7-03 ~]# mount -t nfs hp-dl385pg8-10.rhts.eng.pek2.redhat.com:/export_test  /mnt/mnt_test/[root@hp-dl580g7-03 ~]# ls -l /mnt/mnt_test/
total 0
-rw-r--r--. 1 qa   qa   0 May 25 16:17 file_qa >>>>>>>>>>>>>>> with same domain name
-rw-r--r--. 1 root root 0 May 25 16:16 file_root
[root@hp-dl580g7-03 ~]# 
[root@hp-dl580g7-03 ~]# 
[root@hp-dl580g7-03 ~]# 
[root@hp-dl580g7-03 ~]# 
[root@hp-dl580g7-03 ~]# 
[root@hp-dl580g7-03 ~]# grep "^[^#]" /etc/idmapd.conf
[General]
Verbosity = 2
Domain = example.com >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> diff with upper and lower-case
[Mapping]
Nobody-User = test
Nobody-Group = test
[Translation]
Method = nsswitch
 
[root@hp-dl580g7-03 ~]# nfsidmap -c
nfsidmap: clearing '0881dd20 I--Q---     1 perm 3f3f0000     0     0 keyring   .id_resolver_child_1: 4/4'
nfsidmap: clearing '38e2b7b7 I------     1 perm 1f030000     0     0 keyring   .id_resolver: 1/4'
[root@hp-dl580g7-03 ~]# umount /mnt/mnt_test/; mount -t nfs hp-dl385pg8-10.rhts.eng.pek2.redhat.com:/export_test  /mnt/mnt_test/
[root@hp-dl580g7-03 ~]# ls -l /mnt/mnt_test/
total 0
-rw-r--r--. 1 test test 0 May 25 16:17 file_qa 
-rw-r--r--. 1 test test 0 May 25 16:16 file_root
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reproduced with original build
[root@hp-dl580g7-03 ~]# rpm -q nfs-utils-lib
nfs-utils-lib-1.1.5-10.el6.x86_64
[root@hp-dl580g7-03 ~]# rpm -Uvh nfs-utils-lib-1.1.5-11.el6.x86_64.rpm 
Preparing...                ########################################### [100%]
   1:nfs-utils-lib          ########################################### [100%]
[root@hp-dl580g7-03 ~]# rpm -q nfs-utils-lib
nfs-utils-lib-1.1.5-11.el6.x86_64 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> apply the patch
[root@hp-dl580g7-03 ~]# grep "^[^#]" /etc/idmapd.conf
[General]
Verbosity = 2
Domain = example.com
[Mapping]
Nobody-User = test
Nobody-Group = test
[Translation]
Method = nsswitch
 
[root@hp-dl580g7-03 ~]# nfsidmap -c
nfsidmap: clearing '3e2cfca8 I--Q---     1 perm 3f3f0000     0     0 keyring   .id_resolver_child_1: 4/4'
nfsidmap: clearing '38e2b7b7 I------     1 perm 1f030000     0     0 keyring   .id_resolver: 1/4'
[root@hp-dl580g7-03 ~]# umount /mnt/mnt_test/; mount -t nfs hp-dl385pg8-10.rhts.eng.pek2.redhat.com:/export_test  /mnt/mnt_test/
[root@hp-dl580g7-03 ~]# ls -l /mnt/mnt_test/
total 0
-rw-r--r--. 1 qa   qa   0 May 25 16:17 file_qa 
-rw-r--r--. 1 root root 0 May 25 16:16 file_root
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ verified with current build
[root@hp-dl580g7-03 ~]# rpm -q nfs-utils-lib
nfs-utils-lib-1.1.5-11.el6.x86_64
[root@hp-dl580g7-03 ~]# 

#####################################################
Move to VERIFIED

Comment 8 errata-xmlrpc 2015-07-22 06:28: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.

https://rhn.redhat.com/errata/RHBA-2015-1312.html