Bug 126224 - [PATCH] yp_all() fails to send YP_NOMORE
[PATCH] yp_all() fails to send YP_NOMORE
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: ypserv (Show other bugs)
3.0
All Linux
medium Severity high
: ---
: ---
Assigned To: Steve Dickson
Jay Turner
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-06-17 15:04 EDT by Aaron Spangler
Modified: 2015-01-07 19:08 EST (History)
2 users (show)

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


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

  None (edit)
Description Aaron Spangler 2004-06-17 15:04:41 EDT
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 15:05:33 EDT
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 15:07:31 EDT
Created attachment 101224 [details]
ypserv-2.8-nomore.patch
Comment 5 Steve Dickson 2004-07-02 16:08:25 EDT
Created attachment 101607 [details]
Attache nomore patch
Comment 6 Steve Dickson 2004-07-02 16:08:52 EDT
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 14:07:05 EDT
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 02:07:10 EDT
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.