bin/87963: [PATCH] telnetd doesn't honour if= in gettytab

Dan Ponte dcp1990 at neptune.atopia.net
Mon Oct 24 16:50:16 PDT 2005


>Number:         87963
>Category:       bin
>Synopsis:       [PATCH] telnetd doesn't honour if= in gettytab
>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:   Mon Oct 24 23:50:15 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Dan Ponte
>Release:        FreeBSD 6.0-RC1 i386
>Organization:
Unix Users Anonymous
>Environment:
System: FreeBSD styx.cox.net 6.0-RC1 FreeBSD 6.0-RC1 #23: Mon Oct 24 17:08:58 EDT 2005 root at styx.cox.net:/usr/obj/usr/src/sys/STYX i386


>Description:
	telnetd doesn't honour the if= parameter in gettytab (as documented).
>How-To-Repeat:
	Use telnetd without this patch
>Fix:
	Apply the following patch:
--cut--
--- /usr/src/contrib/telnet/telnetd/otelnetd.c	Thu Sep  1 13:35:05 2005
+++ /usr/src/contrib/telnet/telnetd/telnetd.c	Sun Oct 16 14:06:13 2005
@@ -740,6 +740,7 @@
 	char *HE;
 	char *HN;
 	char *IM;
+	char *IF;
 	int nfd;
 
 	/*
@@ -905,15 +906,41 @@
 		HE = Getstr("he", &cp);
 		HN = Getstr("hn", &cp);
 		IM = Getstr("im", &cp);
+		IF = Getstr("if", &cp);
+
 		if (HN && *HN)
 			(void) strlcpy(host_name, HN, sizeof(host_name));
-		if (IM == 0)
+		else
+			gethostname(host_name, sizeof(host_name));
+
+		if (IM == NULL)
 			IM = strdup("");
+
+		if (IF != NULL) {
+			int tfd;
+			struct stat tst;
+			char *tbf;
+
+			tfd = open(IF, O_RDONLY);
+			if (tfd == -1) {
+				IF = NULL;
+			} else {
+				fstat(tfd, &tst);
+				tbf = (char*)mmap(NULL, tst.st_size, PROT_READ,
+					0, tfd, 0);
+				putf(tbf, ptyibuf2);
+				munmap(tbf, tst.st_size);
+				close(tfd);
+				IM = "";
+			}
+		}
+
 	} else {
 		IM = strdup(DEFAULT_IM);
 		HE = 0;
 	}
 	edithost(HE, host_name);
+		
 	if (hostinfo && *IM)
 		putf(IM, ptyibuf2);
--cut--
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list