Re-apply r359399: telnet -fno-common fix

line and auth_level's redefinitions are just extraneous

telnetd will #define extern and then include ext.h to allocate storage for
all of these extern'd vars; however, two of them are actually defined in
libtelnet instead. Instead of doing an #ifdef extern dance around those
function pointers, just add an EXTERN macro to make it easier to
differentiate by sight which ones will get allocated in globals.c and which
ones are defined elsewhere.

MFC after:	3 days
This commit is contained in:
Kyle Evans 2020-03-28 19:43:45 +00:00
parent 42b4e3fb5e
commit fb1bc03eee
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=359404
5 changed files with 36 additions and 33 deletions

View File

@ -30,53 +30,57 @@
* $FreeBSD$
*/
#ifndef EXTERN
#define EXTERN extern
#endif
/*
* Telnet server variable declarations
*/
extern char options[256];
extern char do_dont_resp[256];
extern char will_wont_resp[256];
extern int linemode; /* linemode on/off */
EXTERN char options[256];
EXTERN char do_dont_resp[256];
EXTERN char will_wont_resp[256];
EXTERN int linemode; /* linemode on/off */
#ifdef LINEMODE
extern int uselinemode; /* what linemode to use (on/off) */
extern int editmode; /* edit modes in use */
extern int useeditmode; /* edit modes to use */
extern int alwayslinemode; /* command line option */
extern int lmodetype; /* Client support for linemode */
EXTERN int uselinemode; /* what linemode to use (on/off) */
EXTERN int editmode; /* edit modes in use */
EXTERN int useeditmode; /* edit modes to use */
EXTERN int alwayslinemode; /* command line option */
EXTERN int lmodetype; /* Client support for linemode */
#endif /* LINEMODE */
extern int flowmode; /* current flow control state */
extern int restartany; /* restart output on any character state */
EXTERN int flowmode; /* current flow control state */
EXTERN int restartany; /* restart output on any character state */
#ifdef DIAGNOSTICS
extern int diagnostic; /* telnet diagnostic capabilities */
EXTERN int diagnostic; /* telnet diagnostic capabilities */
#endif /* DIAGNOSTICS */
#ifdef BFTPDAEMON
extern int bftpd; /* behave as bftp daemon */
EXTERN int bftpd; /* behave as bftp daemon */
#endif /* BFTPDAEMON */
#ifdef AUTHENTICATION
extern int auth_level;
EXTERN int auth_level;
#endif
extern slcfun slctab[NSLC + 1]; /* slc mapping table */
EXTERN slcfun slctab[NSLC + 1]; /* slc mapping table */
char *terminaltype;
EXTERN char *terminaltype;
/*
* I/O data buffers, pointers, and counters.
*/
extern char ptyobuf[BUFSIZ+NETSLOP], *pfrontp, *pbackp;
EXTERN char ptyobuf[BUFSIZ+NETSLOP], *pfrontp, *pbackp;
extern char netibuf[BUFSIZ], *netip;
EXTERN char netibuf[BUFSIZ], *netip;
extern char netobuf[BUFSIZ], *nfrontp, *nbackp;
extern char *neturg; /* one past last bye of urgent data */
EXTERN char netobuf[BUFSIZ], *nfrontp, *nbackp;
EXTERN char *neturg; /* one past last bye of urgent data */
extern int pcc, ncc;
EXTERN int pcc, ncc;
extern int pty, net;
extern char line[32];
extern int SYNCHing; /* we are in TELNET SYNCH mode */
EXTERN int pty, net;
EXTERN char line[32];
EXTERN int SYNCHing; /* we are in TELNET SYNCH mode */
extern void
EXTERN void
_termstat(void),
add_slc(char, char, cc_t),
check_slc(void),
@ -133,7 +137,7 @@ extern void
tty_binaryin(int),
tty_binaryout(int);
extern int
EXTERN int
end_slc(unsigned char **),
getnpty(void),
#ifndef convex
@ -158,7 +162,7 @@ extern int
tty_istrapsig(void),
tty_linemode(void);
extern void
EXTERN void
tty_rspeed(int),
tty_setecho(int),
tty_setedit(int),
@ -177,7 +181,7 @@ void startslave(char *, int, char *);
#ifdef ENCRYPTION
extern void (*encrypt_output)(unsigned char *, int);
extern int (*decrypt_input)(int);
extern char *nclearto;
EXTERN char *nclearto;
#endif /* ENCRYPTION */
@ -186,7 +190,7 @@ extern char *nclearto;
* the relationship between various variables.
*/
extern struct {
EXTERN struct {
int
system, /* what the current time is */
echotoggle, /* last time user entered echo character */

View File

@ -44,5 +44,5 @@ __FBSDID("$FreeBSD$");
*/
#include "defs.h"
#define extern
#define EXTERN
#include "ext.h"

View File

@ -44,6 +44,8 @@ __FBSDID("$FreeBSD$");
#include <libtelnet/encrypt.h>
#endif
char *terminaltype;
unsigned char doopt[] = { IAC, DO, '%', 'c', 0 };
unsigned char dont[] = { IAC, DONT, '%', 'c', 0 };
unsigned char will[] = { IAC, WILL, '%', 'c', 0 };

View File

@ -376,8 +376,6 @@ spcset(int func, cc_t *valp, cc_t **valpp)
*
* Returns the file descriptor of the opened pty.
*/
char line[32];
int
getpty(int *ptynum __unused)
{

View File

@ -48,7 +48,6 @@ __FBSDID("$FreeBSD$");
#ifdef AUTHENTICATION
#include <libtelnet/auth.h>
int auth_level = 0;
#endif
#ifdef ENCRYPTION
#include <libtelnet/encrypt.h>