Skip to content

Commit

Permalink
Imported from conserver-8.2.1.tar.gz
Browse files Browse the repository at this point in the history
  • Loading branch information
bstansell committed Jun 2, 2015
1 parent 8534a21 commit 4039e65
Show file tree
Hide file tree
Showing 19 changed files with 203 additions and 134 deletions.
10 changes: 9 additions & 1 deletion CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
CHANGES
=======

version 8.2.1 (Jun 2, 2015):
- added TCP keepalives between client and server - TCP-based consoles
already had the code - this was mostly an oversight
- patch for SEGV and task execution - patch by Artem Savkov
<asavkov@redhat.com>
- expanded break sequences from [1-9] to [1-9a-z] - based on patch by
Artem Savkov <asavkov@redhat.com>

version 8.2.0 (Apr 20, 2014):
- added --with-trust-uds-cred which uses getsockopt() to fetch and
trust the client uid, bypassing password lookups - patch by Anton
Expand Down Expand Up @@ -952,5 +960,5 @@ before version 6.05:
and enhancements of various types were applied.

#
# $Id: CHANGES,v 1.247 2014/04/21 04:47:37 bryan Exp $
# $Id: CHANGES,v 1.251 2015/06/02 17:33:29 bryan Exp $
#
10 changes: 6 additions & 4 deletions conserver.cf/conserver.cf.man
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.\" $Id: conserver.cf.man,v 1.85 2014/04/04 16:17:45 bryan Exp $
.TH CONSERVER.CF 5 "2014/04/04" "conserver-8.2.0" "conserver"
.\" $Id: conserver.cf.man,v 1.86 2015/06/02 17:19:31 bryan Exp $
.TH CONSERVER.CF 5 "2015/06/02" "conserver-8.2.1" "conserver"
.SH NAME
conserver.cf \- console configuration file for
.BR conserver (8)
Expand Down Expand Up @@ -212,9 +212,11 @@ connections from the hosts without username authentication.
.TP
\f3break\fP \f2n\fP
.br
Define a break sequence where 0 <
Define a break sequence where (1 <=
.I n
< 10.
<= 9) or (a <=
.I n
<= z).
Break sequences are accessed via the
.RI ``^Ecl n ''
client escape sequence.
Expand Down
2 changes: 1 addition & 1 deletion conserver.cf/conserver.passwd.man
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.\" $Id: conserver.passwd.man,v 1.10 2004/01/08 16:12:33 bryan Exp $
.TH CONSERVER.PASSWD 5 "2004/01/08" "conserver-8.2.0" "conserver"
.TH CONSERVER.PASSWD 5 "2004/01/08" "conserver-8.2.1" "conserver"
.SH NAME
conserver.passwd \- user access information for
.BR conserver (8)
Expand Down
4 changes: 2 additions & 2 deletions conserver.html
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ <H3>The conserver.com Distribution</H3>

<H3>Downloading</H3>

<P>The current version, released on Apr 20, 2014, is
<A href="8.2.0.tar.gz">8.2.0.tar.gz</A>. See the <A href=
<P>The current version, released on Jun 2, 2015, is
<A href="8.2.1.tar.gz">8.2.1.tar.gz</A>. See the <A href=
"CHANGES">CHANGES</A> file for information on the latest
updates.</P>

Expand Down
68 changes: 34 additions & 34 deletions conserver/client.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* $Id: client.c,v 5.97 2014/04/20 06:45:07 bryan Exp $
* $Id: client.c,v 5.98 2015/06/02 17:19:31 bryan Exp $
*
* Copyright conserver.com, 2000
*
Expand Down Expand Up @@ -373,39 +373,39 @@ typedef struct HLnode {
} HELP;

static HELP aHLTable[] = {
{WHEN_ALWAYS, ". disconnect"},
{WHEN_ALWAYS | IS_LIMITED, "; move to another console"},
{WHEN_ALWAYS, "a attach read/write"},
{WHEN_ALWAYS, "b send broadcast message"},
{WHEN_ATTACH, "c toggle flow control"},
{WHEN_ATTACH, "d down a console"},
{WHEN_ALWAYS, "e change escape sequence"},
{WHEN_ALWAYS, "f force attach read/write"},
{WHEN_ALWAYS, "g group info"},
{WHEN_ALWAYS, "i information dump"},
{WHEN_ATTACH, "L toggle logging on/off"},
{WHEN_ATTACH, "l? break sequence list"},
{WHEN_ATTACH, "l0 send break per config file"},
{WHEN_ATTACH, "l1-9 send specific break sequence"},
{WHEN_ALWAYS, "m display the message of the day"},
{WHEN_ALWAYS, "n write a note to the logfile"},
{WHEN_ALWAYS, "o (re)open the tty and log file"},
{WHEN_ALWAYS, "p playback the last %hu lines"},
{WHEN_ALWAYS, "P set number of playback lines"},
{WHEN_ALWAYS, "r replay the last %hu lines"},
{WHEN_ALWAYS, "R set number of replay lines"},
{WHEN_ATTACH, "s spy mode (read only)"},
{WHEN_ALWAYS, "u show host status"},
{WHEN_ALWAYS, "v show version info"},
{WHEN_ALWAYS, "w who is on this console"},
{WHEN_ALWAYS, "x show console baud info"},
{WHEN_ALWAYS | IS_LIMITED, "z suspend the connection"},
{WHEN_ATTACH, "! invoke task"},
{WHEN_ATTACH | IS_LIMITED, "| attach local command"},
{WHEN_ALWAYS, "? print this message"},
{WHEN_ALWAYS, "<cr> ignore/abort command"},
{WHEN_ALWAYS, "^R replay the last line"},
{WHEN_ATTACH, "\\ooo send character by octal code"},
{WHEN_ALWAYS, ". disconnect"},
{WHEN_ALWAYS | IS_LIMITED, "; move to another console"},
{WHEN_ALWAYS, "a attach read/write"},
{WHEN_ALWAYS, "b send broadcast message"},
{WHEN_ATTACH, "c toggle flow control"},
{WHEN_ATTACH, "d down a console"},
{WHEN_ALWAYS, "e change escape sequence"},
{WHEN_ALWAYS, "f force attach read/write"},
{WHEN_ALWAYS, "g group info"},
{WHEN_ALWAYS, "i information dump"},
{WHEN_ATTACH, "L toggle logging on/off"},
{WHEN_ATTACH, "l? break sequence list"},
{WHEN_ATTACH, "l0 send break per config file"},
{WHEN_ATTACH, "l1-9a-z send specific break sequence"},
{WHEN_ALWAYS, "m display message of the day"},
{WHEN_ALWAYS, "n write a note to the logfile"},
{WHEN_ALWAYS, "o (re)open the tty and log file"},
{WHEN_ALWAYS, "p playback the last %hu lines"},
{WHEN_ALWAYS, "P set number of playback lines"},
{WHEN_ALWAYS, "r replay the last %hu lines"},
{WHEN_ALWAYS, "R set number of replay lines"},
{WHEN_ATTACH, "s spy mode (read only)"},
{WHEN_ALWAYS, "u show host status"},
{WHEN_ALWAYS, "v show version info"},
{WHEN_ALWAYS, "w who is on this console"},
{WHEN_ALWAYS, "x show console baud info"},
{WHEN_ALWAYS | IS_LIMITED, "z suspend the connection"},
{WHEN_ATTACH, "! invoke task"},
{WHEN_ATTACH | IS_LIMITED, "| attach local command"},
{WHEN_ALWAYS, "? print this message"},
{WHEN_ALWAYS, "<cr> ignore/abort command"},
{WHEN_ALWAYS, "^R replay the last line"},
{WHEN_ATTACH, "\\ooo send character by octal code"},
};

/* list the commands we know for the user (ksb)
Expand Down
4 changes: 2 additions & 2 deletions conserver/consent.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* $Id: consent.h,v 5.75 2014/04/20 06:45:07 bryan Exp $
* $Id: consent.h,v 5.76 2015/06/02 17:19:31 bryan Exp $
*
* Copyright conserver.com, 2000
*
Expand Down Expand Up @@ -130,7 +130,7 @@ typedef struct consent { /* console information */
char *udssubst; /* socket file substitution pattern */
/* global stuff */
char *master; /* master hostname */
unsigned short breakNum; /* break type [1-9] */
unsigned short breakNum; /* break type [1-35] */
char *logfile; /* logfile */
off_t logfilemax; /* size limit for rolling logfile */
char *initcmd; /* initcmd command */
Expand Down
2 changes: 1 addition & 1 deletion conserver/conserver.man
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.\" @(#)conserver.8 01/06/91 OSU CIS; Thomas A. Fine
.\" $Id: conserver.man,v 1.54 2006/12/31 02:02:48 bryan Exp $
.TH CONSERVER 8 "2006/12/31" "conserver-8.2.0" "conserver"
.TH CONSERVER 8 "2006/12/31" "conserver-8.2.1" "conserver"
.SH NAME
conserver \- console server daemon
.SH SYNOPSIS
Expand Down
16 changes: 10 additions & 6 deletions conserver/cutil.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* $Id: cutil.c,v 1.142 2014/04/20 07:17:56 bryan Exp $
* $Id: cutil.c,v 1.143 2015/06/02 17:19:31 bryan Exp $
*
* Copyright conserver.com, 2000
*
Expand Down Expand Up @@ -2088,8 +2088,8 @@ IsMe(char *id)
b = &(((struct sockaddr_in *)rp->ai_addr)->sin_addr);
len = sizeof(struct in_addr);
} else { /* IPv6 */
a = &(((struct sockaddr_in6 *)ifa->ifa_addr)->
sin6_addr);
a = &(((struct sockaddr_in6 *)ifa->
ifa_addr)->sin6_addr);
b = &(((struct sockaddr_in6 *)rp->ai_addr)->sin6_addr);
len = sizeof(struct in6_addr);
}
Expand Down Expand Up @@ -2426,7 +2426,11 @@ GetWord(FILE *fp, int *line, short spaceok, STRING *word)
if (c == '\n') {
if (fname->used > 0) {
while (fname->used > 1 && isspace((int)
(fname->string[fname->used - 2])))
(fname->
string
[fname->
used -
2])))
fname->used--;
if (fname->used > 0)
fname->string[fname->used - 1] = '\000';
Expand Down Expand Up @@ -2709,8 +2713,8 @@ ParseFile(char *filename, FILE *fp, int level)
case VALUE:
switch (token) {
case WORD:
(*sections[secIndex].
items[keyIndex].reg) (word->string);
(*sections[secIndex].items[keyIndex].
reg) (word->string);
state = SEMI;
break;
case SEMICOLON:
Expand Down
53 changes: 35 additions & 18 deletions conserver/group.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* $Id: group.c,v 5.350 2014/04/20 07:20:56 bryan Exp $
* $Id: group.c,v 5.352 2015/06/02 17:19:31 bryan Exp $
*
* Copyright conserver.com, 2000
*
Expand Down Expand Up @@ -1634,7 +1634,9 @@ ExpandString(char *str, CONSENT *pCE, short breaknum)
continue;
} else if (s == 'd') {
PutConsole(pCE, IAC, 0);
PutConsole(pCE, '0' + breaknum, 0);
PutConsole(pCE,
'0' + breaknum + (breaknum >
9 ? BREAKALPHAOFFSET : 0), 0);
continue;
} else if (s == 'z') {
PutConsole(pCE, IAC, 0);
Expand Down Expand Up @@ -1680,7 +1682,7 @@ SendBreak(CONSCLIENT *pCLServing, CONSENT *pCEServing, short bt)
CONSCLIENT *pCL;

short waszero = 0;
if (bt < 0 || bt > 9) {
if (bt < 0 || bt > BREAKLISTSIZE) {
FileWrite(pCLServing->fd, FLAGFALSE, "aborted]\r\n", -1);
return;
}
Expand Down Expand Up @@ -1730,10 +1732,12 @@ SendBreak(CONSCLIENT *pCLServing, CONSENT *pCEServing, short bt)

if (pCEServing->breaklog == FLAGTRUE) {
if (waszero) {
TagLogfile(pCEServing, "break #0(%d) sent -- `%s'", bt,
TagLogfile(pCEServing, "break #0(%c) sent -- `%s'",
'0' + bt + (bt > 9 ? BREAKALPHAOFFSET : 0),
breakList[bt - 1].seq->string);
} else {
TagLogfile(pCEServing, "break #%d sent -- `%s'", bt,
TagLogfile(pCEServing, "break #%c sent -- `%s'",
'0' + bt + (bt > 9 ? BREAKALPHAOFFSET : 0),
breakList[bt - 1].seq->string);
}
}
Expand All @@ -1746,7 +1750,7 @@ StartTask(CONSENT *pCE, char *cmd, uid_t uid, gid_t gid)
extern char **environ;
char *pcShell, **ppcArgv;
extern int FallBack(char **, int *);
char *execSlave; /* pseudo-device slave side */
char *execSlave = (char *)0; /* pseudo-device slave side */
int execSlaveFD; /* fd of slave side */
int cofile;

Expand Down Expand Up @@ -3522,21 +3526,25 @@ DoClientRead(GRPENT *pGE, CONSCLIENT *pCLServing)
case S_HALT1: /* halt sequence? */
pCLServing->iState = S_NORMAL;
if (acIn[i] != '?' &&
(acIn[i] < '0' || acIn[i] > '9')) {
((acIn[i] < '0' || acIn[i] > '9') &&
(acIn[i] < 'a' || acIn[i] > 'z'))) {
FileWrite(pCLServing->fd, FLAGFALSE,
"aborted]\r\n", -1);
continue;
}

if (acIn[i] == '?') {
int i;
int mod;
FileWrite(pCLServing->fd, FLAGFALSE,
"list]\r\n", -1);
i = pCEServing->breakNum;
mod = i > 9 ? BREAKALPHAOFFSET : 0;
if (i == 0 || breakList[i - 1].seq->used <= 1
|| pCEServing->breaklist == (char *)0 ||
((char *)0 ==
strchr(pCEServing->breaklist, '1' + i)
strchr(pCEServing->breaklist,
'0' + i + mod)
&& (char *)0 ==
strchr(pCEServing->breaklist, '*')))
FileWrite(pCLServing->fd, FLAGTRUE,
Expand All @@ -3552,10 +3560,12 @@ DoClientRead(GRPENT *pGE, CONSCLIENT *pCLServing)
acA1->string);
}
if (pCEServing->breaklist != (char *)0) {
for (i = 0; i < 9; i++) {
for (i = 0; i < BREAKLISTSIZE; i++) {
char btc;
mod = i > 8 ? BREAKALPHAOFFSET : 0;
btc = '1' + i + mod;
if ((char *)0 ==
strchr(pCEServing->breaklist,
'1' + i)
strchr(pCEServing->breaklist, btc)
&& (char *)0 ==
strchr(pCEServing->breaklist, '*'))
continue;
Expand All @@ -3564,9 +3574,8 @@ DoClientRead(GRPENT *pGE, CONSCLIENT *pCLServing)
breakList[i].seq->used -
1, acA1);
FilePrint(pCLServing->fd, FLAGTRUE,
" %d - %3dms, `%s'\r\n",
i + 1,
breakList[i].delay,
" %c - %3dms, `%s'\r\n",
btc, breakList[i].delay,
acA1->string);
}
}
Expand All @@ -3575,7 +3584,10 @@ DoClientRead(GRPENT *pGE, CONSCLIENT *pCLServing)
0);
} else {
if (pCLServing->fwr) {
int bt = acIn[i] - '0';
int bt =
acIn[i] - '0' - (acIn[i] >
'9' ? BREAKALPHAOFFSET
: 0);
SendBreak(pCLServing, pCEServing, bt);
} else
FileWrite(pCLServing->fd, FLAGFALSE,
Expand Down Expand Up @@ -4140,7 +4152,9 @@ FlushConsole(CONSENT *pCEServing)
unsigned char next =
(unsigned char)pCEServing->wbuf->string[offset + 1];
if ((next >= '0' && next <= '9') ||
(next == BREAK && pCEServing->type != HOST)) {
(next >= 'a' && next <= 'z') || (next == BREAK &&
pCEServing->type !=
HOST)) {
CONDDEBUG((1, "Kiddie(): heavy IAC for [%s]",
pCEServing->server));
offset += 2;
Expand Down Expand Up @@ -4171,10 +4185,13 @@ FlushConsole(CONSENT *pCEServing)
}

/* Do the operation */
if (next >= '0' && next <= '9') {
if ((next >= '0' && next <= '9') ||
(next >= 'a' && next <= 'z')) {
int delay = BREAKDELAYDEFAULT;
int bnum =
next - '1' - (next > '9' ? BREAKALPHAOFFSET : 0);
if (next != '0')
delay = breakList[next - '1'].delay;
delay = breakList[bnum].delay;
/* in theory this sets the break length to whatever
* the "default" break sequence is for the console.
* but, i think it would be better to just use the
Expand Down
10 changes: 7 additions & 3 deletions conserver/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* $Id: main.c,v 5.212 2014/04/20 06:45:07 bryan Exp $
* $Id: main.c,v 5.213 2015/06/02 17:19:31 bryan Exp $
*
* Copyright conserver.com, 2000
*
Expand Down Expand Up @@ -1076,9 +1076,10 @@ DumpDataStructures(void)
}
}
}
for (i = 0; i < 9; i++) {
for (i = 0; i < BREAKLISTSIZE; i++) {
CONDDEBUG((1,
"DumpDataStructures(): break: string=%s, delay=%d, confirm=%s",
"DumpDataStructures(): break: #%c, string=%s, delay=%d, confirm=%s",
'1' + i + (i > 8 ? BREAKALPHAOFFSET : 0),
EMPTYSTR(breakList[i].seq->string), breakList[i].delay,
FLAGSTR(breakList[i].confirm)));
}
Expand Down Expand Up @@ -1241,6 +1242,9 @@ main(int argc, char **argv)
setvbuf(stderr, NULL, _IOLBF, BUFSIZ);
#endif

/* Initialize the break list */
InitBreakList();

/* prep the config options */
if ((optConf = (CONFIG *)calloc(1, sizeof(CONFIG)))
== (CONFIG *)0)
Expand Down
Loading

0 comments on commit 4039e65

Please sign in to comment.