Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/libexec/telnetd Make 'if' capability from gettytab work. *sh...
details: https://anonhg.NetBSD.org/src/rev/5ed8b5de5bde
branches: trunk
changeset: 480467:5ed8b5de5bde
user: ad <ad%NetBSD.org@localhost>
date: Thu Jan 13 13:11:31 2000 +0000
description:
Make 'if' capability from gettytab work. *shudder*.
diffstat:
libexec/telnetd/ext.h | 6 ++++--
libexec/telnetd/telnetd.c | 32 +++++++++++++++++++++++---------
libexec/telnetd/utility.c | 8 +++++---
3 files changed, 32 insertions(+), 14 deletions(-)
diffs (146 lines):
diff -r 08eebae30747 -r 5ed8b5de5bde libexec/telnetd/ext.h
--- a/libexec/telnetd/ext.h Thu Jan 13 12:43:19 2000 +0000
+++ b/libexec/telnetd/ext.h Thu Jan 13 13:11:31 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ext.h,v 1.9 1999/02/12 05:30:11 dean Exp $ */
+/* $NetBSD: ext.h,v 1.10 2000/01/13 13:11:31 ad Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -126,7 +126,6 @@
#endif
ptyflush P((void)),
putchr P((int)),
- putf P((char *, char *)),
recv_ayt P((void)),
send_do P((int, int)),
send_dont P((int, int)),
@@ -146,6 +145,9 @@
tty_binaryin P((int)),
tty_binaryout P((int));
+extern char *
+ putf P((char *, char *));
+
extern int
end_slc P((unsigned char **)),
getnpty P((void)),
diff -r 08eebae30747 -r 5ed8b5de5bde libexec/telnetd/telnetd.c
--- a/libexec/telnetd/telnetd.c Thu Jan 13 12:43:19 2000 +0000
+++ b/libexec/telnetd/telnetd.c Thu Jan 13 13:11:31 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: telnetd.c,v 1.19 1999/12/16 06:00:24 itojun Exp $ */
+/* $NetBSD: telnetd.c,v 1.20 2000/01/13 13:11:31 ad Exp $ */
/*
* Copyright (C) 1997 and 1998 WIDE Project.
@@ -69,7 +69,7 @@
#if 0
static char sccsid[] = "@(#)telnetd.c 8.4 (Berkeley) 5/30/95";
#else
-__RCSID("$NetBSD: telnetd.c,v 1.19 1999/12/16 06:00:24 itojun Exp $");
+__RCSID("$NetBSD: telnetd.c,v 1.20 2000/01/13 13:11:31 ad Exp $");
#endif
#endif /* not lint */
@@ -81,6 +81,8 @@
#include <err.h>
#include <termcap.h>
+#include <limits.h>
+
#define P __P
#if defined(_SC_CRAY_SECURE_SYS) && !defined(SCM_SECURITY)
@@ -136,7 +138,7 @@
long ptyibufbuf[BUFSIZ/sizeof(long)+1];
char *ptyibuf = ((char *)&ptyibufbuf[1])-1;
char *ptyip = ((char *)&ptyibufbuf[1])-1;
-char ptyibuf2[BUFSIZ];
+char ptyibuf2[BUFSIZ*4];
unsigned char ctlbuf[BUFSIZ];
struct strbuf strbufc, strbufd;
@@ -953,9 +955,7 @@
char defent[TABBUFSIZ];
char defstrs[TABBUFSIZ];
#undef TABBUFSIZ
- char *HE;
- char *HN;
- char *IM;
+ char *HE, *HN, *IM, *IF, *ptyibuf2ptr;
int nfd;
/*
@@ -1153,6 +1153,7 @@
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 (IM == 0)
@@ -1162,11 +1163,24 @@
HE = 0;
}
edithost(HE, host_name);
- if (hostinfo && *IM)
- putf(IM, ptyibuf2);
+ ptyibuf2ptr = ptyibuf2;
+ if (hostinfo) {
+ if (IF) {
+ char buf[_POSIX2_LINE_MAX];
+ FILE *fd;
+
+ if ((fd = fopen(IF, "r")) != NULL) {
+ while (fgets(buf, sizeof(buf) - 1, fd) != NULL)
+ ptyibuf2ptr = putf(buf, ptyibuf2ptr);
+ fclose(fd);
+ }
+ }
+ if (*IM)
+ ptyibuf2ptr = putf(IM, ptyibuf2ptr);
+ }
if (pcc)
- (void) strncat(ptyibuf2, ptyip, pcc+1);
+ strncpy(ptyibuf2ptr, ptyip, pcc+1);
ptyip = ptyibuf2;
pcc = strlen(ptyip);
#ifdef LINEMODE
diff -r 08eebae30747 -r 5ed8b5de5bde libexec/telnetd/utility.c
--- a/libexec/telnetd/utility.c Thu Jan 13 12:43:19 2000 +0000
+++ b/libexec/telnetd/utility.c Thu Jan 13 13:11:31 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: utility.c,v 1.12 1997/10/16 06:55:38 mikel Exp $ */
+/* $NetBSD: utility.c,v 1.13 2000/01/13 13:11:32 ad Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)utility.c 8.4 (Berkeley) 5/30/95";
#else
-__RCSID("$NetBSD: utility.c,v 1.12 1997/10/16 06:55:38 mikel Exp $");
+__RCSID("$NetBSD: utility.c,v 1.13 2000/01/13 13:11:32 ad Exp $");
#endif
#endif /* not lint */
@@ -417,7 +417,7 @@
static char fmtstr[] = { "%l:%M\
%p on %A, %d %B %Y" };
- void
+ char *
putf(cp, where)
register char *cp;
char *where;
@@ -483,6 +483,8 @@
}
cp++;
}
+
+ return (putlocation);
}
#ifdef DIAGNOSTICS
Home |
Main Index |
Thread Index |
Old Index