FreeBSD Bugzilla – Attachment 53376 Details for
Bug 80732
[patch] getty(8) and telnetd(8) ignore the 'if' option of gettytab(5) and don't print initial message from a file (by default /etc/issue) before the login prompt
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
telnetd_ext.h.patch
telnetd_ext.h.patch (text/plain), 4.60 KB, created by
Rostislav Krasny
on 2005-05-09 16:48:51 UTC
(
hide
)
Description:
telnetd_ext.h.patch
Filename:
MIME Type:
Creator:
Rostislav Krasny
Created:
2005-05-09 16:48:51 UTC
Size:
4.60 KB
patch
obsolete
>diff -ur telnetd.orig/ext.h /usr/src/contrib/telnet/telnetd/ext.h >--- telnetd.orig/ext.h Mon May 9 16:41:45 2005 >+++ /usr/src/contrib/telnet/telnetd/ext.h Mon May 9 17:01:30 2005 >@@ -112,8 +112,7 @@ > #endif > process_slc(unsigned char, unsigned char, cc_t), > ptyflush(void), >- putchr(int), >- putf(char *, char *), >+ putf(char *, char *, size_t), > recv_ayt(void), > send_do(int, int), > send_dont(int, int), >diff -ur telnetd.orig/telnetd.c /usr/src/contrib/telnet/telnetd/telnetd.c >--- telnetd.orig/telnetd.c Mon May 9 16:42:13 2005 >+++ /usr/src/contrib/telnet/telnetd/telnetd.c Mon May 9 17:01:45 2005 >@@ -42,7 +42,6 @@ > #include "telnetd.h" > #include "pathnames.h" > >-#include <sys/mman.h> > #include <err.h> > #include <libutil.h> > #include <paths.h> >@@ -740,6 +739,7 @@ > char *HE; > char *HN; > char *IM; >+ char *IF; > int nfd; > > /* >@@ -900,22 +900,40 @@ > */ > > if (getent(defent, "default") == 1) { >- char *cp=defstrs; >+ char *cp = defstrs; > > HE = Getstr("he", &cp); > HN = Getstr("hn", &cp); >- IM = Getstr("im", &cp); >- if (HN && *HN) >+ IF = Getstr("if", &cp); >+ if (HN != NULL && *HN != 0) > (void) strlcpy(host_name, HN, sizeof(host_name)); >- if (IM == 0) >- IM = strdup(""); >+ if (IF != NULL) { >+ int if_fd; >+ >+ if ((if_fd = open(IF, O_RDONLY)) != -1) { >+ struct stat if_fst; >+ >+ fstat(if_fd, &if_fst); >+ IM = malloc(if_fst.st_size + 1); >+ read(if_fd, IM, if_fst.st_size); >+ IM[if_fst.st_size] = 0; >+ close(if_fd); >+ } else { >+ IF = NULL; >+ } >+ } >+ if (IF == NULL) { >+ IM = Getstr("im", &cp); >+ if (IM == NULL) >+ IM = strdup(""); >+ } > } else { > IM = strdup(DEFAULT_IM); >- HE = 0; >+ HE = NULL; > } > edithost(HE, host_name); > if (hostinfo && *IM) >- putf(IM, ptyibuf2); >+ putf(IM, ptyibuf2, BUFSIZ); > > if (pcc) > (void) strncat(ptyibuf2, ptyip, pcc+1); >diff -ur telnetd.orig/utility.c /usr/src/contrib/telnet/telnetd/utility.c >--- telnetd.orig/utility.c Mon May 9 16:42:22 2005 >+++ /usr/src/contrib/telnet/telnetd/utility.c Mon May 9 17:01:38 2005 >@@ -66,11 +66,9 @@ > * also flush the pty input buffer (by dropping its data) if it becomes > * too full. > */ >- >- void >-ttloop() >+void >+ttloop(void) > { >- > DIAG(TD_REPORT, output_data("td: ttloop\r\n")); > if (nfrontp - nbackp > 0) { > netflush(); >@@ -393,22 +391,6 @@ > editedhost[sizeof editedhost - 1] = '\0'; > } > >-static char *putlocation; >- >-static void >-putstr(const char *s) >-{ >- >- while (*s) >- putchr(*s++); >-} >- >-void >-putchr(int cc) >-{ >- *putlocation++ = cc; >-} >- > #ifdef __FreeBSD__ > static char fmtstr[] = { "%+" }; > #else >@@ -416,11 +398,12 @@ > #endif > > void >-putf(char *cp, char *where) >+putf(char *cp, char *where, size_t where_size) > { > char *slash; > time_t t; > char db[100]; >+ char ch_str[2] = {0, 0}; > #ifdef __FreeBSD__ > static struct utsname kerninfo; > >@@ -428,19 +411,13 @@ > uname(&kerninfo); > #endif > >- putlocation = where; >- >- while (*cp) { >- if (*cp =='\n') { >- putstr("\r\n"); >- cp++; >- continue; >+ while (*cp != 0) { >+ if (*cp == '\n') { >+ strlcat(where, "\r\n", where_size); > } else if (*cp != '%') { >- putchr(*cp++); >- continue; >- } >- switch (*++cp) { >- >+ *ch_str = *cp; >+ strlcat(where, ch_str, where_size); >+ } else switch (*++cp) { > case 't': > #ifdef STREAMSPTY > /* names are like /dev/pts/2 -- we want pts/2 */ >@@ -448,46 +425,42 @@ > #else > slash = strrchr(line, '/'); > #endif >- if (slash == (char *) 0) >- putstr(line); >+ if (slash == NULL) >+ strlcat(where, line, where_size); > else >- putstr(&slash[1]); >+ strlcat(where, &slash[1], where_size); > break; >- > case 'h': >- putstr(editedhost); >+ strlcat(where, editedhost, where_size); > break; >- > case 'd': > #ifdef __FreeBSD__ > setlocale(LC_TIME, ""); > #endif > (void)time(&t); > (void)strftime(db, sizeof(db), fmtstr, localtime(&t)); >- putstr(db); >+ strlcat(where, db, where_size); > break; >- > #ifdef __FreeBSD__ > case 's': >- putstr(kerninfo.sysname); >+ strlcat(where, kerninfo.sysname, where_size); > break; >- > case 'm': >- putstr(kerninfo.machine); >+ strlcat(where, kerninfo.machine, where_size); > break; >- > case 'r': >- putstr(kerninfo.release); >+ strlcat(where, kerninfo.release, where_size); > break; >- > case 'v': >- putstr(kerninfo.version); >+ strlcat(where, kerninfo.version, where_size); > break; > #endif >- > case '%': >- putchr('%'); >+ *ch_str = '%'; >+ strlcat(where, ch_str, where_size); > break; >+ case 0: >+ return; > } > cp++; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 80732
:
53373
|
53374
|
53375
|
53376
|
53377
|
53378