Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 17 May 2003 17:43:14 +0200 (CEST)
From:      Martin Blapp <mb@imp.ch>
To:        Dan Nelson <dnelson@allantgroup.com>, "" <current@freebsd.org>
Cc:        fvdl@netbsd.org
Subject:   [PATCH] non blocking RPC-code, found reproducable error
Message-ID:  <20030517172756.L1023@cvs.imp.ch>

next in thread | raw e-mail | index | archive | help

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@imp.ch> <mbr@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@freebsd.org>
PGP Fingerprint: B434 53FC C87C FE7B 0A18 B84C 8686 EF22 D300 551E
------------------------------------------------------------------



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030517172756.L1023>