summaryrefslogtreecommitdiffstats
path: root/contrib/telnet
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2014-03-02 00:47:47 +0000
committermarcel <marcel@FreeBSD.org>2014-03-02 00:47:47 +0000
commit97ad1f3cd15b984e3fe85b74693a1dd47e6e9675 (patch)
tree9cb36361afb6cba8fd9bafb841edb92f6a05b8d8 /contrib/telnet
parent315bf51cb192476ec57fca90d477ff17d28b8020 (diff)
downloadFreeBSD-src-97ad1f3cd15b984e3fe85b74693a1dd47e6e9675.zip
FreeBSD-src-97ad1f3cd15b984e3fe85b74693a1dd47e6e9675.tar.gz
Revive support for /etc/issue, lost due revision 81963.
Obtained from: Juniper Networks, Inc.
Diffstat (limited to 'contrib/telnet')
-rw-r--r--contrib/telnet/telnetd/telnetd.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/contrib/telnet/telnetd/telnetd.c b/contrib/telnet/telnetd/telnetd.c
index 938f853..454a377 100644
--- a/contrib/telnet/telnetd/telnetd.c
+++ b/contrib/telnet/telnetd/telnetd.c
@@ -740,6 +740,10 @@ telnet(int f, int p, char *host)
char *HE;
char *HN;
char *IM;
+ char *IF;
+ char *if_buf;
+ int if_fd = -1;
+ struct stat statbuf;
int nfd;
/*
@@ -905,8 +909,13 @@ telnet(int f, int p, char *host)
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 (IF) {
+ if_fd = open(IF, O_RDONLY, 000);
+ IM = 0;
+ }
if (IM == 0)
IM = strdup("");
} else {
@@ -916,6 +925,16 @@ telnet(int f, int p, char *host)
edithost(HE, host_name);
if (hostinfo && *IM)
putf(IM, ptyibuf2);
+ if (IF && if_fd != -1) {
+ if(fstat (if_fd, &statbuf)!=-1) {
+ if (statbuf.st_size > 0) {
+ 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);
OpenPOWER on IntegriCloud