summaryrefslogtreecommitdiff
path: root/libexec/telnetd
diff options
context:
space:
mode:
authorPoul-Henning Kamp <phk@FreeBSD.org>1998-04-26 06:51:36 +0000
committerPoul-Henning Kamp <phk@FreeBSD.org>1998-04-26 06:51:36 +0000
commit5708bd42282d5199f2fcf8d2f836fbbdd7d068b1 (patch)
tree55c6b06d2ba05091114f118b8ba851a5ec126935 /libexec/telnetd
parent4cb3dec38f372e7458999e474c3fed49260472f4 (diff)
Notes
Diffstat (limited to 'libexec/telnetd')
-rw-r--r--libexec/telnetd/telnetd.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/libexec/telnetd/telnetd.c b/libexec/telnetd/telnetd.c
index 2944188d6e81..7018fdc12dae 100644
--- a/libexec/telnetd/telnetd.c
+++ b/libexec/telnetd/telnetd.c
@@ -42,7 +42,7 @@ static const char copyright[] =
static char sccsid[] = "@(#)telnetd.c 8.2 (Berkeley) 12/15/93";
#endif
static const char rcsid[] =
- "$Id$";
+ "$Id: telnetd.c,v 1.13 1997/12/03 07:16:05 charnier Exp $";
#endif /* not lint */
#include "telnetd.h"
@@ -60,6 +60,8 @@ static const char rcsid[] =
#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 @@ telnet(f, p, host)
char *HE;
char *HN;
char *IM;
+ char *IF;
+ char *if_buf;
+ int if_fd;
+ struct stat statbuf;
+
void netflush();
/*
@@ -1090,8 +1097,11 @@ telnet(f, p, host)
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,6 +1111,14 @@ telnet(f, p, host)
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);