Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/libexec/telnetd Pass -a [srrvis'd struct sockaddr] to login, ...
details: https://anonhg.NetBSD.org/src/rev/7cf0a63e3237
branches: trunk
changeset: 571232:7cf0a63e3237
user: christos <christos%NetBSD.org@localhost>
date: Sun Nov 14 18:07:56 2004 +0000
description:
Pass -a [srrvis'd struct sockaddr] to login, so that login can record the
address where we have logged in from.
diffstat:
libexec/telnetd/sys_term.c | 25 ++++++++++++++++---------
libexec/telnetd/telnetd.c | 6 +++---
2 files changed, 19 insertions(+), 12 deletions(-)
diffs (97 lines):
diff -r 3b100decf001 -r 7cf0a63e3237 libexec/telnetd/sys_term.c
--- a/libexec/telnetd/sys_term.c Sun Nov 14 18:01:21 2004 +0000
+++ b/libexec/telnetd/sys_term.c Sun Nov 14 18:07:56 2004 +0000
@@ -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 @@
#include "pathnames.h"
#include <util.h>
+#include <vis.h>
#include <sys/cdefs.h>
@@ -611,24 +612,30 @@
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 -r 3b100decf001 -r 7cf0a63e3237 libexec/telnetd/telnetd.c
--- a/libexec/telnetd/telnetd.c Sun Nov 14 18:01:21 2004 +0000
+++ b/libexec/telnetd/telnetd.c Sun Nov 14 18:07:56 2004 +0000
@@ -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 @@
#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 @@
};
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)
Home |
Main Index |
Thread Index |
Old Index