summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2004-11-14 18:07:56 +0000
committerchristos <christos@NetBSD.org>2004-11-14 18:07:56 +0000
commit8b4b693dbef757e2287066fa288d9b8d79a4e39a (patch)
tree6323c3af4945a8da1263567185333215a4f5b0cb
parent4a9bb0c8f3254878bf105f56f33e4297f4ee397b (diff)
Pass -a [srrvis'd struct sockaddr] to login, so that login can record the
address where we have logged in from.
-rw-r--r--libexec/telnetd/sys_term.c25
-rw-r--r--libexec/telnetd/telnetd.c6
2 files changed, 19 insertions, 12 deletions
diff --git a/libexec/telnetd/sys_term.c b/libexec/telnetd/sys_term.c
index 4565b7dd704..f20081fa25f 100644
--- a/libexec/telnetd/sys_term.c
+++ b/libexec/telnetd/sys_term.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sys_term.c,v 1.40 2003/09/19 05:54:46 itojun Exp $ */
+/* $NetBSD: sys_term.c,v 1.41 2004/11/14 18:07:56 christos Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)sys_term.c 8.4+1 (Berkeley) 5/30/95";
#else
-__RCSID("$NetBSD: sys_term.c,v 1.40 2003/09/19 05:54:46 itojun Exp $");
+__RCSID("$NetBSD: sys_term.c,v 1.41 2004/11/14 18:07:56 christos Exp $");
#endif
#endif /* not lint */
@@ -42,6 +42,7 @@ __RCSID("$NetBSD: sys_term.c,v 1.40 2003/09/19 05:54:46 itojun Exp $");
#include "pathnames.h"
#include <util.h>
+#include <vis.h>
#include <sys/cdefs.h>
@@ -611,24 +612,30 @@ start_login(host, autologin, name)
char defstrs[TABBUFSIZ];
#undef TABBUFSIZ
const char *loginprog = NULL;
-
+ extern struct sockaddr_storage from;
+ char buf[sizeof(from) * 4 + 1];
scrub_env();
/*
+ * -a : pass on the address of the host.
* -h : pass on name of host.
- * WARNING: -h is accepted by login if and only if
- * getuid() == 0.
+ * WARNING: -h and -a are accepted by login
+ * if and only if getuid() == 0.
* -p : don't clobber the environment (so terminal type stays set).
*
* -f : force this login, he has already been authenticated
*/
argv = addarg(0, "login");
- {
- argv = addarg(argv, "-h");
- argv = addarg(argv, host);
- }
+ argv = addarg(argv, "-a");
+ (void)strvisx(buf, (const char *)(const void *)&from, sizeof(from),
+ VIS_WHITE);
+ argv = addarg(argv, buf);
+
+ argv = addarg(argv, "-h");
+ argv = addarg(argv, host);
+
argv = addarg(argv, "-p");
#ifdef LINEMODE
/*
diff --git a/libexec/telnetd/telnetd.c b/libexec/telnetd/telnetd.c
index 737e0ccc819..078a47a5787 100644
--- a/libexec/telnetd/telnetd.c
+++ b/libexec/telnetd/telnetd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: telnetd.c,v 1.43 2003/08/07 09:46:52 agc Exp $ */
+/* $NetBSD: telnetd.c,v 1.44 2004/11/14 18:07:56 christos Exp $ */
/*
* Copyright (C) 1997 and 1998 WIDE Project.
@@ -65,7 +65,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\
#if 0
static char sccsid[] = "@(#)telnetd.c 8.4 (Berkeley) 5/30/95";
#else
-__RCSID("$NetBSD: telnetd.c,v 1.43 2003/08/07 09:46:52 agc Exp $");
+__RCSID("$NetBSD: telnetd.c,v 1.44 2004/11/14 18:07:56 christos Exp $");
#endif
#endif /* not lint */
@@ -160,13 +160,13 @@ char valid_opts[] = {
};
int family = AF_INET;
+struct sockaddr_storage from;
int
main(argc, argv)
int argc;
char *argv[];
{
- struct sockaddr_storage from;
int on = 1, fromlen;
register int ch;
#if defined(IPPROTO_IP) && defined(IP_TOS)