Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Jan 2000 05:36:05 +0900 (JST)
From:      Hajimu UMEMOTO <ume@mahoroba.org>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/16086: Inetd internal IDENT is not work well.
Message-ID:  <200001122036.e0CKa5J60957@peace.mahoroba.org>

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


>Number:         16086
>Category:       bin
>Synopsis:       Inetd internal IDENT is not work well.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jan 12 12:40:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     Hajimu UMEMOTO
>Release:        FreeBSD 4.0-CURRENT i386
>Organization:
Internet Mutual Aid Society, YOKOHAMA
>Environment:

	3.4-RELEASE or later

>Description:

	When lookup IDENT, inetd internal IDENT often reply ERROR.
	It seems OK with sendmail's query or libident's query.
	But, it seems that inetd cannot treat libwrap's query.
	It is because, libwrap's query is often separated by 2
	packets.

>How-To-Repeat:

	IDENT lookup by libwrap.

>Fix:

	Please apply following patch:

--- usr.sbin/inetd/builtins.c.orig	Sat Aug 28 10:16:34 1999
+++ usr.sbin/inetd/builtins.c	Thu Jan 13 03:45:58 2000
@@ -345,6 +345,7 @@
 	char buf[BUFSIZE], *cp = NULL, *p, **av, *osname = NULL;
 	int len, c, fflag = 0, nflag = 0, rflag = 0, argc = 0;
 	u_short lport, fport;
+	int bufsiz = sizeof(buf) - 1, size = 0;
 
 	inetd_setproctitle(sep->se_service, s);
 	/*
@@ -411,18 +412,22 @@
 	 * "local_port , foreign_port\r\n" (with local being the
 	 * server's port and foreign being the client's.)
 	 */
-	FD_ZERO(&fdset);
-	FD_SET(s, &fdset);
-	if (select(s + 1, &fdset, NULL, NULL, &tv) == -1)
-		iderror(0, 0, s, errno);
-	if (ioctl(s, FIONREAD, &len) == -1)
-		iderror(0, 0, s, errno);
-	if (len >= sizeof(buf))
-		len = sizeof(buf) - 1;
-	len = read(s, buf, len);
-	if (len == -1)
-		iderror(0, 0, s, errno);
-	buf[len] = '\0';
+	do {
+		FD_ZERO(&fdset);
+		FD_SET(s, &fdset);
+		if (select(s + 1, &fdset, NULL, NULL, &tv) == -1)
+			iderror(0, 0, s, errno);
+		if (ioctl(s, FIONREAD, &len) == -1)
+			iderror(0, 0, s, errno);
+		if (len > bufsiz)
+			len = bufsiz;
+		len = read(s, &buf[size], len);
+		if (len == -1)
+			iderror(0, 0, s, errno);
+		bufsiz -= len;
+		size += len;
+	} while ((size < 1 || buf[size - 1] != '\n') && bufsiz > 0);
+	buf[size] = '\0';
 	if (sscanf(buf, "%hu , %hu", &lport, &fport) != 2)
 		iderror(0, 0, s, 0);
 	if (!rflag) /* Send HIDDEN-USER immediately if not "real" */

>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




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