[PATCH] non blocking RPC-code, found reproducable error
Martin Blapp
mb at imp.ch
Sat May 17 08:43:22 PDT 2003
Hi all,
Here is a patch to solve the problems with amd(8) and mountd(8)
(and maybe other programs):
The patch can also be found here.
http://people.freebsd.org/~mbr/patches/xdr_nonblock_eof_fix.diff
------------------------------------------------------------------------------
Remove the special treatment of non-blocking mode in
xdrrec_eof(). This broke seriously reading serialzed
xdr records. The end of a request could sometimes not
be regognized.
Initialize in_reclen and in_received in a second case.
Return always FALSE in set_input_fragment() for non-blocking
mode.
--- lib/libc/xdr/xdr_rec.c.orig Thu Feb 27 13:40:01 2003
+++ lib/libc/xdr/xdr_rec.c Sat May 17 17:20:24 2003
@@ -491,14 +491,6 @@
RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
enum xprt_stat xstat;
- if (rstrm->nonblock) {
- if (__xdrrec_getrec(xdrs, &xstat, FALSE))
- return FALSE;
- if (!rstrm->in_haveheader && xstat == XPRT_IDLE)
- return TRUE;
- return FALSE;
- }
-
while (rstrm->fbtbc > 0 || (! rstrm->last_frag)) {
if (! skip_input_bytes(rstrm, rstrm->fbtbc))
return (TRUE);
@@ -617,6 +609,7 @@
}
*statp = XPRT_MOREREQS;
+ rstrm->in_reclen = rstrm->in_received = 0;
return FALSE;
}
@@ -719,6 +712,8 @@
{
u_int32_t header;
+ if (rstrm->nonblock)
+ return FALSE;
if (! get_input_bytes(rstrm, (char *)(void *)&header, sizeof(header)))
return (FALSE);
header = ntohl(header);
------------------------------------------------------------------------------
Martin
Martin Blapp, <mb at imp.ch> <mbr at FreeBSD.org>
------------------------------------------------------------------
ImproWare AG, UNIXSP & ISP, Zurlindenstrasse 29, 4133 Pratteln, CH
Phone: +41 61 826 93 00 Fax: +41 61 826 93 01
PGP: <finger -l mbr at freebsd.org>
PGP Fingerprint: B434 53FC C87C FE7B 0A18 B84C 8686 EF22 D300 551E
------------------------------------------------------------------
More information about the freebsd-current
mailing list