Bug 120878 - [PATCH] lsof returns incorrect service names for sockets under some circumstances
Summary: [PATCH] lsof returns incorrect service names for sockets under some circumsta...
Status: CLOSED DUPLICATE of bug 120875
Alias: None
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: lsof
Version: 3.0
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brock Organ
Depends On:
TreeView+ depends on / blocked
Reported: 2004-04-14 19:54 UTC by Neil Horman
Modified: 2007-11-30 22:07 UTC (History)
1 user (show)

Clone Of:
Last Closed: 2006-02-21 19:02:35 UTC

Attachments (Terms of Use)
patch to correct byte order reversal in lsof (417 bytes, patch)
2004-04-14 19:55 UTC, Neil Horman
no flags Details | Diff

Description Neil Horman 2004-04-14 19:54:03 UTC
Description of problem:
running lsof -i <PROTO>:<SVC_NAME> can return incorrect service names
if two services are configured with canonically byte swaped port values.

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

How reproducible:

Steps to Reproduce:
1.configure an NIS server and client
2.export the services file via NIS and make sure the client searches
NIS first for services
3.add two services to the NIS services map as follows
servicea    11342/tcp
serviceb    20012/tcp
(Note that htons(11342)=20012)
4.open a socket on the NIS client and have it listen on port 11342
5.issue the command lsof -i TCP:servicea

Actual results:
lsof reports:
<host socket information mumble>:serviceb (LISTEN)

Expected results:
lsof should report:
<host socket information mumble>:servicea (LISTEN)

Additional info:

Comment 1 Neil Horman 2004-04-14 19:55:16 UTC
Created attachment 99425 [details]
patch to correct byte order reversal in lsof

This patch removes an extra byte swap in the print routine during a last
getservbyname call, and fixes the reported issue.

Comment 2 Jakub Jelinek 2004-04-15 07:11:52 UTC

*** This bug has been marked as a duplicate of 120875 ***

Comment 3 Neil Horman 2004-04-15 11:14:34 UTC
Jakub, are you sure these bugs are duplicates.  they're two separate
apps which need to be modified in separate places, or are you planning
on finding a common point to fix these?

Comment 4 Jakub Jelinek 2004-04-15 11:20:20 UTC
Yes, I am sure.
They are not application bugs, but libnss_nis.so* bugs, see:
This patch is in RHEL3-U2 and AS2.1-U4 candidates ATM.

Comment 5 Red Hat Bugzilla 2006-02-21 19:02:35 UTC
Changed to 'CLOSED' state since 'RESOLVED' has been deprecated.

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