[Midnightbsd-cvs] src [11119] trunk/contrib/telnet: sync up telnet code from freebsd

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Tue Jun 19 15:11:08 EDT 2018


Revision: 11119
          http://svnweb.midnightbsd.org/src/?rev=11119
Author:   laffer1
Date:     2018-06-19 15:11:07 -0400 (Tue, 19 Jun 2018)
Log Message:
-----------
sync up telnet code from freebsd

Modified Paths:
--------------
    trunk/contrib/telnet/libtelnet/pk.c
    trunk/contrib/telnet/telnet/commands.c
    trunk/contrib/telnet/telnetd/authenc.c
    trunk/contrib/telnet/telnetd/defs.h
    trunk/contrib/telnet/telnetd/ext.h
    trunk/contrib/telnet/telnetd/global.c
    trunk/contrib/telnet/telnetd/pathnames.h
    trunk/contrib/telnet/telnetd/slc.c
    trunk/contrib/telnet/telnetd/state.c
    trunk/contrib/telnet/telnetd/sys_term.c
    trunk/contrib/telnet/telnetd/telnetd.8
    trunk/contrib/telnet/telnetd/telnetd.c
    trunk/contrib/telnet/telnetd/telnetd.h
    trunk/contrib/telnet/telnetd/termstat.c
    trunk/contrib/telnet/telnetd/utility.c

Modified: trunk/contrib/telnet/libtelnet/pk.c
===================================================================
--- trunk/contrib/telnet/libtelnet/pk.c	2018-06-19 19:10:26 UTC (rev 11118)
+++ trunk/contrib/telnet/libtelnet/pk.c	2018-06-19 19:11:07 UTC (rev 11119)
@@ -30,7 +30,7 @@
 
 #include <sys/cdefs.h>
 
-__FBSDID("$FreeBSD: stable/10/contrib/telnet/libtelnet/pk.c 189092 2009-02-26 21:43:15Z ed $");
+__FBSDID("$FreeBSD: stable/10/contrib/telnet/libtelnet/pk.c 305552 2016-09-07 18:22:08Z dim $");
 
 /* public key routines */
 /* functions:
@@ -164,7 +164,7 @@
         MINT *pk = mp_itom(0);
         MINT *sk = mp_itom(0);
         MINT *tmp;
-        MINT *base = mp_itom(BASE);
+        MINT *base = mp_itom((short)BASE);
         MINT *root = mp_itom(PROOT);
         MINT *modulus = mp_xtom(HEXMODULUS);
         short r;

Modified: trunk/contrib/telnet/telnet/commands.c
===================================================================
--- trunk/contrib/telnet/telnet/commands.c	2018-06-19 19:10:26 UTC (rev 11118)
+++ trunk/contrib/telnet/telnet/commands.c	2018-06-19 19:11:07 UTC (rev 11119)
@@ -37,7 +37,7 @@
 #endif
 #endif
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: stable/10/contrib/telnet/telnet/commands.c 275508 2014-12-05 12:23:29Z ngie $");
+__FBSDID("$FreeBSD: stable/10/contrib/telnet/telnet/commands.c 305552 2016-09-07 18:22:08Z dim $");
 
 #include <sys/param.h>
 #include <sys/un.h>
@@ -112,7 +112,7 @@
 static int setmod(int);
 static int clearmode(int);
 static int modehelp(void);
-static int sourceroute(struct addrinfo *, char *, char **, int *, int *, int *);
+static int sourceroute(struct addrinfo *, char *, unsigned char **, int *, int *, int *);
 
 typedef struct {
 	const char *name;	/* command name */
@@ -2171,7 +2171,7 @@
 int
 tn(int argc, char *argv[])
 {
-    char *srp = 0;
+    unsigned char *srp = 0;
     int proto, opt;
     int srlen;
     int srcroute = 0, result;
@@ -2844,10 +2844,10 @@
  *		setsockopt, as socket protocol family.
  */
 static int
-sourceroute(struct addrinfo *ai, char *arg, char **cpp, int *lenp, int *protop, int *optp)
+sourceroute(struct addrinfo *ai, char *arg, unsigned char **cpp, int *lenp, int *protop, int *optp)
 {
 	static char buf[1024 + ALIGNBYTES];	/*XXX*/
-	char *cp, *cp2, *lsrp, *ep;
+	unsigned char *cp, *cp2, *lsrp, *ep;
 	struct sockaddr_in *_sin;
 #ifdef INET6
 	struct sockaddr_in6 *sin6;

Modified: trunk/contrib/telnet/telnetd/authenc.c
===================================================================
--- trunk/contrib/telnet/telnetd/authenc.c	2018-06-19 19:10:26 UTC (rev 11118)
+++ trunk/contrib/telnet/telnetd/authenc.c	2018-06-19 19:11:07 UTC (rev 11119)
@@ -37,7 +37,7 @@
 #endif
 #endif
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: stable/10/contrib/telnet/telnetd/authenc.c 114630 2003-05-04 02:54:49Z obrien $");
 
 #ifdef	AUTHENTICATION
 #ifdef	ENCRYPTION

Modified: trunk/contrib/telnet/telnetd/defs.h
===================================================================
--- trunk/contrib/telnet/telnetd/defs.h	2018-06-19 19:10:26 UTC (rev 11118)
+++ trunk/contrib/telnet/telnetd/defs.h	2018-06-19 19:11:07 UTC (rev 11119)
@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)defs.h	8.1 (Berkeley) 6/4/93
- * $FreeBSD$
+ * $FreeBSD: stable/10/contrib/telnet/telnetd/defs.h 82497 2001-08-29 14:16:17Z markm $
  */
 
 /*

Modified: trunk/contrib/telnet/telnetd/ext.h
===================================================================
--- trunk/contrib/telnet/telnetd/ext.h	2018-06-19 19:10:26 UTC (rev 11118)
+++ trunk/contrib/telnet/telnetd/ext.h	2018-06-19 19:11:07 UTC (rev 11119)
@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)ext.h	8.2 (Berkeley) 12/15/93
- * $FreeBSD$
+ * $FreeBSD: stable/10/contrib/telnet/telnetd/ext.h 184935 2008-11-13 19:05:27Z ed $
  */
 
 /*

Modified: trunk/contrib/telnet/telnetd/global.c
===================================================================
--- trunk/contrib/telnet/telnetd/global.c	2018-06-19 19:10:26 UTC (rev 11118)
+++ trunk/contrib/telnet/telnetd/global.c	2018-06-19 19:11:07 UTC (rev 11119)
@@ -37,7 +37,7 @@
 #endif /* not lint */
 #endif
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: stable/10/contrib/telnet/telnetd/global.c 114630 2003-05-04 02:54:49Z obrien $");
 
 /*
  * Allocate global variables.  We do this

Modified: trunk/contrib/telnet/telnetd/pathnames.h
===================================================================
--- trunk/contrib/telnet/telnetd/pathnames.h	2018-06-19 19:10:26 UTC (rev 11118)
+++ trunk/contrib/telnet/telnetd/pathnames.h	2018-06-19 19:11:07 UTC (rev 11119)
@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)pathnames.h	8.1 (Berkeley) 6/4/93
- * $FreeBSD$
+ * $FreeBSD: stable/10/contrib/telnet/telnetd/pathnames.h 81965 2001-08-20 12:28:40Z markm $
  */
 
 #if BSD > 43

Modified: trunk/contrib/telnet/telnetd/slc.c
===================================================================
--- trunk/contrib/telnet/telnetd/slc.c	2018-06-19 19:10:26 UTC (rev 11118)
+++ trunk/contrib/telnet/telnetd/slc.c	2018-06-19 19:11:07 UTC (rev 11119)
@@ -37,7 +37,7 @@
 #endif
 #endif
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: stable/10/contrib/telnet/telnetd/slc.c 114630 2003-05-04 02:54:49Z obrien $");
 
 #include "telnetd.h"
 

Modified: trunk/contrib/telnet/telnetd/state.c
===================================================================
--- trunk/contrib/telnet/telnetd/state.c	2018-06-19 19:10:26 UTC (rev 11118)
+++ trunk/contrib/telnet/telnetd/state.c	2018-06-19 19:11:07 UTC (rev 11119)
@@ -37,7 +37,7 @@
 #endif
 #endif
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: stable/10/contrib/telnet/telnetd/state.c 241021 2012-09-28 07:51:30Z kevlo $");
 
 #include <stdarg.h>
 #include "telnetd.h"
@@ -1600,8 +1600,10 @@
 	char *buf;
 
 	va_start(args, format);
-	if ((len = vasprintf(&buf, format, args)) == -1)
+	if ((len = vasprintf(&buf, format, args)) == -1) {
+		va_end(args);
 		return -1;
+	}
 	output_datalen(buf, len);
 	va_end(args);
 	free(buf);

Modified: trunk/contrib/telnet/telnetd/sys_term.c
===================================================================
--- trunk/contrib/telnet/telnetd/sys_term.c	2018-06-19 19:10:26 UTC (rev 11118)
+++ trunk/contrib/telnet/telnetd/sys_term.c	2018-06-19 19:11:07 UTC (rev 11119)
@@ -1,4 +1,4 @@
- /*
+/*
  * Copyright (c) 1989, 1993
  *	The Regents of the University of California.  All rights reserved.
  *
@@ -37,7 +37,7 @@
 #endif
 #endif
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: stable/10/contrib/telnet/telnetd/sys_term.c 309642 2016-12-06 18:52:18Z glebius $");
 
 #include <sys/types.h>
 #include <sys/tty.h>
@@ -46,6 +46,8 @@
 
 #include "telnetd.h"
 #include "pathnames.h"
+#include "types.h"
+#include "baud.h"
 
 #ifdef	AUTHENTICATION
 #include <libtelnet/auth.h>
@@ -743,56 +745,6 @@
 #endif
 }
 
-/*
- * Try to guess whether speeds are "encoded" (4.2BSD) or just numeric (4.4BSD).
- */
-#if B4800 != 4800
-#define	DECODE_BAUD
-#endif
-
-#ifdef	DECODE_BAUD
-
-/*
- * A table of available terminal speeds
- */
-struct termspeeds {
-	int	speed;
-	int	value;
-} termspeeds[] = {
-	{ 0,      B0 },      { 50,    B50 },    { 75,     B75 },
-	{ 110,    B110 },    { 134,   B134 },   { 150,    B150 },
-	{ 200,    B200 },    { 300,   B300 },   { 600,    B600 },
-	{ 1200,   B1200 },   { 1800,  B1800 },  { 2400,   B2400 },
-	{ 4800,   B4800 },
-#ifdef	B7200
-	{ 7200,  B7200 },
-#endif
-	{ 9600,   B9600 },
-#ifdef	B14400
-	{ 14400,  B14400 },
-#endif
-#ifdef	B19200
-	{ 19200,  B19200 },
-#endif
-#ifdef	B28800
-	{ 28800,  B28800 },
-#endif
-#ifdef	B38400
-	{ 38400,  B38400 },
-#endif
-#ifdef	B57600
-	{ 57600,  B57600 },
-#endif
-#ifdef	B115200
-	{ 115200, B115200 },
-#endif
-#ifdef	B230400
-	{ 230400, B230400 },
-#endif
-	{ -1,     0 }
-};
-#endif	/* DECODE_BAUD */
-
 void
 tty_tspeed(int val)
 {
@@ -1026,7 +978,11 @@
 start_login(char *host undef1, int autologin undef1, char *name undef1)
 {
 	char **argv;
+	char *user;
 
+	user = getenv("USER");
+	user = (user != NULL) ? strdup(user) : NULL;
+
 	scrub_env();
 
 	/*
@@ -1160,9 +1116,9 @@
 # endif
 	} else
 #endif
-	if (getenv("USER")) {
+	if (user != NULL) {
  		argv = addarg(argv, "--");
-		argv = addarg(argv, getenv("USER"));
+		argv = addarg(argv, user);
 #if	defined(LOGIN_ARGS) && defined(NO_LOGIN_P)
 		{
 			char **cpp;
@@ -1170,17 +1126,6 @@
 				argv = addarg(argv, *cpp);
 		}
 #endif
-		/*
-		 * Assume that login will set the USER variable
-		 * correctly.  For SysV systems, this means that
-		 * USER will no longer be set, just LOGNAME by
-		 * login.  (The problem is that if the auto-login
-		 * fails, and the user then specifies a different
-		 * account name, he can get logged in with both
-		 * LOGNAME and USER in his environment, but the
-		 * USER value will be wrong.
-		 */
-		unsetenv("USER");
 	}
 #ifdef	AUTHENTICATION
 #if	defined(NO_LOGIN_F) && defined(LOGIN_R)
@@ -1190,6 +1135,9 @@
 #endif /* AUTHENTICATION */
 	closelog();
 
+	if (user != NULL)
+		free(user);
+
 	if (altlogin == NULL) {
 		altlogin = _PATH_LOGIN;
 	}

Modified: trunk/contrib/telnet/telnetd/telnetd.8
===================================================================
--- trunk/contrib/telnet/telnetd/telnetd.8	2018-06-19 19:10:26 UTC (rev 11118)
+++ trunk/contrib/telnet/telnetd/telnetd.8	2018-06-19 19:11:07 UTC (rev 11119)
@@ -30,7 +30,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)telnetd.8	8.4 (Berkeley) 6/1/94
-.\" $FreeBSD$
+.\" $FreeBSD: stable/10/contrib/telnet/telnetd/telnetd.8 182419 2008-08-29 00:04:37Z trhodes $
 .\"
 .Dd August 28, 2008
 .Dt TELNETD 8

Modified: trunk/contrib/telnet/telnetd/telnetd.c
===================================================================
--- trunk/contrib/telnet/telnetd/telnetd.c	2018-06-19 19:10:26 UTC (rev 11118)
+++ trunk/contrib/telnet/telnetd/telnetd.c	2018-06-19 19:11:07 UTC (rev 11119)
@@ -37,7 +37,7 @@
 #endif
 #endif
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: stable/10/contrib/telnet/telnetd/telnetd.c 202214 2010-01-13 18:46:50Z ed $");
 
 #include "telnetd.h"
 #include "pathnames.h"

Modified: trunk/contrib/telnet/telnetd/telnetd.h
===================================================================
--- trunk/contrib/telnet/telnetd/telnetd.h	2018-06-19 19:10:26 UTC (rev 11118)
+++ trunk/contrib/telnet/telnetd/telnetd.h	2018-06-19 19:11:07 UTC (rev 11119)
@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)telnetd.h	8.1 (Berkeley) 6/4/93
- * $FreeBSD$
+ * $FreeBSD: stable/10/contrib/telnet/telnetd/telnetd.h 87139 2001-11-30 21:06:38Z markm $
  */
 
 

Modified: trunk/contrib/telnet/telnetd/termstat.c
===================================================================
--- trunk/contrib/telnet/telnetd/termstat.c	2018-06-19 19:10:26 UTC (rev 11118)
+++ trunk/contrib/telnet/telnetd/termstat.c	2018-06-19 19:11:07 UTC (rev 11119)
@@ -37,7 +37,7 @@
 #endif
 #endif
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: stable/10/contrib/telnet/telnetd/termstat.c 132753 2004-07-28 05:37:18Z kan $");
 
 #include "telnetd.h"
 

Modified: trunk/contrib/telnet/telnetd/utility.c
===================================================================
--- trunk/contrib/telnet/telnetd/utility.c	2018-06-19 19:10:26 UTC (rev 11118)
+++ trunk/contrib/telnet/telnetd/utility.c	2018-06-19 19:11:07 UTC (rev 11119)
@@ -37,7 +37,7 @@
 #endif /* not lint */
 #endif
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: stable/10/contrib/telnet/telnetd/utility.c 228589 2011-12-16 16:53:54Z dim $");
 
 #ifdef __FreeBSD__
 #include <locale.h>



More information about the Midnightbsd-cvs mailing list