Path: blob/main/crypto/heimdal/appl/telnet/telnetd/global.c
34879 views
/*1* Copyright (c) 1989, 19932* The Regents of the University of California. All rights reserved.3*4* Redistribution and use in source and binary forms, with or without5* modification, are permitted provided that the following conditions6* are met:7* 1. Redistributions of source code must retain the above copyright8* notice, this list of conditions and the following disclaimer.9* 2. Redistributions in binary form must reproduce the above copyright10* notice, this list of conditions and the following disclaimer in the11* documentation and/or other materials provided with the distribution.12* 3. All advertising materials mentioning features or use of this software13* must display the following acknowledgement:14* This product includes software developed by the University of15* California, Berkeley and its contributors.16* 4. Neither the name of the University nor the names of its contributors17* may be used to endorse or promote products derived from this software18* without specific prior written permission.19*20* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND21* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE22* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE23* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE24* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL25* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS26* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)27* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT28* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY29* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF30* SUCH DAMAGE.31*/3233/* a *lot* of ugly global definitions that really should be removed...34*/3536#include "telnetd.h"3738RCSID("$Id$");3940/*41* Telnet server variable declarations42*/43char options[256];44char do_dont_resp[256];45char will_wont_resp[256];46int linemode; /* linemode on/off */47int flowmode; /* current flow control state */48int restartany; /* restart output on any character state */49#ifdef DIAGNOSTICS50int diagnostic; /* telnet diagnostic capabilities */51#endif /* DIAGNOSTICS */52int require_otp;5354slcfun slctab[NSLC + 1]; /* slc mapping table */5556char terminaltype[41];5758/*59* I/O data buffers, pointers, and counters.60*/61char ptyobuf[BUFSIZ+NETSLOP], *pfrontp, *pbackp;6263char netibuf[BUFSIZ], *netip;6465char netobuf[BUFSIZ+NETSLOP], *nfrontp, *nbackp;66char *neturg; /* one past last bye of urgent data */6768int pcc, ncc;6970int ourpty, net;71int SYNCHing; /* we are in TELNET SYNCH mode */7273/*74* The following are some clocks used to decide how to interpret75* the relationship between various variables.76*/7778struct clocks_t clocks;798081/* whether to log unauthenticated login attempts */82int log_unauth;8384/* do not print warning if connection is not encrypted */85int no_warn;8687/*88* This function appends data to nfrontp and advances nfrontp.89*/9091int92output_data (const char *format, ...)93{94va_list args;95int remaining, ret;9697va_start(args, format);98remaining = BUFSIZ - (nfrontp - netobuf);99ret = vsnprintf (nfrontp,100remaining,101format,102args);103nfrontp += min(ret, remaining-1);104va_end(args);105return ret;106}107108109