mirror of
https://github.com/sheumann/telnetd.git
synced 2024-11-22 01:31:54 +00:00
Revive support for /etc/issue, lost due revision 81963.
Obtained from: Juniper Networks, Inc. git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@262673 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
This commit is contained in:
parent
839f5deaca
commit
2c30da6c4a
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user