Imported from conserver-GNAC-6.15.tar.gz

This commit is contained in:
Bryan Stansell 2000-03-06 19:50:25 -08:00
parent 11ef6794ea
commit b160770f45
15 changed files with 227 additions and 54 deletions

10
CHANGES
View File

@ -1,6 +1,14 @@
CHANGES
=======
version 6.15 (Mar 6, 2000):
- Added debug flag (-D) and the beginning of debug output
- A timeout can now be set for TCP connect() calls. The
default is 30 seconds. Hosts not responding are only
tried once at startup (per child), lessening the impact
of a down terminal server. See CONNECTTIMEOUT in
conserver/cons.h.
version 6.14 (Jan 5, 2000):
- Determining if the local conserver controls a port (with
@conserver spec) we now compare ip addresses instead of
@ -66,5 +74,5 @@ before version 6.05:
and enhancements of various types were applied.
#
# $Id: CHANGES,v 1.12 2000-01-06 14:01:07-08 bryan Exp $
# $Id: CHANGES,v 1.16 2000-03-06 19:50:18-08 bryan Exp $
#

20
INSTALL
View File

@ -5,8 +5,6 @@ Quickie Instructions
- Edit 'conserver/cons.h' (if necessary)
- Run 'make config'
- Run 'make'
- If all is well, run 'make install install.man'
@ -31,16 +29,16 @@ Detailed Instructions
MAXMEMB - Number of consoles per child process
MAXGRP - Number of child processes
- Now it's time to run 'make config'. If you're platform is supported
you'll get a nice message about "Configuring for ...". Otherwise,
you'll have to port the software - follow the instructions you
- Now run 'make'. If you're platform is supported you'll get a nice
message about "Configuring for ..." and the programs should compile.
If not, you'll have to adjust the settings, or slightly worse,
port the software. For adjusting the settings (like using a
different compiler or something), check out the .settings file.
'make config', which is done for you, symlinks it to port/<ostype>.
If you have to port the software, follow the instructions you
received.
- Now run 'make'. If you run into problems (like needing a different
compiler or something), check out the .settings file ('make config'
symlinks it to port/<ostype>).
- If things built fine, you can run 'make install install.man'.
- Once things build, you can run 'make install install.man'.
This will put things into the /usr/local tree. If you'd like
things deposited elsewhere, you can use 'make PREFIX=/your/path
install install.man'. We like to use something like 'make
@ -71,5 +69,5 @@ Detailed Instructions
- That's it! Just start up the console server and enjoy!
#
# $Id: INSTALL,v 1.5 1999-01-26 11:45:04-08 bryan Exp $
# $Id: INSTALL,v 1.6 2000-03-02 02:26:50-08 bryan Exp $
#

View File

@ -1,4 +1,4 @@
# $Id: Makefile,v 1.6 1999-02-01 15:42:42-08 bryan Exp $
# $Id: Makefile,v 1.8 2000-03-06 18:08:31-08 bryan Exp $
#
# Master Makefile
#
@ -6,6 +6,10 @@
SUBDIRS=conserver console conserver.cf
all clean install install.man: FRC
@if [ ! -f .settings ]; then \
echo "Running a 'make config' for you"; \
${MAKE} config; \
fi
@if [ -f .settings ]; then \
s=`cat .settings | grep -v '^#'`; \
settings=`echo $$s`; \
@ -14,9 +18,13 @@ all clean install install.man: FRC
( cd $$s; eval ${MAKE} $$settings $@ ) \
done; \
else \
echo "Please run 'make config' to set up platform type"; \
echo; \
echo "There is a problem with your platform type. Try running"; \
echo "'make config' and look into the errors"; \
echo; \
exit; \
fi
@if [ "$@" = "clean" ]; then rm .settings; fi
config:
@p=`port/system 2>/dev/null`; \

11
README
View File

@ -6,6 +6,13 @@ Maintainer/Enhancer
Bryan Stansell (bryan@gnac.com) of GNAC, Inc.
Announcement Mailing List?
Is anyone out there interested in being on an announcement mailing
list for conserver? If so, drop me a line (bryan@gnac.com) and
let me know. I'll start by sending messages when a new version is
posted, and perhaps it will grow into something more.
Origin
The console server software found here is a heavily modified version
@ -36,8 +43,8 @@ Other Good Information
Zonker Harris has fabulous documents regarding the hookup
of consoles to terminal servers and other such devices. His
Greater Scroll of Console Knowledge is a great place to start
(http://www.jeffk.com/~zonker/consoles/).
(http://www.gnac.com/consoles/).
#
# $Id: README,v 1.6 1999-05-14 10:09:07-07 bryan Exp $
# $Id: README,v 1.8 2000-03-06 19:47:06-08 bryan Exp $
#

View File

@ -1,5 +1,5 @@
/*
* $Id: access.c,v 5.13 1999-08-24 14:39:26-07 bryan Exp $
* $Id: access.c,v 5.14 2000-03-02 02:47:04-08 bryan Exp $
*
* Copyright GNAC, Inc., 1998
*
@ -150,20 +150,24 @@ AccType(hp)
struct hostent *hp;
{
register int i;
#if ORIGINAL_CODE
register unsigned char *puc;
#endif
register char *pcName;
#if ORIGINAL_CODE
auto char acAddr[4*3+2];
#endif
auto char acAddr[4*4];
register int len;
if ( fDebug ) {
puc = (unsigned char *)hp->h_addr;
sprintf(acAddr, "%d.%d.%d.%d", puc[0], puc[1], puc[2], puc[3]);
fprintf( stderr, "%s: Access check: hostname=%s, ip=%s\n", progname, hp->h_name, acAddr );
}
#if ORIGINAL_CODE
puc = (unsigned char *)hp->h_addr;
sprintf(acAddr, "%d.%d.%d.%d", puc[0], puc[1], puc[2], puc[3]);
#endif
for (i = 0; i < iAccess; ++i) {
if ( fDebug ) {
fprintf( stderr, "%s: Access check: who=%s, trust=%c\n", progname, pACList[i].pcwho, pACList[i].ctrust );
}
if (isdigit(pACList[i].pcwho[0])) {
#if ORIGINAL_CODE
/* we could allow 128.210.7 to match all on that subnet

View File

@ -1,5 +1,5 @@
/*
* $Id: cons-default.h,v 1.3 1999-12-01 00:19:34-08 bryan Exp $
* $Id: cons-default.h,v 1.4 2000-03-06 17:10:56-08 bryan Exp $
*
* Copyright GNAC, Inc., 1998
*
@ -29,4 +29,7 @@
--- Clear parity (high-bit) [true/false setting]
#define CPARITY 1
--- TCP connection timeout
#define CONNECTTIMEOUT 60
*/

View File

@ -1,5 +1,5 @@
/*
* $Id: consent.c,v 5.34 1999-01-26 20:35:17-08 bryan Exp $
* $Id: consent.c,v 5.35 2000-03-06 17:26:16-08 bryan Exp $
*
* Copyright GNAC, Inc., 1998
*
@ -88,6 +88,8 @@ static char copyright[] =
#endif
struct hostcache *hostcachelist=NULL;
BAUD baud [] = {
{ "Netwk", 0 },
#if defined(B38400)
@ -590,15 +592,60 @@ fd_set *pfdSet;
pCE->nolog = 0;
}
int
CheckHostCache(hostname)
const char *hostname;
{
struct hostcache *p;
p = hostcachelist;
while (p != NULL) {
if ( 0 == strncmp( hostname, p->hostname, MAXSERVLEN ) ) {
return 1;
}
p = p->next;
}
return 0;
}
void
AddHostCache(hostname)
const char *hostname;
{
struct hostcache *n;
if ((struct hostcache *)0 == (n = (struct hostcache *)malloc(sizeof(struct hostcache)))) {
fprintf(stderr, "%s: malloc failure: %s\n", progname, strerror(errno));
return;
}
(void)strncpy(n->hostname, hostname, MAXSERVLEN);
n->next = hostcachelist;
hostcachelist = n;
}
void
ClearHostCache()
{
struct hostcache *p, *n;
p = hostcachelist;
while (p != NULL) {
n = p->next;
free(p);
p = n;
}
hostcachelist = NULL;
}
/* set up a console the way it should be for use to work with it (ksb)
* also, recover from silo over runs by dropping the line and re-opening
* We also maintian the select set for the caller.
*/
void
ConsInit(pCE, pfdSet)
ConsInit(pCE, pfdSet, useHostCache)
CONSENT *pCE;
fd_set *pfdSet;
int useHostCache;
{
if ( ! useHostCache ) ClearHostCache();
/* clean up old stuff
*/
ConsDown(pCE, pfdSet);
@ -634,7 +681,18 @@ fd_set *pfdSet;
struct sockaddr_in port;
struct hostent *hp;
int one = 1;
int flags;
fd_set fds;
struct timeval tv;
if ( CheckHostCache( pCE->networkConsoleHost ) ) {
fprintf(stderr, "%s: cached previous timeout: %s (%d@%s): forcing down\n",
progname, pCE->server, ntohs(port.sin_port),
pCE->networkConsoleHost);
ConsDown(pCE, pfdSet);
return;
}
#if USLEEP_FOR_SLOW_PORTS
usleep( USLEEP_FOR_SLOW_PORTS ); /* Sleep for slow network ports */
#endif
@ -663,14 +721,77 @@ fd_set *pfdSet;
fprintf(stderr, "%s: setsockopt SO_KEEPALIVE: %s\n",
progname, strerror(errno));
}
if ( (flags = fcntl(pCE->fdtty, F_GETFL)) >= 0 )
{
flags |= O_NONBLOCK;
if ( fcntl(pCE->fdtty, F_SETFL, flags) < 0 ) {
fprintf( stderr, "%s: fcntl O_NONBLOCK: %s\n",
progname, strerror(errno));
}
} else {
fprintf( stderr, "%s: fcntl: %s\n", progname, strerror(errno));
}
if (connect(pCE->fdtty,
(struct sockaddr *)&port, sizeof(port)) < 0)
{
fprintf(stderr, "%s: connect: %s (%d@%s): %s: forcing down\n",
if (errno != EINPROGRESS ) {
fprintf(stderr, "%s: connect: %s (%d@%s): %s: forcing down\n",
progname, pCE->server, ntohs(port.sin_port),
pCE->networkConsoleHost, strerror(errno));
ConsDown(pCE, pfdSet);
return;
}
}
tv.tv_sec = CONNECTTIMEOUT;
tv.tv_usec = 0;
FD_ZERO(&fds);
FD_SET(pCE->fdtty, &fds);
if ( (one=select( pCE->fdtty+1, NULL, &fds, NULL, &tv )) < 0 ) {
fprintf(stderr, "%s: select: %s (%d@%s): %s: forcing down\n",
progname, pCE->server, ntohs(port.sin_port),
pCE->networkConsoleHost, strerror(errno));
ConsDown(pCE, pfdSet);
return;
ConsDown(pCE, pfdSet);
return;
}
if (one == 0) { /* Timeout */
AddHostCache(pCE->networkConsoleHost);
fprintf(stderr, "%s: timeout: %s (%d@%s): forcing down\n",
progname, pCE->server, ntohs(port.sin_port),
pCE->networkConsoleHost);
ConsDown(pCE, pfdSet);
return;
} else { /* Response */
flags = 0;
one = sizeof(flags);
/* So, getsockopt seems to return -1 if there is something
interesting in SO_ERROR under solaris...sheesh. So,
the error message has the small change it's not accurate. */
if (getsockopt(pCE->fdtty, SOL_SOCKET, SO_ERROR,
(char*)&flags, &one) < 0)
{
#if defined(SUN5)
fprintf(stderr, "%s: connect: %s (%d@%s): %s: forcing down\n",
#else
fprintf(stderr, "%s: getsockopt SO_ERROR: %s (%d@%s): %s: forcing down\n",
#endif
progname, pCE->server, ntohs(port.sin_port),
pCE->networkConsoleHost, strerror(errno));
ConsDown(pCE, pfdSet);
return;
}
if (flags != 0)
{
fprintf(stderr, "%s: connect: %s (%d@%s): %s: forcing down\n",
progname, pCE->server, ntohs(port.sin_port),
pCE->networkConsoleHost, strerror(errno));
ConsDown(pCE, pfdSet);
return;
}
}
/*

View File

@ -1,5 +1,5 @@
/*
* $Id: consent.h,v 5.13 1999-01-26 20:35:17-08 bryan Exp $
* $Id: consent.h,v 5.14 2000-03-06 17:11:34-08 bryan Exp $
*
* Copyright GNAC, Inc., 1998
*
@ -93,3 +93,12 @@ extern PARITY *FindParity();
extern BAUD *FindBaud();
extern void ConsInit();
extern void ConsDown();
struct hostcache {
char hostname[MAXSERVLEN];
struct hostcache *next;
};
extern int CheckHostCache();
extern void AddHostCache();
extern void ClearHostCache();

View File

@ -1,5 +1,5 @@
/*
* $Id: group.c,v 5.58 1999-12-01 11:55:13-08 bryan Exp $
* $Id: group.c,v 5.59 2000-03-06 17:23:55-08 bryan Exp $
*
* Copyright GNAC, Inc., 1998
*
@ -221,7 +221,7 @@ ReUp()
}
if (fNoinit)
continue;
ConsInit(pCE, rinitUsr1);
ConsInit(pCE, rinitUsr1, 1);
}
}
@ -646,7 +646,7 @@ int sfd;
*/
if (!fNoinit)
for (iConsole = 0; iConsole< pGE->imembers; ++iConsole) {
ConsInit(& pCE[iConsole], &rinit);
ConsInit(& pCE[iConsole], &rinit, 1);
}
/* set up the list of free connection slots, we could just calloc
@ -722,10 +722,10 @@ int sfd;
pCEServing->ipid = -1;
pCEServing->fup = 0;
} else {
ConsInit(pCEServing, &rinit);
ConsInit(pCEServing, &rinit, 0);
}
#else
ConsInit(pCEServing, &rinit);
ConsInit(pCEServing, &rinit, 0);
#endif
continue;
}
@ -1020,7 +1020,7 @@ drop:
pCEServing->pCLon = pCLServing;
if (fNoinit && !pCEServing->fup)
ConsInit(pCEServing, &rinit);
ConsInit(pCEServing, &rinit, 0);
/* try for attach on new console
*/
@ -1449,7 +1449,7 @@ drop:
/* with a close/re-open we might
* change fd's
*/
ConsInit(pCEServing, &rinit);
ConsInit(pCEServing, &rinit, 0);
if (!pCEServing->fup) {
sprintf(acOut, "line to host is still down]\r\n");
} else if (pCEServing->fronly) {

View File

@ -1,5 +1,5 @@
/*
* $Id: main.c,v 5.33 2000-01-05 14:39:39-08 bryan Exp $
* $Id: main.c,v 5.34 2000-03-02 02:40:42-08 bryan Exp $
*
* Copyright GNAC, Inc., 1998
*
@ -58,10 +58,10 @@
#endif
char rcsid[] =
"$Id: main.c,v 5.33 2000-01-05 14:39:39-08 bryan Exp $";
"$Id: main.c,v 5.34 2000-03-02 02:40:42-08 bryan Exp $";
char *progname =
rcsid;
int fAll = 1, fVerbose = 0, fSoftcar = 0, fNoinit = 0;
int fAll = 1, fVerbose = 0, fSoftcar = 0, fNoinit = 0, fDebug = 0;
int fDaemon = 0;
char chDefAcc = 'r';
char *pcConfig = CONFIG;
@ -133,6 +133,7 @@ static char *apcLong[] = {
"a type set the default access type",
"C config give a new config file to the server process",
"d become a daemon, output to /dev/null",
"D enable debug output, sent to stderr",
"h output this message",
"i init console connections on demand",
"n do not output summary stream to stdout",
@ -204,8 +205,8 @@ char **argv;
register int i, j;
register FILE *fpConfig;
auto struct hostent *hpMe;
static char acOpts[] = "a:C:dhinsVv",
u_terse[] = " [-dhinsvV] [-a type] [-C config]";
static char acOpts[] = "a:C:dDhinsVv",
u_terse[] = " [-dDhinsvV] [-a type] [-C config]";
extern int optopt;
extern char *optarg;
auto REMOTE
@ -263,6 +264,9 @@ char **argv;
case 'd':
fDaemon = 1;
break;
case 'D':
fDebug = 1;
break;
case 'h':
fprintf(stderr, "%s: usage%s\n", progname, u_terse);
Usage(stdout, apcLong);

View File

@ -1,5 +1,5 @@
/*
* $Id: main.h,v 5.12 2000-01-05 14:39:39-08 bryan Exp $
* $Id: main.h,v 5.13 2000-03-02 02:42:17-08 bryan Exp $
*
* Copyright GNAC, Inc., 1998
*
@ -36,7 +36,7 @@
*/
extern char rcsid[];
extern char *progname;
extern int fAll, fVerbose, fSoftcar, fNoinit, fInteractive;
extern int fAll, fVerbose, fSoftcar, fNoinit, fInteractive, fDebug;
extern char chDefAcc;
extern char *pcConfig;
extern struct sockaddr_in in_port;

View File

@ -1,5 +1,5 @@
/*
* $Id: master.c,v 5.24 1999-08-24 14:38:26-07 bryan Exp $
* $Id: master.c,v 5.25 2000-03-06 17:12:43-08 bryan Exp $
*
* Copyright GNAC, Inc., 1998
*
@ -186,6 +186,9 @@ REMOTE
int true = 1;
/* set up signal handler */
#if defined(SIGPOLL)
signal(SIGPOLL, SIG_IGN);
#endif
Set_signal(SIGCHLD, FlagSawCHLD);
Set_signal(SIGTERM, QuitIt);
Set_signal(SIGUSR1, FlagSawUSR1);

View File

@ -1,5 +1,5 @@
/*
* $Id: port.h,v 1.10 1999-12-01 11:55:13-08 bryan Exp $
* $Id: port.h,v 1.15 2000-03-06 18:16:24-08 bryan Exp $
*
* Copyright GNAC, Inc., 1998
*
@ -88,6 +88,13 @@
#define HOST "console"
#endif
/* How long should we wait for a TCP socket to be created when talking
* to network terminal servers? 30 second default
*/
#if !defined(CONNECTTIMEOUT)
#define CONNECTTIMEOUT 30
#endif
/* the default escape sequence used to give meta commands
*/
#if !defined(DEFATTN)
@ -211,7 +218,7 @@
#define USE_TERMIO (defined(ETA10)||defined(V386))
#endif
#if !defined(USE_TERMIOS)
#define USE_TERMIOS (defined(HPUX7)||defined(HPUX8)||defined(HPUX9)||defined(SUN5)||defined(PTX)||defined(IRIX5)||defined(LINUX2)||defined(IRIX6)||defined(SUN4)||defined(BSDOS3))
#define USE_TERMIOS (defined(HPUX7)||defined(HPUX8)||defined(HPUX9)||defined(SUN5)||defined(PTX)||defined(IRIX5)||defined(LINUX2)||defined(IRIX6)||defined(SUN4))
#endif
#if !defined(USE_TCBREAK)
#define USE_TCBREAK (defined(PTX)||defined(BSDOS3)||defined(LINUX2)||defined(SUN5))
@ -220,7 +227,7 @@
/* if we have <strings.h> define this to 1, else define to 0
*/
#if !defined(USE_STRINGS)
#define USE_STRINGS (defined(SUN4)||defined(DYNIX)||defined(EPIX)||defined(IRIX5)||defined(LINUX2)||defined(IRIX6)||defined(BSDOS3))
#define USE_STRINGS (defined(SUN4)||defined(DYNIX)||defined(EPIX)||defined(IRIX5)||defined(IRIX6)||defined(BSDOS3))
#endif
#if !defined(NEED_UNISTD_H)
@ -232,9 +239,13 @@
#endif
#if USE_STRINGS
#if !defined(strchr)
#define strchr index
#endif
#if !defined(strrchr)
#define strrchr rindex
#endif
#endif
/* used to force the server process to clear parity, which is for farmers
*/

View File

@ -1,9 +1,9 @@
/*
* $Id: version.h,v 1.14 2000-01-05 14:40:16-08 bryan Exp $
* $Id: version.h,v 1.15 2000-03-02 02:47:22-08 bryan Exp $
*
* Copyright GNAC, Inc., 1998
*
* Maintainer/Enhancer: Bryan Stansell (bryan@gnac.com)
*/
#define GNAC_VERSION "GNAC version 6.14"
#define GNAC_VERSION "GNAC version 6.15"

View File

@ -1,5 +1,5 @@
/*
* $Id: console.c,v 5.28 2000-01-06 14:00:13-08 bryan Exp $
* $Id: console.c,v 5.29 2000-03-06 18:16:44-08 bryan Exp $
*
* Copyright GNAC, Inc., 1998
*
@ -62,9 +62,6 @@
#endif
#endif
#if !defined IBMR2
extern char *strrchr(), *strchr();
#endif
extern char *getenv();
extern char *getpass();
extern char *calloc(), *realloc();
@ -77,7 +74,7 @@ extern char *sys_errlist[];
#endif
static char rcsid[] =
"$Id: console.c,v 5.28 2000-01-06 14:00:13-08 bryan Exp $";
"$Id: console.c,v 5.29 2000-03-06 18:16:44-08 bryan Exp $";
static char *progname =
rcsid;
int fVerbose = 0, fReplay = 0, fRaw = 0;