Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Apr 1998 15:14:29 -0400 (EDT)
From:      init@risen.org
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   bin/6365: Patch to allow telnetd to recognize if gettytab flag
Message-ID:  <199804201914.PAA11230@easton-15.student.umd.edu>

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

>Number:         6365
>Category:       bin
>Synopsis:       Patch to allow telnetd to recognize if gettytab flag
>Confidential:   yes
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Apr 20 12:20:01 PDT 1998
>Last-Modified:
>Originator:     Jason Garman <init@risen.org>
>Organization:
>Release:        FreeBSD 2.2.5-RELEASE i386
>Environment:

>Description:

telnetd does not recognize the if (display file before login) gettytab
flag.

>How-To-Repeat:

add an if=<filename> entry to the gettytab database and telnet into your
machine.  It is ignored.

>Fix:
	
Patch for 2.2.5 telnetd follows:

--- telnetd.c.old       Mon Apr 20 14:47:38 1998
+++ telnetd.c   Mon Apr 20 15:02:49 1998
@@ -60,6 +60,8 @@
 #include <err.h>
 #include <arpa/inet.h>
 
+#include <sys/mman.h>
+
 #if    defined(_SC_CRAY_SECURE_SYS)
 #include <sys/sysv.h>
 #include <sys/secdev.h>
@@ -892,6 +894,11 @@
        char *HE;
        char *HN;
        char *IM;
+       char *IF;
+       char *if_buf;
+       int if_fd;
+       struct stat statbuf;
+
        void netflush();
 
        /*
@@ -1090,8 +1097,11 @@
                HE = getstr("he", &cp);
                HN = getstr("hn", &cp);
                IM = getstr("im", &cp);
+               IF = getstr("if", &cp);
                if (HN && *HN)
                        (void) strcpy(host_name, HN);
+               if (IF && (if_fd = open(IF, O_RDONLY, 000)) != -1)
+                       IM = 0;
                if (IM == 0)
                        IM = "";
        } else {
@@ -1101,7 +1111,14 @@
        edithost(HE, host_name);
        if (hostinfo && *IM)
                putf(IM, ptyibuf2);
-
+       else if (IF && if_fd != -1) {
+               fstat (if_fd, &statbuf);
+               if_buf = (char *) mmap (0, statbuf.st_size, PROT_READ, 0, if_fd, 0);
+               putf(if_buf, ptyibuf2);
+               munmap (if_buf, statbuf.st_size);
+               close (if_fd);
+       }
+
        if (pcc)
                (void) strncat(ptyibuf2, ptyip, pcc+1);
        ptyip = ptyibuf2;

>Audit-Trail:
>Unformatted:
no

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?199804201914.PAA11230>