Bug 126224 - [PATCH] yp_all() fails to send YP_NOMORE
Summary: [PATCH] yp_all() fails to send YP_NOMORE
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: ypserv
Version: 3.0
Hardware: All
OS: Linux
medium
high
Target Milestone: ---
Assignee: Steve Dickson
QA Contact: Jay Turner
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-06-17 19:04 UTC by Aaron Spangler
Modified: 2015-01-08 00:08 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-09-02 06:07:10 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
ypserv-2.8-nomore.patch (780 bytes, patch)
2004-06-17 19:07 UTC, Aaron Spangler
no flags Details | Diff
Attache nomore patch (1.29 KB, text/plain)
2004-07-02 20:08 UTC, Steve Dickson
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2004:394 0 normal SHIPPED_LIVE Updated ypserv package 2004-09-02 04:00:00 UTC

Description Aaron Spangler 2004-06-17 19:04:41 UTC
Description of problem:

Suns ypserver sends the YP_NOMORE status at the end of yp_all map 
transfers (such as ypcat passwd).  Some programs rely on the final
status message to ensure a complete map transfer.  

An example of such program is a perl module called Net::NIS.

Comparing packet sniffs when a nis client is bound to a Solaris ypserv
versus Linux ypserv shows the last record is missing.


Version-Release number of selected component (if applicable):
using current redhat ypserv-2.8-6.src.rpm

How reproducible:
Every Time

Steps to Reproduce:
1. Setup Solaris & Linux Slave NIS servers.
2. Select a small nis map (such as auto.master)
3. Start packet sniffer when nis client is bound to Solaris ypserv
4. Perform 'ypcat auto.master' on client (or similar map)
5. Stop packet sniffer
6. rebind client to Linux box
7. Restart packet sniffer
8. Perform 'ypcat auto.master' again.
9. Stop sniffer
10. Compare the responses to 'yp_all' for the auto.master map
11. Notice the Linux one is missing the final record.
      
Actual results:
 Remote Procedure Call
  Yellow Pages Service
    Program Version: 2
    V2 Procedure: ALL (8)
    More: Yes
    Status: YP_TRUE (1)
    Value: auto.home -rw,nosuid,wsize=4096,rsize=4096
        length: 42
        contents: auto.home -rw,nosuid,wsize=4096,rsize=4096
        fill bytes: opaque data
    Key: /home
        length: 5
        contents: /home
        fill bytes: opaque data
    More: Yes
    Status: YP_TRUE (1)
    Value: auto.direct -ro,nosuid,wsize=4096,rsize=4096
        length: 44
        contents: auto.direct -ro,nosuid,wsize=4096,rsize=4096
    Key: /-
        length: 2
        contents: /-
        fill bytes: opaque data
    More: No

Expected results:
 Remote Procedure Call
  Yellow Pages Service
    Program Version: 2
    V2 Procedure: ALL (8)
    More: Yes
    Status: YP_TRUE (1)
    Value: auto.home -rw,nosuid,wsize=4096,rsize=4096
        length: 42
        contents: auto.home -rw,nosuid,wsize=4096,rsize=4096
        fill bytes: opaque data
    Key: /home
        length: 5
        contents: /home
        fill bytes: opaque data
    More: Yes
    Status: YP_TRUE (1)
    Value: auto.direct -ro,nosuid,wsize=4096,rsize=4096
        length: 44
        contents: auto.direct -ro,nosuid,wsize=4096,rsize=4096
    Key: /-
        length: 2
        contents: /-
        fill bytes: opaque data
    More: Yes
    Status: YP_NOMORE (2)
    Value: auto.direct -ro,nosuid,wsize=4096,rsize=4096
        length: 44
        contents: auto.direct -ro,nosuid,wsize=4096,rsize=4096
    Key: /-
        length: 2
        contents: /-
        fill bytes: opaque data
    More: No

Additional info:
none

Comment 1 Aaron Spangler 2004-06-17 19:05:33 UTC
The ypserv-2.8 code curently attempts to send the YP_NOMORE status
after the last key/value pair is sent, however due to an off by one
error in ypserv/ypserv_xdr.c, the last status record is suppressed.


Comment 2 Aaron Spangler 2004-06-17 19:07:31 UTC
Created attachment 101224 [details]
ypserv-2.8-nomore.patch

Comment 5 Steve Dickson 2004-07-02 20:08:25 UTC
Created attachment 101607 [details]
Attache nomore patch

Comment 6 Steve Dickson 2004-07-02 20:08:52 UTC
At first I was not too keen on adding an extra ypall entry just to
set the YP_NOMORE status, so I looked into changing ypserver
to return the YP_NOMORE status on the last ypall entry that had
real data (i.e. exactly how SUN does it).

It turns out this approach breaks the yp_all() glibc routine since
it only expects ypall entries with a YP_TRUE status to contain
data. So the ypall entries (that contained data) but had a YP_NOMORE
status were being dropped.

So attached is a patch that does the same thing as the original patch
but makes sure the YP_NOMORE entries contain zeros instead of
garbage. 

Comment 7 Aaron Spangler 2004-07-08 18:07:05 UTC
Tried the augmented patch supplied by Steve.  Tried in pre-prod
environment.  Works great!  Exactly what we are looking for.  Thanks. 

Comment 8 John Flanagan 2004-09-02 06:07:10 UTC
An errata has been issued which should help the problem 
described in this bug report. This report is therefore being 
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files, 
please follow the link below. You may reopen this bug report 
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2004-394.html



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