Bug 120875 - getent returns incorrect service names in some cases
getent returns incorrect service names in some cases
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: glibc (Show other bugs)
3.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
:
: 120878 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-04-14 15:45 EDT by Neil Horman
Modified: 2007-11-30 17:07 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-05-12 06:23:02 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
patch to correct byte swapping behavior (382 bytes, patch)
2004-04-14 15:47 EDT, Neil Horman
no flags Details | Diff

  None (edit)
Description Neil Horman 2004-04-14 15:45:11 EDT
Description of problem:
When operating over nis, if two services are configured which have
canonically byte swapped port number, getent will return the name of
the incorrect service

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


How reproducible:
always

Steps to Reproduce:
1.configure an NIS server and NIS client
2.export the services file over NIS and make sure the client looks
services up there
3.add two services to the services file, make the entry as follows:
servicea 11342/tcp
serviceb 20012/tcp
4.issue ypcat services on the client and confirm that the services
added in (3) above can be seen (note that htons(11342)=20012
5.on the client issue the commmands: 
getent services 11342/tcp 
getent services 20012/tcp
  
Actual results:
getent services 20012/tcp returns
servicea                 11342/tcp
and 
getent services 11342/tcp returns
serviceb        20012/tcp


Expected results:
getent services 11342/tcp should return
servicea                 11342/tcp
and getent services 20012/tcp should return
serviceb                 20012/tcp

Additional info:
Comment 1 Neil Horman 2004-04-14 15:47:24 EDT
Created attachment 99424 [details]
patch to correct byte swapping behavior

This patch removes the (ostensibly incorrect) htons call from the getent
application and allows services to be returned correctly.
Comment 2 Jakub Jelinek 2004-04-14 15:51:18 EDT
The patch is incorrect.
http://www.opengroup.org/onlinepubs/007904975/functions/getservbyport.html
"The port argument shall be in network byte order."

There used to be a bug in _nss_nis_getservbyport_r which did not use
ntohs (), but this is fixed in the current U2/U4 glibc candidates.
See ftp://people.redhat.com/jakub/glibc/errata/
Comment 3 Jakub Jelinek 2004-04-15 03:11:56 EDT
*** Bug 120878 has been marked as a duplicate of this bug. ***
Comment 4 Jakub Jelinek 2004-05-12 06:23:02 EDT
I'm assuming this is fixed in glibc-2.2.4-32.15 and glibc-2.3.2-95.20.
If not, please reopen.

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