157416Smarkm/* 257416Smarkm * Copyright (c) 1989, 1993 357416Smarkm * The Regents of the University of California. All rights reserved. 457416Smarkm * 557416Smarkm * Redistribution and use in source and binary forms, with or without 657416Smarkm * modification, are permitted provided that the following conditions 757416Smarkm * are met: 857416Smarkm * 1. Redistributions of source code must retain the above copyright 957416Smarkm * notice, this list of conditions and the following disclaimer. 1057416Smarkm * 2. Redistributions in binary form must reproduce the above copyright 1157416Smarkm * notice, this list of conditions and the following disclaimer in the 1257416Smarkm * documentation and/or other materials provided with the distribution. 1357416Smarkm * 3. All advertising materials mentioning features or use of this software 1457416Smarkm * must display the following acknowledgement: 1557416Smarkm * This product includes software developed by the University of 1657416Smarkm * California, Berkeley and its contributors. 1757416Smarkm * 4. Neither the name of the University nor the names of its contributors 1857416Smarkm * may be used to endorse or promote products derived from this software 1957416Smarkm * without specific prior written permission. 2057416Smarkm * 2157416Smarkm * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2257416Smarkm * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2357416Smarkm * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2457416Smarkm * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2557416Smarkm * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2657416Smarkm * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2757416Smarkm * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2857416Smarkm * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2957416Smarkm * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3057416Smarkm * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3157416Smarkm * SUCH DAMAGE. 3257416Smarkm * 3357416Smarkm * @(#)telnetd.h 8.1 (Berkeley) 6/4/93 3457416Smarkm */ 3557416Smarkm 3657416Smarkm 3757416Smarkm#include <config.h> 3857416Smarkm 3957416Smarkm#include <stdio.h> 4057416Smarkm#include <stdarg.h> 4157416Smarkm#include <stdlib.h> 4257416Smarkm#include <string.h> 4357416Smarkm 4457416Smarkm#ifdef HAVE_SYS_TYPES_H 4557416Smarkm#include <sys/types.h> 4657416Smarkm#endif 4757416Smarkm#ifdef HAVE_SYS_PARAM_H 4857416Smarkm#include <sys/param.h> 4957416Smarkm#endif 5057416Smarkm 5157416Smarkm#ifdef HAVE_SYS_SOCKET_H 5257416Smarkm#include <sys/socket.h> 5357416Smarkm#endif 5457416Smarkm#ifdef TIME_WITH_SYS_TIME 5557416Smarkm#include <sys/time.h> 5657416Smarkm#include <time.h> 5757416Smarkm#elif defined(HAVE_SYS_TIME_H) 5857416Smarkm#include <sys/time.h> 5957416Smarkm#else 6057416Smarkm#include <time.h> 6157416Smarkm#endif 6257416Smarkm 6357416Smarkm#ifdef HAVE_SYS_RESOURCE_H 6457416Smarkm#include <sys/resource.h> 6557416Smarkm#endif /* HAVE_SYS_RESOURCE_H */ 6657416Smarkm 6757416Smarkm#ifdef HAVE_SYS_WAIT_H 6857416Smarkm#include <sys/wait.h> 6957416Smarkm#endif 7057416Smarkm 7157416Smarkm#ifdef HAVE_FCNTL_H 7257416Smarkm#include <fcntl.h> 7357416Smarkm#endif 7457416Smarkm#ifdef HAVE_SYS_FILE_H 7557416Smarkm#include <sys/file.h> 7657416Smarkm#endif 7757416Smarkm#ifdef HAVE_SYS_STAT_H 7857416Smarkm#include <sys/stat.h> 7957416Smarkm#endif 8057416Smarkm 8157416Smarkm/* including both <sys/ioctl.h> and <termios.h> in SunOS 4 generates a 8257416Smarkm lot of warnings */ 8357416Smarkm 8457416Smarkm#if defined(HAVE_SYS_IOCTL_H) && SunOS != 40 8557416Smarkm#include <sys/ioctl.h> 8657416Smarkm#endif 8757416Smarkm#ifdef HAVE_SYS_FILIO_H 8857416Smarkm#include <sys/filio.h> 8957416Smarkm#endif 9057416Smarkm 9157416Smarkm#ifdef HAVE_NETINET_IN_H 9257416Smarkm#include <netinet/in.h> 9357416Smarkm#endif 9457416Smarkm#ifdef HAVE_NETINET_IN6_H 9557416Smarkm#include <netinet/in6.h> 9657416Smarkm#endif 9757416Smarkm#ifdef HAVE_NETINET6_IN6_H 9857416Smarkm#include <netinet6/in6.h> 9957416Smarkm#endif 10057416Smarkm 10157416Smarkm#ifdef HAVE_ARPA_INET_H 10257416Smarkm#include <arpa/inet.h> 10357416Smarkm#endif 10457416Smarkm 10557416Smarkm#include <signal.h> 10657416Smarkm#include <errno.h> 10757416Smarkm#ifdef HAVE_NETDB_H 10857416Smarkm#include <netdb.h> 10957416Smarkm#endif 11057416Smarkm#ifdef HAVE_SYSLOG_H 11157416Smarkm#include <syslog.h> 11257416Smarkm#endif 11357416Smarkm#include <ctype.h> 11457416Smarkm 11557416Smarkm#ifdef HAVE_UNISTD_H 11657416Smarkm#include <unistd.h> 11757416Smarkm#endif 11857416Smarkm 11957416Smarkm#include <termios.h> 12057416Smarkm 12157416Smarkm#ifdef HAVE_PTY_H 12257416Smarkm#include <pty.h> 12357416Smarkm#endif 12457416Smarkm 125178825Sdfr#ifdef STREAMSPTY 126178825Sdfr#ifdef HAVE_SAC_H 127178825Sdfr#include <sac.h> 128178825Sdfr#endif 129178825Sdfr#ifdef HAVE_SYS_STROPTS_H 130178825Sdfr#include <sys/stropts.h> 131178825Sdfr#endif 132178825Sdfr 133178825Sdfr# include <stropts.h> 134178825Sdfr 135178825Sdfr#ifdef HAVE_SYS_UIO_H 136178825Sdfr#include <sys/uio.h> 137178825Sdfr#ifdef __hpux 138178825Sdfr#undef SE 139178825Sdfr#endif 140178825Sdfr#endif 141178825Sdfr#ifdef HAVE_SYS_STREAM_H 142178825Sdfr#include <sys/stream.h> 143178825Sdfr#endif 144178825Sdfr 145178825Sdfr#endif /* STREAMSPTY */ 146178825Sdfr 147178825Sdfr#undef NOERROR 148178825Sdfr 14957416Smarkm#include "defs.h" 15057416Smarkm 15157416Smarkm#ifndef _POSIX_VDISABLE 15257416Smarkm# ifdef VDISABLE 15357416Smarkm# define _POSIX_VDISABLE VDISABLE 15457416Smarkm# else 15557416Smarkm# define _POSIX_VDISABLE ((unsigned char)'\377') 15657416Smarkm# endif 15757416Smarkm#endif 15857416Smarkm 15957416Smarkm 16057416Smarkm#ifdef HAVE_SYS_PTY_H 16157416Smarkm#include <sys/pty.h> 16257416Smarkm#endif 16357416Smarkm#ifdef HAVE_SYS_SELECT_H 16457416Smarkm#include <sys/select.h> 16557416Smarkm#endif 16657416Smarkm 16757416Smarkm#ifdef HAVE_SYS_PTYIO_H 16857416Smarkm#include <sys/ptyio.h> 16957416Smarkm#endif 17057416Smarkm 17157416Smarkm#ifdef HAVE_SYS_UTSNAME_H 17257416Smarkm#include <sys/utsname.h> 17357416Smarkm#endif 17457416Smarkm 17557416Smarkm#ifdef HAVE_PATHS_H 17657416Smarkm#include <paths.h> 17757416Smarkm#endif 17857416Smarkm 17972445Sassar#ifdef HAVE_ARPA_TELNET_H 18072445Sassar#include <arpa/telnet.h> 18172445Sassar#endif 18272445Sassar 18372445Sassar#include "ext.h" 18472445Sassar 18557416Smarkm#ifdef SOCKS 18657416Smarkm#include <socks.h> 18757416Smarkm/* This doesn't belong here. */ 18857416Smarkmstruct tm *localtime(const time_t *); 18957416Smarkmstruct hostent *gethostbyname(const char *); 19057416Smarkm#endif 19157416Smarkm 19257416Smarkm#ifdef AUTHENTICATION 19357416Smarkm#include <libtelnet/auth.h> 19457416Smarkm#include <libtelnet/misc.h> 19557416Smarkm#ifdef ENCRYPTION 19657416Smarkm#include <libtelnet/encrypt.h> 19757416Smarkm#endif 19857416Smarkm#endif 19957416Smarkm 20057416Smarkm#ifdef HAVE_LIBUTIL_H 20157416Smarkm#include <libutil.h> 20257416Smarkm#endif 20357416Smarkm 20457416Smarkm#include <roken.h> 20557416Smarkm 20657416Smarkm/* Don't use the system login, use our version instead */ 20757416Smarkm 20857416Smarkm/* BINDIR should be defined somewhere else... */ 20957416Smarkm 21057416Smarkm#ifndef BINDIR 21157416Smarkm#define BINDIR "/usr/athena/bin" 21257416Smarkm#endif 21357416Smarkm 21457416Smarkm#undef _PATH_LOGIN 21557416Smarkm#define _PATH_LOGIN BINDIR "/login" 21657416Smarkm 21757416Smarkm/* fallbacks */ 21857416Smarkm 21957416Smarkm#ifndef _PATH_DEV 22057416Smarkm#define _PATH_DEV "/dev/" 22157416Smarkm#endif 22257416Smarkm 22357416Smarkm#ifndef _PATH_TTY 22457416Smarkm#define _PATH_TTY "/dev/tty" 22557416Smarkm#endif /* _PATH_TTY */ 22657416Smarkm 22757416Smarkm#ifdef DIAGNOSTICS 22857416Smarkm#define DIAG(a,b) if (diagnostic & (a)) b 22957416Smarkm#else 23057416Smarkm#define DIAG(a,b) 23157416Smarkm#endif 23257416Smarkm 23357416Smarkm/* other external variables */ 23457416Smarkmextern char **environ; 23557416Smarkm 23657416Smarkm/* prototypes */ 23757416Smarkm 23857416Smarkm/* appends data to nfrontp and advances */ 23957416Smarkmint output_data (const char *format, ...) 24057416Smarkm#ifdef __GNUC__ 24157416Smarkm__attribute__ ((format (printf, 1, 2))) 24257416Smarkm#endif 24357416Smarkm; 244178825Sdfr 245178825Sdfr#ifdef ENCRYPTION 246178825Sdfrextern int require_encryption; 247178825Sdfr#endif 248