Imported from conserver-7.1.4.tar.gz

This commit is contained in:
Bryan Stansell 2002-01-21 02:58:05 -08:00
parent d113cab186
commit f56f90b76c
29 changed files with 1026 additions and 222 deletions

24
CHANGES
View File

@ -1,6 +1,24 @@
CHANGES
=======
version 7.1.4 (Jan 21, 2002):
- console -[PqQ] didn't work - patch by Han Pilmeyer
<han@zk3.dec.com>
- maxfiles() didn't check FD_SETSIZE - patch by Justin Grudzien
<grudzien@31337.com>
- New -o and -O server flags for automatically reconnecting
downed consoles - patch by Benn Oshrin <benno@columbia.edu>
- Automatic reconnection of consoles on read failures, retried
every minute
- Up to nine break sequences can be defined in the
configuration file and assigned to consoles individually,
accessed via new ^ecl[?0-9] escape sequences
- console logs are marked with "up" and "down" timestamps
The following based on code by John R. Jackson <jrj@cc.purdue.edu>
- sequential timestamps merged into one range during playback
- timestamps done on "nice" boundaries (hour, minute, etc.)
- lots of code cleanup, optimizations, etc.
version 7.1.3 (Oct 16, 2001):
- NetBSD 1.5 termios bug/compatibility - patch by Andreas Wrede
<aew.conserver@planix.com>
@ -23,7 +41,7 @@ version 7.1.2 (Oct 15, 2001):
- Widened username field of 'console -w' output
- Added server hostname to password entry prompt
- AC_CHECK_LIB replaced with AC_SEARCH_LIBS in configure.in so
that irrelavent (and sometimes incompatible) libraries aren't
that irrelevant (and sometimes incompatible) libraries aren't
linked in
version 7.1.1 (Aug 4, 2001):
@ -81,7 +99,7 @@ version 7.1.0 (Jul 26, 2001):
- Improved process handling (POSIX waitpid() now necessary)
- Significant rework of STREAMS-based pseudo-tty code
- TCP connections ('!' config syntax) now have some Telnet protocol
knowledge, removing the "noise" seen when conneting to a terminal
knowledge, removing the "noise" seen when connecting to a terminal
server - reported by Todd Stansell <todd@stansell.org>
- Various code and message "pretty-printing" done
- Client and server both run in Windows (tested with Windows
@ -247,5 +265,5 @@ before version 6.05:
and enhancements of various types were applied.
#
# $Id: CHANGES,v 1.50 2001-10-16 21:32:33-07 bryan Exp $
# $Id: CHANGES,v 1.52 2002-01-21 02:49:42-08 bryan Exp $
#

44
FAQ
View File

@ -1,4 +1,4 @@
Conserver FAQ
=============
@ -14,6 +14,7 @@ directed to faq@conserver.com. The FAQ answers the following questions:
6) What does "console: gethostbyname: console: host lookup error"
mean (or something close to that)?
7) How do I set up a serial port for no parity?
99) Ok, things just don't seem to work. Help?!?
1) What is conserver?
@ -78,6 +79,45 @@ directed to faq@conserver.com. The FAQ answers the following questions:
but the answer is to use a 'p' after the baud rate. So, '9600p'
is 9600 baud, no parity.
99) Ok, things just don't seem to work. Help?!?
Yes, this is a pretty vague question, but here are a few tips that
might help.
- Is your low-level serial connection correct? Incorrect cables,
adapters, wiring, etc. could be the issue. Using a signal tracer
or attaching other equipment that's known to work (like a laptop)
might be enlightening. Check out
http://www.conserver.com/consoles/msock.html for basic serial
information (or http://www.conserver.com/consoles/ for even more
info).
- Can you talk to the serial port with different software? Try
using tip or minicom or another application to make sure you can
interact with the port. If you're not seeing the right info
here, there may be a baud rate issue, a lack of a getty (or
equivalent) running on the host or...*shrug*. But, if you've
determined that you already have a valid low-level signal
connection, you shouldn't have to worry about that level of
problem.
- So, you're getting the proper interaction from other
applications, but not conserver? Are the port name and baud rate
correct in the conserver.cf file? When you start conserver
(adding -v doesn't hurt), are there any warnings/errors? Is the
port in the "up" state when you use "console -u"? If not, what
happens when you connect and then do a "^eco" escape sequence to
bring it up? What does the conserver process say when you do
this? These are the types of things I look at first. If that
doesn't help you determine the problem, others will want to see
this info (and possibly the same steps with both the client and
server using the -D option) to be able to help. Posting your
questions to the users mailing list is probably your next step.
- Have you tried a search on the conserver site (it searches
mailing list traffic as well) to see if someone else has gone
through the same problem?
#
# $Id: FAQ,v 1.3 2001-04-04 16:58:49-07 bryan Exp $
# $Id: FAQ,v 1.5 2002-01-20 19:06:42-08 bryan Exp $
#

4
TODO
View File

@ -30,6 +30,8 @@ Bryan Stansell
- PAM support
- syslog?
Daniel E. Singer <des@cs.duke.edu> would like to see it - especially
in regards to --use-libwrap code
- alternate (md5) password encryption support in conserver.passwd
@ -113,5 +115,5 @@ Bryan Stansell
things) once instead of leaving it down.
#
# $Id: TODO,v 1.16 2001-10-16 00:13:27-07 bryan Exp $
# $Id: TODO,v 1.17 2002-01-18 09:56:57-08 bryan Exp $
#

View File

@ -1,4 +1,4 @@
.\" $Id: conserver.cf.man,v 1.17 2001-08-04 20:54:25-07 bryan Exp $
.\" $Id: conserver.cf.man,v 1.23 2002-01-20 21:14:43-08 bryan Exp $
.\" @(#)constab.5 01/06/91 OSU CIS; Thomas A. Fine
.TH CONSERVER.CF 5 "Local"
.SH NAME
@ -9,11 +9,13 @@ conserver.cf \- console configuration file for conserver(8)
.br
.BI \s-1TIMESTAMP\s0= timestamp-spec
.br
\fIname\fP:\fIdevice\fP[@\fIconserver\fP]:\fIbaud\fP:\fIlogfile\fP:\fItimestamp-spec\fP
.BI \s-1BREAK\s0\fIn\fP= break-spec
.br
\fIname\fP:!\fItermserver\fP[@\fIconserver\fP]:\fIport\fP:\fIlogfile\fP:\fItimestamp-spec\fP
\fIname\fP:\fIdevice\fP[@\fIconserver\fP]:\fIbaud\fP:\fIlogfile\fP:\fItimestamp-spec\fP:\fIbreak\fP
.br
\fIname\fP:|\fIcommand\fP[@\fIconserver\fP]::\fIlogfile\fP:\fItimestamp-spec\fP
\fIname\fP:!\fItermserver\fP[@\fIconserver\fP]:\fIport\fP:\fIlogfile\fP:\fItimestamp-spec\fP:\fIbreak\fP
.br
\fIname\fP:|\fIcommand\fP[@\fIconserver\fP]::\fIlogfile\fP:\fItimestamp-spec\fP:\fIbreak\fP
.br
\fB%%\fP
.br
@ -83,7 +85,7 @@ timestamps applied to the console log file and
whether to log read/write connection actions.
The format of the specification is
[\fImark-interval\fP[\fBm\fP|\fBh\fP|\fBd\fP|\fBl\fP]][\fBa\fP].
The timestamps look like `[-- MARK -- Mon Jan 25 14:46:56 PST 1999]'.
The timestamps look like `[-- MARK -- Mon Jan 25 14:46:56 1999]'.
The `\fBm\fP', `\fBh\fP', and `\fBd\fP' tags specify
`minutes' (the default), `hours', and `days'. The `\fBl\fP' tag
specifies `lines' and will cause timestamps of the form
@ -104,6 +106,54 @@ All consoles below the \fB\s-1TIMESTAMP=\s0\fP line will use that
and until superseded by another \fB\s-1TIMESTAMP=\s0\fP line.
To turn off marks for a specific
console, use a \fImark-interval\fP of zero.
.TP
.I break
specifies which break sequence to use. The default value is `1'.
Values of `0' thru `9' are valid. A value of `0' will unset the
default break sequence, which will cause the \fB^Ecl0\fP sequence to do
nothing.
.PP
The \fIbreak-spec\fP sequences are defined using
the \fB\s-1BREAK\s0\fIn\fB=\fR
syntax where \fIn\fP is a number from 1 to 9.
There are three builtin defaults: ``\s-1BREAK1\s0=\\z'',
``\s-1BREAK2\s0=\\r~^b'',
and ``\s-1BREAK3\s0=#.reset -x\\r''. The values of
the \fB\s-1BREAK\s0\fIn\fR
sequences are simple characters strings with the exception of `\\' and
`^':
.sp
.PD 0
.IP \\\\a
alert
.IP \\\\b
backspace
.IP \\\\f
form-feed
.IP \\\\n
newline
.IP \\\\r
carriage-return
.IP \\\\t
tab
.IP \\\\v
vertical-tab
.IP \\\\z
serial break
.IP \\\\\\\\
backslash
.IP \\\\^
circumflex
.IP \\\\\fIooo\fP
octal representation of a character (where \fIooo\fP is one to three
octal digits)
.IP \\\\\fIc\fP
character \fIc\fP
.IP ^?
delete
.IP ^\fIc\fP
control character (\fIc\fP is `and'ed with 0x1f)
.PD
.PP
This section is terminated with a `\fB%%\fP' token on a line by itself.
.PP
@ -132,12 +182,16 @@ For example, `\fB192.168.1.0\fP' will allow the class C space of 192.168.1.0,
but `\fB192.168.1.0/25\fP' will allow
only the lower half of that same address space (192.168.1.0 thru 192.168.1.127).
.SH EXAMPLE
# name:path:baud:/usr/adm/logfile:mark
# name:path:baud:logfile:mark:break
.nf
LOGDIR=/tmp
# overriding the builtin BREAK3 sequence
BREAK3=#.reset\\r
# adding another break sequence
BREAK8=+++
#
# This logs to /tmp/treelog...
tree:/dev/ttyj0:9600e:&log:
# This logs to /tmp/treelog...using BREAK8
tree:/dev/ttyj0:9600e:&log::8
#
# This logs to /tmp/fishlog...
fish:/dev/ttyj1:4800e:fishlog:
@ -145,19 +199,21 @@ fish:/dev/ttyj1:4800e:fishlog:
# Now we're defaulting to /var/tmp for logfiles...
LOGDIR=/var/tmp
#
# So, this is /var/tmp/birdlog
bird:/dev/ttyj2:4800m:&log:
# So, this is /var/tmp/birdlog with 1-hour timestamps
bird:/dev/ttyj2:4800m:&log:1h
#
# And this is /var/tmp/solarlog...
solar:|telnet solar::solarlog:
# And this is /var/tmp/solarlog, using BREAK4, no timestamps
solar:|telnet solar::solarlog::4
#
# Now things are all in /var/consoles/<console name>
LOGDIR=/var/consoles
shell:|::&:
#
# These open connections to ports 2003 and 2004 of ts1...
tribe:!ts1:2003:&:
reptile:!ts1:2004:&:
# These open connections to ports 2003 and 2004 of ts1
# using BREAK2 and BREAK3
tribe:!ts1:2003:&::2
# This one also has 10-minute timestamps and activity logging
reptile:!ts1:2004:&:10ma:3
#
# This opens /dev/ttyh0 if running on extra.cc.purdue.edu;
# otherwise, clients are redirected to that host.

View File

@ -8,6 +8,8 @@
<META NAME="author" CONTENT="Bryan Stansell &lt;bryan@conserver.com&gt;">
<LINK REL="SHORTCUT ICON" HREF="http://www.conserver.com/conserver.ico">
<TITLE>Conserver</TITLE>
<STYLE type="text/css">
@ -80,7 +82,7 @@ announcement-only mailing list for informing of new versions, major
developments, etc. <A
HREF="mailto:users@conserver.com">users@conserver.com</A> is for
general Q&amp;A, discussions, ideas, etc for conserver users. You can
sign up my sending a message to <A
sign up by sending a message to <A
HREF="mailto:announce-request@conserver.com">announce-request@conserver.com</A>
or <A
HREF="mailto:users-request@conserver.com">users-request@conserver.com</A>
@ -114,8 +116,10 @@ continued fixing things, and added features we found useful.
</P>
<P>
<A HREF="http://www.certaintysolutions.com/">Certainty Solutions</A>
(formerly Global Networking and Computing - GNAC) has been supporting
<A HREF="http://www.gnac.com/">GNAC</A> (Global Networking and
Computing - currently
<A HREF="http://www.certaintysolutions.com/">Certainty Solutions</A>)
has been supporting
my coding efforts (in too many ways to list) since 1996.
</P>
@ -167,17 +171,18 @@ contrast for yourself.
<P>
The current version, released on RELEASE_DATE, is <A
HREF="http://www.conserver.com/7.1.3.tar.gz">
7.1.3.tar.gz</A>. You can get it via <A
HREF="ftp://ftp.conserver.com/conserver/7.1.3.tar.gz">FTP</A>
or <A HREF="http://www.conserver.com/7.1.3.tar.gz">HTTP</A>.
HREF="http://www.conserver.com/7.1.4.tar.gz">
7.1.4.tar.gz</A>. You can get it via <A
HREF="ftp://ftp.conserver.com/conserver/7.1.4.tar.gz">FTP</A>
or <A HREF="http://www.conserver.com/7.1.4.tar.gz">HTTP</A>.
See the <A HREF="http://www.conserver.com/CHANGES">CHANGES</A> file for
information on the latest updates.
</P>
<P>
As of version 6.1.7, the packaging and numbering scheme has changed. I
used to package conserver as conserver-GNAC-v.vv. Since GNAC (now <A
used to package conserver as conserver-GNAC-v.vv. Since <A
HREF="http://ww.gnac.com/">GNAC</A> (now <A
HREF="http://www.certaintysolutions.com/">Certainty Solutions</A>) has
changed it's name I've decided to drop the GNAC portion and use a 3
digit version number (conserver-v.v.v). Why change the version

View File

@ -1,7 +1,7 @@
/*
* $Id: access.c,v 5.35 2001-07-23 00:45:49-07 bryan Exp $
* $Id: access.c,v 5.36 2002-01-21 02:48:33-08 bryan Exp $
*
* Copyright conserver.com, 2000-2001
* Copyright conserver.com, 2000
*
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
*

View File

@ -1,7 +1,7 @@
/*
* $Id: access.h,v 5.13 2001-07-17 14:14:11-07 bryan Exp $
* $Id: access.h,v 5.14 2002-01-21 02:48:33-08 bryan Exp $
*
* Copyright conserver.com, 2000-2001
* Copyright conserver.com, 2000
*
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
*

View File

@ -1,7 +1,7 @@
/*
* $Id: client.c,v 5.34 2001-10-15 17:24:16-07 bryan Exp $
* $Id: client.c,v 5.40 2002-01-21 02:48:33-08 bryan Exp $
*
* Copyright conserver.com, 2000-2001
* Copyright conserver.com, 2000
*
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
*
@ -136,11 +136,27 @@ Replay(fdLog, fdOut, iBack)
CONSFILE *fdOut;
int iBack;
{
int tot, nCr;
char *pc;
off_t where;
char bf[MAXREPLAY + 2];
off_t file_pos;
off_t buf_pos;
char *buf;
char *bp;
char *s;
int r;
int ch;
struct stat stLog;
struct lines {
int is_mark;
STRING line;
STRING mark_end;
} *lines;
int n_lines;
int ln;
int i;
int j;
int u;
int is_mark;
char dummy[4];
if ((CONSFILE *) 0 == fdLog) {
fileWrite(fdOut, "[no log file on this console]\r\n", -1);
@ -152,40 +168,219 @@ Replay(fdLog, fdOut, iBack)
if (0 != fileStat(fdLog, &stLog)) {
return;
}
file_pos = stLog.st_size - 1;
buf_pos = file_pos + 1;
if (MAXREPLAY > stLog.st_size) {
where = 0L;
} else {
where = stLog.st_size - MAXREPLAY;
}
#if defined(SEEK_SET)
/* PTX and maybe other Posix systems
/* get space for the line information and initialize it
*
* we allocate room for one more line than requested to be able to
* do the mark ranges
*/
if (fileSeek(fdLog, where, SEEK_SET) < 0) {
return;
if ((char *)0 == (buf = malloc(BUFSIZ))) {
OutOfMem();
}
n_lines = iBack + 1;
lines = (struct lines *)calloc(n_lines, sizeof(*lines));
if ((struct lines *)0 == lines) {
OutOfMem();
}
ln = -1;
/* loop as long as there is data in the file or we have not found
* the requested number of lines
*/
while (file_pos >= 0) {
if (file_pos < buf_pos) {
/* read one buffer worth of data a buffer boundary
*
* the first read will probably not get a full buffer but
* the rest (as we work our way back in the file) should be
*/
buf_pos = (file_pos / BUFSIZ) * BUFSIZ;
#if defined(SEEK_SET)
/* PTX and maybe other Posix systems
*/
if (fileSeek(fdLog, buf_pos, SEEK_SET) < 0) {
goto common_exit;
}
#else
if (fileSeek(fdLog, where, L_SET) < 0) {
return;
}
if (fileSeek(fdLog, buf_pos, L_SET) < 0) {
goto common_exit;
}
#endif
if ((r = fileRead(fdLog, buf, BUFSIZ)) <= 0) {
goto common_exit;
}
bp = buf + r;
}
if ((tot = fileRead(fdLog, bf, MAXREPLAY)) <= 0) {
return;
}
bf[tot] = '@';
/* process the next character
*/
--file_pos;
if ((ch = *--bp) == '\n') {
if (ln >= 0) {
pc = &bf[tot];
nCr = 0;
while (--pc != bf) {
if ('\n' == *pc && iBack == nCr++) {
++pc; /* get rid of a blank line */
/* reverse the text to put it in forward order
*/
u = lines[ln].line.used - 1;
for (i = 0; i < u / 2; i++) {
int temp;
temp = lines[ln].line.string[i];
lines[ln].line.string[i]
= lines[ln].line.string[u - i - 1];
lines[ln].line.string[u - i - 1] = temp;
}
/* see if this line is a MARK
*/
if (lines[ln].line.used > 0 &&
lines[ln].line.string[0] == '[') {
i = sscanf(lines[ln].line.string + 1,
"-- MARK -- %3c %3c %d %d:%d:%d %d]\r\n",
dummy, dummy, &j, &j, &j, &j, &j);
is_mark = (i == 7);
} else {
is_mark = 0;
}
/* process this line
*/
if (is_mark && ln > 0 && lines[ln - 1].is_mark) {
/* this is a mark and the previous line is also
* a mark, so make (or continue) that range
*/
if (0 == lines[ln - 1].mark_end.allocated) {
/* this is a new range - shuffle pointers
*
* remember that we are moving backward
*/
lines[ln - 1].mark_end = lines[ln - 1].line;
lines[ln - 1].line.string = (char *)0;
lines[ln - 1].line.used = 0;
lines[ln - 1].line.allocated = 0;
}
/* if unallocated, cheat and shuffle pointers */
if (0 == lines[ln - 1].line.allocated) {
lines[ln - 1].line = lines[ln].line;
lines[ln].line.string = (char *)0;
lines[ln].line.used = 0;
lines[ln].line.allocated = 0;
} else {
buildMyString((char *)0, &lines[ln - 1].line);
buildMyString(lines[ln].line.string,
&lines[ln - 1].line);
buildMyString((char *)0, &lines[ln].line);
}
ln--;
}
lines[ln].is_mark = is_mark;
}
/* advance to the next line and break if we have enough
*/
ln++;
if (ln >= n_lines - 1) {
break;
}
}
/* if we have a character but no lines yet, the last text in the
* file does not end with a newline, so start the first line anyway
*/
if (ln < 0) {
ln = 0;
}
(void)buildMyStringChar(ch, &lines[ln].line);
/* if we've processed "a lot" of data for a line, then bail
* why? there must be some very long non-newline terminated
* strings and if we just keep going back, we could spew lots
* of data and chew up lots of memory
*/
if (lines[ln].line.used > MAXREPLAYLINELEN) {
break;
}
}
free(buf);
buf = (char *)0;
(void)fileWrite(fdOut, pc, tot - (pc - bf));
/* if we got back to beginning of file but saw some data, include it
*/
if (ln >= 0 && lines[ln].line.used > 0) {
/* reverse the text to put it in forward order
*/
u = lines[ln].line.used - 1;
for (i = 0; i < u / 2; i++) {
int temp;
temp = lines[ln].line.string[i];
lines[ln].line.string[i]
= lines[ln].line.string[u - i - 1];
lines[ln].line.string[u - i - 1] = temp;
}
ln++;
}
/* copy the lines into the buffer and put them in order
*/
for (i = ln - 1; i >= 0; i--) {
if (lines[i].is_mark && 0 != lines[i].mark_end.used) {
int mark_len;
/* output the start of the range, stopping at the ']'
*/
s = strrchr(lines[i].line.string, ']');
if ((char *)0 != s) {
*s = '\000';
}
(void)fileWrite(fdOut, lines[i].line.string, -1);
(void)fileWrite(fdOut, " .. ", -1);
/* build the end string by removing the leading "[-- MARK -- "
* and replacing "]\r\n" on the end with " -- MARK --]\r\n"
*/
mark_len = sizeof("[-- MARK -- ") - 1;
s = strrchr(lines[i].mark_end.string + mark_len, ']');
if ((char *)0 != s) {
*s = '\000';
}
(void)fileWrite(fdOut, lines[i].mark_end.string + mark_len,
-1);
(void)fileWrite(fdOut, " -- MARK --]\r\n", -1);
u = lines[i].mark_end.used;
s = lines[i].mark_end.string;
} else
(void)fileWrite(fdOut, lines[i].line.string, -1);
}
common_exit:
if ((struct lines *)0 != lines) {
for (i = 0; i < n_lines; i++) {
if ((char *)0 != lines[i].mark_end.string) {
free(lines[i].mark_end.string);
lines[i].mark_end.string = (char *)0;
lines[i].mark_end.used = 0;
lines[i].mark_end.allocated = 0;
}
if ((char *)0 != lines[i].line.string) {
free(lines[i].line.string);
lines[i].line.string = (char *)0;
lines[i].line.used = 0;
lines[i].line.allocated = 0;
}
}
free(lines);
lines = (struct lines *)0;
}
if ((char *)0 != buf) {
free(buf);
buf = (char *)0;
}
}
@ -212,8 +407,9 @@ static HELP aHLTable[] = {
{WHEN_ALWAYS, "f force attach read/write"},
{WHEN_ALWAYS, "g group info"},
{WHEN_ATTACH, "L toggle logging on/off"},
{WHEN_ATTACH, "l1 send break (halt host!)"},
{WHEN_ATTACH, "l2 send alt. break (halt host!)"},
{WHEN_ATTACH, "l? break sequence list"},
{WHEN_ATTACH, "l0 send break per config file"},
{WHEN_ATTACH, "l1-9 send specific break sequence"},
{WHEN_ALWAYS, "o (re)open the tty and log file"},
{WHEN_ALWAYS, "p replay the last 60 lines"},
{WHEN_ALWAYS, "r replay the last 20 lines"},

View File

@ -1,7 +1,7 @@
/*
* $Id: client.h,v 5.20 2001-07-25 15:32:28-07 bryan Exp $
* $Id: client.h,v 5.21 2002-01-21 02:48:33-08 bryan Exp $
*
* Copyright conserver.com, 2000-2001
* Copyright conserver.com, 2000
*
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
*

View File

@ -1,7 +1,7 @@
/*
* $Id: consent.c,v 5.71 2001-10-16 12:02:30-07 bryan Exp $
* $Id: consent.c,v 5.74 2002-01-21 02:48:33-08 bryan Exp $
*
* Copyright conserver.com, 2000-2001
* Copyright conserver.com, 2000
*
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
*
@ -59,6 +59,7 @@
#include <consent.h>
#include <client.h>
#include <group.h>
#include <main.h>
@ -551,6 +552,8 @@ ConsDown(pCE, pfdSet)
CONSENT *pCE;
fd_set *pfdSet;
{
static char acOut[BUFSIZ];
if (-1 != pCE->ipid) {
Debug("Sending pid %d signal %d", pCE->ipid, SIGHUP);
kill(pCE->ipid, SIGHUP);
@ -564,13 +567,17 @@ ConsDown(pCE, pfdSet)
}
if ((CONSFILE *) 0 != pCE->fdlog) {
if (pCE->nolog) {
fileWrite(pCE->fdlog, "[Console logging restored]\r\n", -1);
fileWrite(pCE->fdlog, "[-- Console logging restored --]\r\n",
-1);
}
sprintf(acOut, "[-- Console down -- %s]\r\n", strtime(NULL));
fileWrite(pCE->fdlog, acOut, -1);
(void)fileClose(pCE->fdlog);
pCE->fdlog = (CONSFILE *) 0;
}
pCE->fup = 0;
pCE->nolog = 0;
pCE->autoReUp = 0;
}
int
@ -627,6 +634,7 @@ ConsInit(pCE, pfdSet, useHostCache)
int useHostCache;
{
extern int FallBack();
static char acOut[BUFSIZ];
if (!useHostCache)
ClearHostCache();
@ -642,6 +650,7 @@ ConsInit(pCE, pfdSet, useHostCache)
}
}
pCE->autoReUp = 0;
pCE->fronly = 0;
pCE->nolog = 0;
(void)strcpy(pCE->acline, pCE->server);
@ -659,6 +668,8 @@ ConsInit(pCE, pfdSet, useHostCache)
Error("open: %s: %s", pCE->lfile, strerror(errno));
return;
}
sprintf(acOut, "[-- Console up -- %s]\r\n", strtime(NULL));
fileWrite(pCE->fdlog, acOut, -1);
if (0 != pCE->fvirtual) {
if (-1 == (pCE->fdtty = FallBack(pCE->acslave, pCE->dfile))) {

View File

@ -1,7 +1,7 @@
/*
* $Id: consent.h,v 5.22 2001-07-23 00:28:00-07 bryan Exp $
* $Id: consent.h,v 5.25 2002-01-21 02:48:33-08 bryan Exp $
*
* Copyright conserver.com, 2000-2001
* Copyright conserver.com, 2000
*
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
*
@ -65,12 +65,14 @@ typedef struct consent { /* console information */
PARITY *pparity; /* the parity on this line */
int mark; /* Mark (chime) interval */
long nextMark; /* Next mark (chime) time */
short int breakType; /* break type [1-9] */
/* Used if network console */
int isNetworkConsole;
char networkConsoleHost[MAXSERVLEN];
int networkConsolePort;
int telnetState;
int autoReUp;
/* used if virtual console */
char acslave[MAXDEVLEN]; /* pseudo-device slave side */

View File

@ -1,13 +1,13 @@
.\" @(#)conserver.8 01/06/91 OSU CIS; Thomas A. Fine
.\" $Id: conserver.man,v 1.15 2001-07-26 10:23:52-07 bryan Exp $
.\" $Id: conserver.man,v 1.19 2002-01-20 20:02:49-08 bryan Exp $
.TH CONSERVER 8 "Local"
.SH NAME
conserver \- console server daemon
.SH SYNOPSIS
\fBconserver\fP [\fB\-7dDhinuvV\fP] [\fB\-a\fP \fItype\fP]
\fBconserver\fP [\fB\-7dDhinouvV\fP] [\fB\-a\fP \fItype\fP]
[\fB\-M\fP \fIaddr\fP] [\fB\-p\fP \fIport\fP] [\fB\-b\fP \fIport\fP]
[\fB\-C\fP \fIconfig\fP] [\fB\-P\fP \fIpasswd\fP]
[\fB\-L\fP \fIlogfile\fP]
[\fB\-L\fP \fIlogfile\fP] [\fB\-O\fP \fImin\fP]
.SH DESCRIPTION
.B Conserver
is the daemon that manages
@ -159,6 +159,15 @@ The default is to bind to all addresses.
.B \-n
Obsolete (now a no-op); see \fB\-u\fP.
.TP
.B \-o
Normally, a client connecting to a ``downed'' console does just that.
Using this flag, the server will automatically attempt to open
(``bring up'') the console when the client connects.
.TP
.BI \-O min
Enable periodic attempts (every \fImin\fP minutes) to open (``bring up'')
all downed consoles (similar to sending a SIGUSR1).
.TP
.BI \-p port
Set the TCP port for the master process to listen on.
This may be either a port number or a service name.
@ -211,6 +220,10 @@ log of errors and informational messages
Additionally, output from individual consoles may be logged
to separate files specified in
.BR conserver.cf (5).
.SH BUGS
All client/server traffic (including root and user passwords) is
passed ``in the clear''. Extreme care should be taken to insure no one
is ``snooping'' this private data. One day the traffic will be encrypted.
.SH AUTHORS
Thomas A. Fine, Ohio State Computer Science
.br

View File

@ -1,7 +1,7 @@
/*
* $Id: fallback.c,v 5.39 2001-07-26 00:58:55-07 bryan Exp $
* $Id: fallback.c,v 5.40 2002-01-21 02:48:33-08 bryan Exp $
*
* Copyright conserver.com, 2000-2001
* Copyright conserver.com, 2000
*
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
*

View File

@ -1,7 +1,7 @@
/*
* $Id: group.c,v 5.140 2001-10-16 21:29:01-07 bryan Exp $
* $Id: group.c,v 5.151 2002-01-21 02:48:33-08 bryan Exp $
*
* Copyright conserver.com, 2000-2001
* Copyright conserver.com, 2000
*
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
*
@ -189,7 +189,7 @@ FlagReUp(sig)
}
static void
ReUp(pGE, prinit)
ReUp(pGE, automatic, prinit)
GRPENT *pGE;
fd_set *prinit;
{
@ -201,11 +201,11 @@ ReUp(pGE, prinit)
}
for (i = 0, pCE = pGE->pCElist; i < pGE->imembers; ++i, ++pCE) {
if (pCE->fup) {
continue;
}
if (fNoinit)
if (pCE->fup || fNoinit || (automatic == 1 && !pCE->autoReUp))
continue;
if (automatic)
Info("%s: automatic reinitialization [%s]", pCE->server,
strtime(NULL));
ConsInit(pCE, prinit, 1);
}
}
@ -265,10 +265,13 @@ Mark(pGE, prinit)
if ((pCE->nextMark > 0) && (tyme >= pCE->nextMark)) {
Debug("[-- MARK --] stamp added to %s", pCE->lfile);
(void)fileWrite(pCE->fdlog, acOut, -1);
pCE->nextMark = tyme + pCE->mark;
pCE->nextMark += pCE->mark;
}
}
alarm(ALARMTIME);
if ((i = (ALARMTIME - (tyme % 60))) <= 0) {
i = 1;
}
alarm(i);
}
void
@ -438,7 +441,14 @@ ReapVirt(pGE, prinit)
pCE->pCLwr = (CONSCLIENT *) 0;
}
ConsDown(pCE, prinit);
/* Try an initial reconnect */
Info("%s: automatic reinitialization [%s]", pCE->server,
strtime(NULL));
ConsInit(pCE, prinit, 0);
/* If we didn't succeed, try again later */
if (!pCE->fup)
pCE->autoReUp = 1;
}
}
}
@ -469,6 +479,7 @@ CheckPasswd(pCLServing, pw_string)
Info("Cannot open passwd file %s: %s", pcPasswd, strerror(errno));
if ((struct passwd *)0 == (pwd = getpwuid(0))) {
(void)endpwent();
fileWrite(pCLServing->fd, "no root passwd?\r\n", -1);
return 0;
}
@ -476,6 +487,7 @@ CheckPasswd(pCLServing, pw_string)
if (fVerbose)
Info("User %s logging into server %s via root passwd",
pCLServing->acid, pCLServing->pCEwant->server);
(void)endpwent();
return 1;
}
} else {
@ -547,6 +559,7 @@ CheckPasswd(pCLServing, pw_string)
pCLServing->pCEwant->server);
}
fclose(fp);
(void)endpwent();
return 1;
} else {
char *p;
@ -561,6 +574,7 @@ CheckPasswd(pCLServing, pw_string)
pCLServing->pCEwant->server);
}
fclose(fp);
(void)endpwent();
return 1;
}
if (domainHack) {
@ -580,6 +594,7 @@ CheckPasswd(pCLServing, pw_string)
break;
}
fclose(fp);
(void)endpwent();
}
return 0;
@ -606,6 +621,310 @@ IdleTyme(tyme)
return timestr;
}
void
sendRealBreak(pCLServing, pCEServing)
CONSCLIENT *pCLServing;
CONSENT *pCEServing;
{
Debug("Sending a break to %s", pCEServing->server);
if (pCEServing->isNetworkConsole) {
char haltseq[2];
haltseq[0] = IAC;
haltseq[1] = BREAK;
write(pCEServing->fdtty, haltseq, 2);
} else {
#if HAVE_TERMIO_H
if (-1 == ioctl(pCEServing->fdtty, TCSBRK, (char *)0)) {
fileWrite(pCLServing->fd, "failed]\r\n", -1);
return;
}
#else
# if HAVE_TCSENDBREAK
if (-1 == tcsendbreak(pCEServing->fdtty, 0)) {
fileWrite(pCLServing->fd, "failed]\r\n", -1);
return;
}
# else
# if HAVE_TERMIOS_H
if (-1 == ioctl(pCEServing->fdtty, TIOCSBRK, (char *)0)) {
fileWrite(pCLServing->fd, "failed]\r\n", -1);
return;
}
fileWrite(pCLServing->fd, "- ", -1);
sleep(1);
if (-1 == ioctl(pCEServing->fdtty, TIOCCBRK, (char *)0)) {
fileWrite(pCLServing->fd, "failed]\r\n", -1);
return;
}
# endif
# endif
#endif
}
}
void
prettyPrintBreak(fd, str)
CONSFILE *fd;
STRING *str;
{
static STRING output = { (char *)0, 0, 0 };
unsigned char c;
char *p;
if (str->used == 0)
return;
buildMyString((char *)0, &output);
for (p = str->string; *p != '\000'; p++) {
c = *p & 0xff;
if (c > 127) {
char oct[5];
oct[4] = '\000';
oct[3] = c % 8;
c /= 8;
oct[2] = c % 8;
c /= 8;
oct[1] = c % 8;
oct[0] = '\\';
buildMyString(oct, &output);
} else if (c < ' ' || c == '\177') {
buildMyStringChar('^', &output);
buildMyStringChar(c ^ 0100, &output);
} else {
buildMyStringChar(c, &output);
}
}
if (output.used != 0)
(void)fileWrite(fd, output.string, -1);
}
void
doBreakWork(pCLServing, pCEServing, bt, cleanup)
CONSCLIENT *pCLServing;
CONSENT *pCEServing;
short int bt;
short int cleanup;
{
char *p, s;
short int backslash;
short int cntrl;
char oct[3];
short int octs = -1;
STRING cleaned = { (char *)0, 0, 0 };
if (cleanup && (bt < 1 || bt > 9))
return;
if (bt < 0 || bt > 9) {
(void)fileWrite(pCLServing->fd, "aborted]\r\n", -1);
return;
}
if (bt == 0)
bt = pCEServing->breakType;
if (bt == 0 || breakList[bt - 1].used == 0) {
if (!cleanup)
(void)fileWrite(pCLServing->fd, "undefined]\r\n", -1);
return;
}
p = breakList[bt - 1].string;
backslash = 0;
cntrl = 0;
while ((s = (*p++)) != '\000') {
if (octs != -1) {
if (s >= '0' && s <= '7') {
if (++octs < 3) {
oct[octs] = s;
}
continue;
} else {
int i;
if (octs > 2) {
Error("octal number too large in BREAK%d sequence",
bt);
} else {
if (cleanup) {
buildMyStringChar('\\', &cleaned);
for (i = 0; i <= 1 - octs; i++)
buildMyStringChar('0', &cleaned);
for (i = 0; i <= octs; i++)
buildMyStringChar(oct[i], &cleaned);
} else {
char c = '\000';
c = oct[0] - '0';
for (i = 1; i <= octs; i++)
c = c * 8 + (oct[i] - '0');
(void)write(pCEServing->fdtty, &c, 1);
}
}
octs = -1;
}
}
if (s == '\\' && !cntrl) {
if (backslash) {
if (cleanup)
buildMyString("\\\\", &cleaned);
else
(void)write(pCEServing->fdtty, &s, 1);
backslash = 0;
} else
backslash = 1;
continue;
}
if (backslash) {
char o = s;
if (s == 'a')
s = '\a';
else if (s == 'b')
s = '\b';
else if (s == 'f')
s = '\f';
else if (s == 'n')
s = '\n';
else if (s == 'r')
s = '\r';
else if (s == 't')
s = '\t';
else if (s == 'v')
s = '\v';
else if (s == '^')
s = '^';
else if (s == 'z') {
if (cleanup)
buildMyString("\\z", &cleaned);
else
(void)sendRealBreak(pCLServing, pCEServing);
s = '\000';
} else if (s >= '0' && s <= '7') {
if (++octs < 3) {
oct[octs] = s;
}
s = '\000';
} else {
if (octs < 0) {
if (cleanup)
buildMyStringChar(o, &cleaned);
else
(void)write(pCEServing->fdtty, &s, 1);
s = '\000';
} else if (octs > 2) {
Error("octal number too large in BREAK%d sequence",
bt);
octs = -1;
} else {
int i;
if (cleanup) {
buildMyStringChar('\\', &cleaned);
for (i = 0; i <= octs; i++)
buildMyStringChar(oct[i], &cleaned);
} else {
char c = '\000';
c = oct[0] - '0';
for (i = 1; i <= octs; i++)
c = c * 8 + (oct[i] - '0');
(void)write(pCEServing->fdtty, &c, 1);
}
octs = -1;
}
}
if (s != '\000') {
if (cleanup) {
buildMyStringChar('\\', &cleaned);
buildMyStringChar(o, &cleaned);
} else
(void)write(pCEServing->fdtty, &s, 1);
}
backslash = 0;
continue;
}
if (s == '^') {
if (cntrl) {
if (cleanup)
buildMyString("^^", &cleaned);
else {
s = s & 0x1f;
(void)write(pCEServing->fdtty, &s, 1);
}
cntrl = 0;
} else
cntrl = 1;
continue;
}
if (cntrl) {
if (s == '?') {
if (cleanup)
buildMyString("^?", &cleaned);
else {
s = 0x7f; /* delete */
(void)write(pCEServing->fdtty, &s, 1);
}
continue;
}
if (cleanup) {
buildMyStringChar('^', &cleaned);
buildMyStringChar(s, &cleaned);
} else {
s = s & 0x1f;
(void)write(pCEServing->fdtty, &s, 1);
}
cntrl = 0;
continue;
}
if (cleanup)
buildMyStringChar(s, &cleaned);
else
(void)write(pCEServing->fdtty, &s, 1);
}
if (octs > 2) {
Error("octal number too large in BREAK%d sequence", bt);
} else if (octs != -1) {
int i;
if (cleanup) {
buildMyStringChar('\\', &cleaned);
for (i = 0; i <= 1 - octs; i++)
buildMyStringChar('0', &cleaned);
for (i = 0; i <= octs; i++)
buildMyStringChar(oct[i], &cleaned);
} else {
char c = '\000';
c = oct[0] - '0';
for (i = 1; i <= octs; i++)
c = c * 8 + (oct[i] - '0');
(void)write(pCEServing->fdtty, &c, 1);
}
}
if (backslash)
Error("trailing backslash ignored in BREAK%d sequence", bt);
if (cntrl)
Error("trailing circumflex ignored in BREAK%d sequence", bt);
if (cleanup) {
free(breakList[bt - 1].string);
breakList[bt - 1] = cleaned;
} else
fileWrite(pCLServing->fd, "sent]\r\n", -1);
}
void
sendBreak(pCLServing, pCEServing, bt)
CONSCLIENT *pCLServing;
CONSENT *pCEServing;
short int bt;
{
doBreakWork(pCLServing, pCEServing, bt, 0);
}
void
cleanupBreak(bt)
short int bt;
{
doBreakWork((CONSCLIENT *) 0, (CONSENT *) 0, bt, 1);
}
/* routine used by the child processes. (ksb/fine)
* Most of it is escape sequence parsing.
* fine:
@ -647,7 +966,8 @@ Kiddie(pGE, sfd)
int iConsole;
int i, nr;
struct hostent *hpPeer;
long tyme;
time_t tyme;
time_t lastup = time(NULL); /* last time we tried to up all downed */
int fd;
CONSENT CECtl; /* our control `console' */
char cType;
@ -681,6 +1001,7 @@ Kiddie(pGE, sfd)
pCE[iConsole].pCLon = pCE[iConsole].pCLwr = (CONSCLIENT *) 0;
pCE[iConsole].fdlog = (CONSFILE *) 0;
pCE[iConsole].fdtty = -1;
pCE[iConsole].autoReUp = 0;
}
sprintf(CECtl.server, "ctl_%d", pGE->port);
CECtl.inamelen = strlen(CECtl.server); /* bogus, of course */
@ -732,7 +1053,7 @@ Kiddie(pGE, sfd)
/* on a SIGALRM we should mark log files */
simpleSignal(SIGALRM, FlagMark);
alarm(ALARMTIME);
fSawMark = 1; /* start during first pass */
/* the MAIN loop a group server
*/
@ -754,11 +1075,25 @@ Kiddie(pGE, sfd)
}
if (fSawReUp) {
fSawReUp = 0;
ReUp(pGE, &rinit);
ReUp(pGE, 0, &rinit);
if (fReopenall > 0) {
lastup = time(NULL);
}
}
if (fSawMark) {
fSawMark = 0;
Mark(pGE, &rinit);
ReUp(pGE, 1, &rinit);
}
/* Is it time to reup everything? */
if ((fReopenall > 0) &&
((time(NULL) - lastup) > (fReopenall * 60))) {
/* Note the new lastup time only after we finish.
*/
ReUp(pGE, 2, &rinit);
lastup = time(NULL);
}
rmask = rinit;
@ -796,8 +1131,14 @@ Kiddie(pGE, sfd)
pCEServing->pCLwr = (CONSCLIENT *) 0;
}
/*ConsInit(pCEServing, &rinit, 0); */
ConsDown(pCEServing, &rinit);
/* Try an initial reconnect */
Info("%s: automatic reinitialization [%s]",
pCEServing->server, strtime(NULL));
ConsInit(pCEServing, &rinit, 0);
/* If we didn't succeed, try again later */
if (!pCEServing->fup)
pCEServing->autoReUp = 1;
continue;
}
@ -944,7 +1285,7 @@ Kiddie(pGE, sfd)
if (pCEServing->nolog) {
pCEServing->nolog = 0;
sprintf(acOut,
"[Console logging restored (logout)]\r\n");
"[-- Console logging restored (logout) --]\r\n");
(void)fileWrite(pCEServing->fdlog, acOut, -1);
}
pCEServing->pCLwr = FindWrite(pCEServing->pCLon);
@ -1062,7 +1403,7 @@ Kiddie(pGE, sfd)
case S_HOST:
/* append char to buffer, check for \n
* continue if incomplete
* else swtich to new host
* else switch to new host
*/
if (pCLServing->icursor ==
sizeof(pCLServing->accmd)) {
@ -1199,7 +1540,9 @@ Kiddie(pGE, sfd)
}
pCEServing->pCLon = pCLServing;
if (fNoinit && !pCEServing->fup)
/* try to reopen line if specified at server startup
*/
if ((fNoinit || fReopen) && !pCEServing->fup)
ConsInit(pCEServing, &rinit, 0);
/* try for attach on new console
@ -1304,73 +1647,42 @@ Kiddie(pGE, sfd)
case S_HALT1: /* halt sequence? */
pCLServing->iState = S_NORMAL;
if (acIn[i] != '1' && acIn[i] != '2') {
if (acIn[i] != '?' &&
(acIn[i] < '0' || acIn[i] > '9')) {
fileWrite(pCLServing->fd, "aborted]\r\n", -1);
continue;
}
/* send a break
*/
if (acIn[i] == '1') {
Debug("Sending a break to %s",
pCEServing->server);
if (pCEServing->isNetworkConsole) {
char haltseq[2];
haltseq[0] = IAC;
haltseq[1] = BREAK;
write(pCEServing->fdtty, haltseq, 2);
} else {
#if HAVE_TERMIO_H
if (-1 ==
ioctl(pCEServing->fdtty, TCSBRK,
(char *)0)) {
fileWrite(pCLServing->fd,
"failed]\r\n", -1);
continue;
if (acIn[i] == '?') {
int i;
fileWrite(pCLServing->fd, "list]\r\n", -1);
i = pCEServing->breakType;
if (i == 0 || breakList[i - 1].used == 0)
(void)fileWrite(pCLServing->fd,
" 0 <undefined>\r\n", -1);
else {
(void)fileWrite(pCLServing->fd, " 0 `",
-1);
prettyPrintBreak(pCLServing->fd,
&breakList[i - 1].string);
(void)fileWrite(pCLServing->fd, "'\r\n",
-1);
}
for (i = 0; i < 9; i++) {
if (breakList[i].used) {
sprintf(acOut, " %d `", i + 1);
(void)fileWrite(pCLServing->fd, acOut,
-1);
prettyPrintBreak(pCLServing->fd,
&breakList[i].string);
(void)fileWrite(pCLServing->fd,
"'\r\n", -1);
}
#else
# if HAVE_TCSENDBREAK
if (-1 ==
tcsendbreak(pCEServing->fdtty, 0)) {
fileWrite(pCLServing->fd,
"failed]\r\n", -1);
continue;
}
# else
# if HAVE_TERMIOS_H
if (-1 ==
ioctl(pCEServing->fdtty, TIOCSBRK,
(char *)0)) {
fileWrite(pCLServing->fd,
"failed]\r\n", -1);
continue;
}
fileWrite(pCLServing->fd, "- ", -1);
sleep(1);
if (-1 ==
ioctl(pCEServing->fdtty, TIOCCBRK,
(char *)0)) {
fileWrite(pCLServing->fd,
"failed]\r\n", -1);
continue;
}
# endif
# endif
#endif
}
} else {
char haltseq[3];
Debug("Sending an alt-break to %s",
pCEServing->server);
/* The default Solaris 8 `alternate' break... */
haltseq[0] = 0x0D; /* CR */
haltseq[1] = 0x7E; /* Tilde */
haltseq[2] = 0x02; /* Ctrl-B */
write(pCEServing->fdtty, haltseq, 3);
int bt = acIn[i] - '0';
(void)sendBreak(pCLServing, pCEServing, bt);
}
fileWrite(pCLServing->fd, "sent]\r\n", -1);
continue;
case S_CATTN: /* redef escape sequence? */
@ -1699,7 +2011,7 @@ Kiddie(pGE, sfd)
fileWrite(pCLServing->fd,
"logging off]\r\n", -1);
sprintf(acOut,
"[Console logging disabled by %s]\r\n",
"[-- Console logging disabled by %s --]\r\n",
pCLServing->acid);
(void)fileWrite(pCEServing->fdlog,
acOut, -1);
@ -1707,7 +2019,7 @@ Kiddie(pGE, sfd)
fileWrite(pCLServing->fd,
"logging on]\r\n", -1);
sprintf(acOut,
"[Console logging restored by %s]\r\n",
"[-- Console logging restored by %s --]\r\n",
pCLServing->acid);
(void)fileWrite(pCEServing->fdlog,
acOut, -1);

View File

@ -1,7 +1,7 @@
/*
* $Id: group.h,v 5.18 2001-07-30 01:57:42-07 bryan Exp $
* $Id: group.h,v 5.20 2002-01-21 02:48:33-08 bryan Exp $
*
* Copyright conserver.com, 2000-2001
* Copyright conserver.com, 2000
*
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
*
@ -49,3 +49,4 @@ extern void Spawn();
extern int CheckPass();
extern const char *strtime();
extern void tagLogfile();
extern void cleanupBreak();

View File

@ -1,7 +1,7 @@
/*
* $Id: main.c,v 5.78 2001-07-27 12:34:48-07 bryan Exp $
* $Id: main.c,v 5.81 2002-01-21 02:48:33-08 bryan Exp $
*
* Copyright conserver.com, 2000-2001
* Copyright conserver.com, 2000
*
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
*
@ -56,7 +56,8 @@
#include <version.h>
int fAll = 0, fVerbose = 0, fSoftcar = 0, fNoinit = 0, fVersion =
0, fStrip = 0, fDaemon = 0, fUseLogfile = 0;
0, fStrip = 0, fDaemon = 0, fUseLogfile = 0, fReopen = 0, fReopenall =
0;
char chDefAcc = 'r';
@ -163,7 +164,7 @@ daemonize()
static char u_terse[] =
" [-7dDhinuvV] [-a type] [-M addr] [-p port] [-b port] [-C config] [-P passwd] [-L logfile]";
" [-7dDhinouvV] [-a type] [-M addr] [-p port] [-b port] [-C config] [-P passwd] [-L logfile] [-O min]";
static char *apcLong[] = {
"7 strip the high bit of all console data",
"a type set the default access type",
@ -176,6 +177,8 @@ static char *apcLong[] = {
"L logfile give a new logfile path to the server process",
"M addr address to listen on (all addresses by default)",
"n obsolete - see -u",
"o reopen downed console on client connect",
"O min reopen all downed consoles every <min> minutes",
"p port port to listen on",
"P passwd give a new passwd file to the server process",
"u copy \"unloved\" console data to stdout",
@ -279,7 +282,7 @@ main(argc, argv)
int i, j;
FILE *fpConfig;
struct hostent *hpMe;
static char acOpts[] = "7a:b:C:dDhiL:M:np:P:suVv";
static char acOpts[] = "7a:b:C:dDhiL:M:noO:p:P:suVv";
extern int optopt;
extern char *optarg;
REMOTE *pRCUniq; /* list of uniq console servers */
@ -374,6 +377,14 @@ main(argc, argv)
case 'n':
/* noop now */
break;
case 'o':
/* try reopening downed consoles on connect */
fReopen = 1;
break;
case 'O':
/* How often to try opening all down consoles, in minutes */
fReopenall = atoi(optarg);
break;
case 'p':
pcPort = optarg;
break;
@ -438,6 +449,7 @@ main(argc, argv)
else
Info("Started as `%s' by `%s' at %s", curuser,
(origuser == (char *)0) ? curuser : origuser, strtime(NULL));
(void)endpwent();
#if HAVE_GETSPNAM
if (0 != geteuid()) {

View File

@ -1,7 +1,7 @@
/*
* $Id: main.h,v 5.27 2001-07-11 12:52:57-07 bryan Exp $
* $Id: main.h,v 5.29 2002-01-21 02:48:33-08 bryan Exp $
*
* Copyright conserver.com, 2000-2001
* Copyright conserver.com, 2000
*
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
*
@ -38,7 +38,7 @@
*/
extern char rcsid[];
extern int fAll, fVerbose, fSoftcar, fNoinit, fInteractive, fStrip,
fDaemon;
fDaemon, fReopen, fReopenall;
extern char chDefAcc;
extern unsigned long bindAddr;
extern unsigned int bindPort, bindBasePort;

View File

@ -1,7 +1,7 @@
/*
* $Id: master.c,v 5.63 2001-10-10 11:52:57-07 bryan Exp $
* $Id: master.c,v 5.65 2002-01-21 02:48:33-08 bryan Exp $
*
* Copyright conserver.com, 2000-2001
* Copyright conserver.com, 2000
*
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
*
@ -437,7 +437,7 @@ Master(pRCUniq)
if ('t' == cType) {
fileWrite(csocket, "trusted -- terminated\r\n", -1);
fSawQuit = 1;
kill(parentpid, SIGTERM);
} else if ((char *)0 == pcArgs) {
fileWrite(csocket, "must be trusted to terminate\r\n", -1);
} else if ((struct passwd *)0 == (pwd = getpwuid(0))) {
@ -452,7 +452,7 @@ Master(pRCUniq)
exit(EX_OK);
}
if (0 == strcmp(acIn, "pid")) {
sprintf(acOut, "%d\r\n", (int)getpid());
sprintf(acOut, "%d\r\n", parentpid);
(void)fileWrite(csocket, acOut, -1);
(void)fileClose(csocket);
exit(EX_OK);

View File

@ -1,7 +1,7 @@
/*
* $Id: master.h,v 5.11 2001-07-09 02:16:53-07 bryan Exp $
* $Id: master.h,v 5.12 2002-01-21 02:48:33-08 bryan Exp $
*
* Copyright conserver.com, 2000-2001
* Copyright conserver.com, 2000
*
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
*

View File

@ -1,7 +1,7 @@
/*
* $Id: port.h,v 1.28 2001-07-17 14:14:36-07 bryan Exp $
* $Id: port.h,v 1.31 2002-01-21 02:48:33-08 bryan Exp $
*
* Copyright conserver.com, 2000-2001
* Copyright conserver.com, 2000
*
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
*
@ -44,6 +44,18 @@
# define USLEEP_FOR_SLOW_PORTS 100000
#endif
/* If, when processing a logfile for replaying the last N lines,
* we end up seeing more than MAXREPLAYLINELEN characters in a line,
* abort processing and display the data. Why? There could be some
* very large logfiles and very long lines and we'd chew up lots of
* memory and send a LOT of data down to the client - all potentially
* bad. If there's a line over this in size, would you really want to
* see the whole thing (and possibly others)?
*/
#if !defined(MAXREPLAYLINELEN)
# define MAXREPLAYLINELEN 10000
#endif
/* the default escape sequence used to give meta commands
*/
#if !defined(DEFATTN)
@ -53,12 +65,6 @@
# define DEFESC 'c'
#endif
/* the max number of characters conserver will replay for you (the r command)
*/
#if !defined(MAXREPLAY)
# define MAXREPLAY (80*25)
#endif
/* communication constants
*/
#define OB_SUSP 'Z' /* suspended by server */

View File

@ -1,7 +1,7 @@
/*
* $Id: readcfg.c,v 5.62 2001-08-04 18:33:54-07 bryan Exp $
* $Id: readcfg.c,v 5.70 2002-01-21 02:48:33-08 bryan Exp $
*
* Copyright conserver.com, 2000-2001
* Copyright conserver.com, 2000
*
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
*
@ -66,6 +66,7 @@ int
ACCESS *pACList; /* `who do you love' (or trust) */
int
iAccess; /* how many access restrictions we have */
STRING *breakList = (STRING *) 0; /* list of break sequences */
/* Parse the [number(m|h|d|l)[a]] spec
* return 0 on invalid spec, non-zero on valid spec
@ -75,6 +76,7 @@ parseMark(pcFile, iLine, pcMark, tyme, pCE)
const char *pcFile;
const int iLine;
const char *pcMark;
time_t tyme;
CONSENT *pCE;
{
char mark[BUFSIZ];
@ -157,7 +159,24 @@ parseMark(pcFile, iLine, pcMark, tyme, pCE)
if (factor && value) {
pCE->mark = value;
if (factor > 0) {
pCE->nextMark = tyme + value;
tyme -= (tyme % 60); /* minute boundary */
if ((value <= 60 * 60 && (60 * 60) % value == 0)
|| (value > 60 * 60 && (60 * 60 * 24) % value == 0)) {
struct tm *tm;
time_t now;
/* the increment is a "nice" subdivision of an hour
* or a day
*/
now = tyme;
if ((struct tm *)0 != (tm = localtime(&tyme))) {
tyme -= tm->tm_min * 60; /* hour boundary */
tyme -= tm->tm_hour * 60 * 60; /* day boundary */
tyme += ((now - tyme) / value) * value;
/* up to nice bound */
}
}
pCE->nextMark = tyme + value; /* next boundary */
} else {
pCE->nextMark = value;
}
@ -234,11 +253,20 @@ ReadCfg(pcFile, fp)
ppRC = &pRCList;
iLocal = 0;
if ((STRING *) 0 == breakList) {
breakList = (STRING *) calloc(9, sizeof(STRING));
if ((STRING *) 0 == breakList) {
OutOfMem();
}
}
buildMyString((char *)0, &acInSave);
buildMyString("\\z", &breakList[0]);
buildMyString("\\r~^b", &breakList[1]);
buildMyString("#.reset -x\\r", &breakList[2]);
iG = minG = 0;
iLine = 0;
while ((acIn = readLine(fp, &acInSave, &iLine)) != (unsigned char *)0) {
char *pcLine, *pcMode, *pcLog, *pcRem, *pcStart, *pcMark;
char *pcLine, *pcMode, *pcLog, *pcRem, *pcStart, *pcMark, *pcBreak;
acStart = pruneSpace(acIn);
@ -259,6 +287,17 @@ ReadCfg(pcFile, fp)
defMark[0] = '\000';
} else if (0 == strcmp(acStart, "DOMAINHACK")) {
domainHack = 1;
} else if (0 == strncmp(acStart, "BREAK", 5) &&
acStart[5] >= '1' && acStart[5] <= '9' &&
acStart[6] == '\000') {
Debug("BREAK%c found with `%s'", acStart[5], pcLine);
if (pcLine[0] == '\000') {
buildMyString((char *)0, &breakList[acStart[5] - '1']);
} else {
buildMyString((char *)0, &breakList[acStart[5] - '1']);
buildMyString(pcLine, &breakList[acStart[5] - '1']);
cleanupBreak(acStart[5] - '0');
}
} else {
Error("%s(%d) unknown variable `%s'", pcFile, iLine,
acStart);
@ -289,6 +328,19 @@ ReadCfg(pcFile, fp)
pcMark = (char *)0;
}
if ((char *)0 == pcMark) {
pcBreak = (char *)0;
} else {
if ((char *)0 != (pcBreak = strchr(pcMark, ':'))) {
*pcBreak++ = '\000';
pcMark = pruneSpace(pcMark);
pcBreak = pruneSpace(pcBreak);
/* Ignore null specs */
if (pcBreak[0] == '\000')
pcBreak = (char *)0;
}
}
/* if this server remote?
* (contains an '@host' where host is not us)
* if so just add it to a linked list of remote hosts
@ -395,6 +447,18 @@ ReadCfg(pcFile, fp)
(void)parseMark(pcFile, iLine, defMark, tyme, pCE);
}
pCE->breakType = 1;
if (pcBreak) {
int bt;
bt = atoi(pcBreak);
if (bt > 9 || bt < 0) {
Error("%s(%d) bad break spec `%d'", pcFile, iLine, bt);
} else {
pCE->breakType = (short int)bt;
Debug("breakType set to %d", pCE->breakType);
}
}
if (pcLine[0] == '!') {
pcLine = pruneSpace(pcLine + 1);
pCE->isNetworkConsole = 1;
@ -452,7 +516,7 @@ ReadCfg(pcFile, fp)
}
*ppRC = (REMOTE *) 0;
/* make a vector of access restructions
/* make a vector of access restrictions
*/
iG = iAccess = 0;
pACList = (ACCESS *) 0;

View File

@ -1,7 +1,7 @@
/*
* $Id: readcfg.h,v 5.13 2001-07-30 01:57:27-07 bryan Exp $
* $Id: readcfg.h,v 5.16 2002-01-21 02:48:33-08 bryan Exp $
*
* Copyright conserver.com, 2000-2001
* Copyright conserver.com, 2000
*
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
*
@ -47,6 +47,7 @@ extern int
iAccess; /* how many access restrictions we have */
extern int
iLocal; /* how many local consoles we have */
extern STRING *breakList; /* list of break sequences */
extern void ReadCfg();
extern char *pruneSpace();

View File

@ -1,7 +1,7 @@
/*
* $Id: util.c,v 1.26 2001-08-04 18:33:27-07 bryan Exp $
* $Id: util.c,v 1.31 2002-01-21 02:48:33-08 bryan Exp $
*
* Copyright conserver.com, 2000-2001
* Copyright conserver.com, 2000
*
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
*/
@ -15,6 +15,7 @@
#include <config.h>
#include <sys/socket.h>
#include <ctype.h>
#include <sys/select.h>
#include <compat.h>
#include <port.h>
@ -37,6 +38,38 @@ OutOfMem()
exit(EX_UNAVAILABLE);
}
char *
buildMyStringChar(ch, msg)
const int ch;
STRING *msg;
{
if (msg->used + 1 >= msg->allocated) {
if (0 == msg->allocated) {
msg->allocated = 1024 * sizeof(char);
msg->string = (char *)calloc(1, msg->allocated);
} else {
msg->allocated += 1024 * sizeof(char);
msg->string = (char *)realloc(msg->string, msg->allocated);
}
Debug("buildMyStringChar: tried allocating %lu bytes",
msg->allocated);
if (msg->string == (char *)0)
OutOfMem();
}
if (msg->used) {
msg->string[msg->used - 1] = ch; /* overwrite NULL and */
msg->string[msg->used++] = '\000'; /* increment by one */
Debug("buildMyStringChar: added 1 char (%d/%d now)", msg->used,
msg->allocated);
} else {
msg->string[msg->used++] = ch; /* no NULL, so store stuff */
msg->string[msg->used++] = '\000'; /* and increment by two */
Debug("buildMyStringChar: added 2 chars (%d/%d now)", msg->used,
msg->allocated);
}
return msg->string;
}
char *
buildMyString(str, msg)
const char *str;
@ -64,7 +97,13 @@ buildMyString(str, msg)
if (msg->string == (char *)0)
OutOfMem();
}
strcat(msg->string, str);
#if HAVE_MEMCPY
(void)memcpy(msg->string + (msg->used ? msg->used - 1 : 0), str, len);
#else
(void)bcopy(str, msg->string + (msg->used ? msg->used - 1 : 0), len);
#endif
if (msg->used)
len--;
msg->used += len;
Debug("buildMyString: added %d chars (%d/%d now)", len, msg->used,
msg->allocated);
@ -284,6 +323,11 @@ maxfiles()
# endif /* HAVE_GETDTABLESIZE */
# endif /* HAVE_GETRLIMIT */
#endif /* HAVE_SYSCONF */
#ifdef FD_SETSIZE
if (FD_SETSIZE <= mf) {
mf = (FD_SETSIZE - 1);
}
#endif
Debug("maxfiles=%d", mf);
return mf;
}
@ -430,12 +474,10 @@ fileRead(cfp, buf, len)
void *buf;
int len;
{
int retval;
int retval = 0;
switch (cfp->ftype) {
case simpleFile:
retval = read(cfp->fd, buf, len);
break;
case simpleSocket:
retval = read(cfp->fd, buf, len);
break;
@ -446,7 +488,13 @@ fileRead(cfp, buf, len)
#endif
}
Debug("File I/O: Read %d bytes from fd %d", retval, cfp->fd);
if (retval >= 0) {
Debug("File I/O: Read %d byte%s from fd %d", retval,
(retval == 1) ? "" : "s", cfp->fd);
} else {
Debug("File I/O: Read of %d byte%s from fd %d: %s", len,
(retval == 1) ? "" : "s", cfp->fd, strerror(errno));
}
return retval;
}
@ -457,26 +505,39 @@ fileWrite(cfp, buf, len)
const char *buf;
int len;
{
int retval;
int len_orig = len;
int len_out = 0;
int retval = 0;
if (len < 0)
len = strlen(buf);
switch (cfp->ftype) {
case simpleFile:
retval = write(cfp->fd, buf, len);
break;
case simpleSocket:
retval = write(cfp->fd, buf, len);
while (len > 0) {
if ((retval = write(cfp->fd, buf, len)) < 0) {
break;
}
buf += retval;
len -= retval;
len_out += retval;
}
break;
#ifdef TLS_SUPPORT
case TLSSocket:
retval = SSL_write(cfp->sslfd, buf, len);
len_out = retval = SSL_write(cfp->sslfd, buf, len);
break;
#endif
}
Debug("File I/O: Wrote %d bytes to fd %d", retval, cfp->fd);
if (retval >= 0) {
Debug("File I/O: Wrote %d byte%s to fd %d", len_out,
(retval == 1) ? "" : "s", cfp->fd);
} else {
Debug("File I/O: Write of %d byte%s to fd %d: %s", len_orig,
(retval == 1) ? "" : "s", cfp->fd, strerror(errno));
}
return retval;
}

View File

@ -1,7 +1,7 @@
/*
* $Id: util.h,v 1.11 2001-08-04 18:33:17-07 bryan Exp $
* $Id: util.h,v 1.13 2002-01-21 02:48:33-08 bryan Exp $
*
* Copyright conserver.com, 2000-2001
* Copyright conserver.com, 2000
*
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
*/
@ -59,4 +59,5 @@ extern int fileFDNum();
extern void OutOfMem();
extern char *buildString();
extern char *buildMyString();
extern char *buildMyStringChar();
extern char *readLine();

View File

@ -1,7 +1,7 @@
/*
* $Id: version.h,v 1.29 2001-10-16 21:08:28-07 bryan Exp $
* $Id: version.h,v 1.30 2002-01-21 02:49:14-08 bryan Exp $
*
* Copyright conserver.com, 2000-2001
* Copyright conserver.com, 2000
*
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
*
@ -14,4 +14,4 @@
@(#) Copyright 2000 conserver.com.\n\
All rights reserved.\n"
#define THIS_VERSION "conserver.com version 7.1.3"
#define THIS_VERSION "conserver.com version 7.1.4"

View File

@ -1,7 +1,7 @@
/*
* $Id: console.c,v 5.71 2001-10-10 11:30:17-07 bryan Exp $
* $Id: console.c,v 5.73 2002-01-21 02:48:33-08 bryan Exp $
*
* Copyright conserver.com, 2000-2001
* Copyright conserver.com, 2000
*
* Maintainer/Enhancer: Bryan Stansell (bryan@conserver.com)
*
@ -769,7 +769,7 @@ CallUp(s, pcMaster, pcMach, pcHow, pcUser)
chAttn = DEFATTN;
chEsc = DEFESC;
} else {
/* tell the conserver to change escape sequences, assmue OK
/* tell the conserver to change escape sequences, assume OK
* (we'll find out soon enough)
*/
(void)sprintf(acMesg, "%c%ce%c%c", DEFATTN, DEFESC, chAttn, chEsc);

View File

@ -1,4 +1,4 @@
.\" $Id: console.man,v 1.12 2001-10-15 22:46:09-07 bryan Exp $
.\" $Id: console.man,v 1.16 2002-01-20 20:03:10-08 bryan Exp $
.TH CONSOLE 1 "Local"
.SH NAME
console \- console server client program
@ -115,9 +115,11 @@ using the \fB--with-port\fP option.
Display the pid of the master daemon process on each server.
.TP
.B \-q
The \fBconsole\fP client requests that the server daemon quit (shut down).
A password is sent in the protocol stream; if none is required for
the local host to shut down the server, just press <return>.
The \fBconsole\fP client connects to each server to request that the
server daemon quit (shut down). The root password of the host(s)
running conserver is required unless the local host is listed as
``trusted'' in the conserver.cf file; in that case, just
press <return>.
.TP
.B \-Q
Same as \fB\-q\fP but just acts on the primary server.
@ -186,12 +188,12 @@ forcibly attach read-write
group info
.IP L
toggle logging on/off
.IP l1
send a 3-second serial line break (might halt a Sun)
("ell" then "one", not the L1 key)
.IP l2
send the alternate break sequence (<CR>, tilde, CTRL-B)
(might halt a Sun)
.IP l?
list the break sequences available
.IP l0
send the break sequence associated with this console
.IP l1-9
send the specific break sequence
.IP o
close (if open) and reopen the line (to clear errors (silo overflows))
and the log file
@ -217,7 +219,7 @@ display list of commands
continue, ignore the escape sequence
.IP "^R (ctrl-R)"
replay the last line only
.IP \\\fIooo\fP
.IP \\\\\fIooo\fP
send character having octal code \fIooo\fP
(must specify three octal digits)
.IP \.
@ -282,8 +284,9 @@ console \-e \*(lq^[1\*(rq lv426
Requests a connection to the host ``lv426'' with the escape characters
set to ``escape one''.
.SH BUGS
Connections suspended under Dynix sometimes break the kernel when
resumed.
All client/server traffic (including root and user passwords) is
passed ``in the clear''. Extreme care should be taken to insure no one
is ``snooping'' this private data. One day the traffic will be encrypted.
.PP
It is possible to create a loop of console connections, with ugly results.
Never run \fBconsole\fP from within a console connection (unless you set each

View File

@ -4,7 +4,7 @@
#
%define pkg conserver
%define ver 7.1.3
%define ver 7.1.4
# define the name of the machine on which the main conserver
# daemon will be running if you don't want to use the default

View File

@ -1,7 +1,7 @@
PKG="conserver"
NAME="Console server and client"
CATEGORY="system"
VERSION="7.1.3"
VERSION="7.1.4"
DESC="Console server and client"
CLASSES=none
ARCH=sparc