This patch fixes telnetd to behave exactly as getty does when if and im are encountered. If both are encountered, if= outputs before im=. Otherwise, whichever is set in gettytab is output. This patch improves upon bin/80732 and bin/23562 to make telnetd's handling of these options similar to getty's. It also makes sure that %h works inside the issue file (which requires the putf() to occur after the hostname editing is complete). Fix: Apply the following patch to src/contrib/telnet/telnetd/telnetd.c. Thanks. -Dan--hVfq98OleKzYfHvLQiilyG1XY6lNOQcfnrzVWKZZVDQ2L4vE Content-Type: text/plain; name="telnetd.c.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="telnetd.c.diff" --- telnetd.c.orig 2009-08-03 04:13:06.000000000 -0400 +++ telnetd.c 2010-07-24 19:58:11.000000000 -0400 @@ -742,6 +742,8 @@ char *HE; char *HN; char *IM; + char *IF = NULL; + char issbuf[BUFSIZ]; int nfd; /* @@ -907,17 +909,47 @@ 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(""); + + } else { IM = strdup(DEFAULT_IM); HE = 0; } edithost(HE, host_name); + + bzero(issbuf, sizeof(issbuf)); + + 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); + strlcpy(issbuf, tbf, sizeof(issbuf)); + munmap(tbf, tst.st_size); + close(tfd); + } + } + if (hostinfo && *IM) - putf(IM, ptyibuf2); + strlcat(issbuf, IM, sizeof(issbuf)); + + putf(issbuf, ptyibuf2); if (pcc) (void) strncat(ptyibuf2, ptyip, pcc+1);
For bugs matching the following criteria: Status: In Progress Changed: (is less than) 2014-06-01 Reset to default assignee and clear in-progress tags. Mail being skipped
Keyword: patch or patch-ready – in lieu of summary line prefix: [patch] * bulk change for the keyword * summary lines may be edited manually (not in bulk). Keyword descriptions and search interface: <https://bugs.freebsd.org/bugzilla/describekeywords.cgi>