Home | History | Annotate | Line # | Download | only in telnetd
      1 /*	$NetBSD: global.c,v 1.9 2020/04/23 00:03:40 joerg Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 1989, 1993
      5  *	The Regents of the University of California.  All rights reserved.
      6  *
      7  * Redistribution and use in source and binary forms, with or without
      8  * modification, are permitted provided that the following conditions
      9  * are met:
     10  * 1. Redistributions of source code must retain the above copyright
     11  *    notice, this list of conditions and the following disclaimer.
     12  * 2. Redistributions in binary form must reproduce the above copyright
     13  *    notice, this list of conditions and the following disclaimer in the
     14  *    documentation and/or other materials provided with the distribution.
     15  * 3. Neither the name of the University nor the names of its contributors
     16  *    may be used to endorse or promote products derived from this software
     17  *    without specific prior written permission.
     18  *
     19  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     22  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     23  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     24  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     25  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     27  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     28  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     29  * SUCH DAMAGE.
     30  */
     31 
     32 #include <sys/cdefs.h>
     33 #ifndef lint
     34 #if 0
     35 static char sccsid[] = "@(#)global.c	8.1 (Berkeley) 6/4/93";
     36 #else
     37 __RCSID("$NetBSD: global.c,v 1.9 2020/04/23 00:03:40 joerg Exp $");
     38 #endif
     39 #endif /* not lint */
     40 
     41 /*
     42  * Allocate global variables.  We do this
     43  * by including the header file that defines
     44  * them all as externs, but first we define
     45  * the keyword "extern" to be nothing, so that
     46  * we will actually allocate the space.
     47  */
     48 
     49 #include <defs.h>
     50 #include <ext.h>
     51 
     52 char	options[256];
     53 char	do_dont_resp[256];
     54 char	will_wont_resp[256];
     55 int	linemode;	/* linemode on/off */
     56 #ifdef	LINEMODE
     57 int	uselinemode;	/* what linemode to use (on/off) */
     58 int	editmode;	/* edit modes in use */
     59 int	useeditmode;	/* edit modes to use */
     60 int	alwayslinemode;	/* command line option */
     61 # ifdef	KLUDGELINEMODE
     62 int	lmodetype;	/* Client support for linemode */
     63 # endif	/* KLUDGELINEMODE */
     64 #endif	/* LINEMODE */
     65 int	flowmode;	/* current flow control state */
     66 int	restartany;	/* restart output on any character state */
     67 #ifdef DIAGNOSTICS
     68 int	diagnostic;	/* telnet diagnostic capabilities */
     69 #endif /* DIAGNOSTICS */
     70 #ifdef SECURELOGIN
     71 int	require_secure_login;
     72 #endif
     73 #ifdef AUTHENTICATION
     74 int	auth_level;
     75 #endif
     76 
     77 slcfun	slctab[NSLC + 1];	/* slc mapping table */
     78 char	terminaltype[41];
     79 
     80 /*
     81  * I/O data buffers, pointers, and counters.
     82  */
     83 char	ptyobuf[BUFSIZ+NETSLOP], *pfrontp, *pbackp;
     84 char	netibuf[BUFSIZ], *netip;
     85 char	netobuf[BUFSIZ+NETSLOP], *nfrontp, *nbackp;
     86 char	*neturg;		/* one past last bye of urgent data */
     87 int	pcc, ncc;
     88 int	pty, net;
     89 char	*line;
     90 int	SYNCHing;		/* we are in TELNET SYNCH mode */
     91 
     92 #ifdef	ENCRYPTION
     93 char	*nclearto;
     94 #endif	/* ENCRYPTION */
     95 
     96 struct clockstate clocks;
     97