Imported from conserver-7.1.1.tar.gz

This commit is contained in:
Bryan Stansell 2001-08-04 21:11:57 -07:00
parent 4a15f7082e
commit 03aa79c53d
21 changed files with 291 additions and 129 deletions

18
CHANGES
View File

@ -1,6 +1,22 @@
CHANGES
=======
version 7.1.1 (Aug 4, 2001):
- Now using getlogin() for real username info - suggested by
Dave Stuit <djs@gnac.com>
- gethostbyname() failure for a console now doesn't cause a
shutdown - reported by Todd Stansell <todd@stansell.org>
- Shutdown via client -q/-Q fixed (broken in 7.1.0 because of
master process fork() code)
- Password file parsing fixed to allow for empty passwords -
allowing users to access conserver without a password prompt
- Both the password and configuration files no longer have
line length limitations, they now support comments (`#' lines),
and lines with leading whitespace are continuations of
previous lines
- Client hostname/ip sometimes not printed - reported by Todd
Stansell <todd@stansell.org>
version 7.1.0 (Jul 26, 2001):
- Hostname in access list that began with a digit was treated as
an IP address - only strings using [0-9./] are considered CIDR
@ -206,5 +222,5 @@ before version 6.05:
and enhancements of various types were applied.
#
# $Id: CHANGES,v 1.41 2001-07-26 16:42:26-07 bryan Exp $
# $Id: CHANGES,v 1.45 2001-08-04 21:09:12-07 bryan Exp $
#

View File

@ -10,6 +10,13 @@ Upgrading?
new features added to the client if you're considering *not*
upgrading.
Version 7.1.1
- Both conserver.passwd and conserver.cf file parsing behaves
the same now. Both use leading whitespace as a continuation
line indicator - if you have leading whitespace on a line
(aside from comments) you probably should remove it.
Version 7.1.0
- The client/server protocol has changed. You *MUST* use a
@ -112,5 +119,5 @@ Detailed Instructions
- That's it! Just start up the console server and enjoy!
#
# $Id: INSTALL,v 1.17 2001-07-25 17:33:29-07 bryan Exp $
# $Id: INSTALL,v 1.18 2001-08-04 21:11:09-07 bryan Exp $
#

6
TODO
View File

@ -9,10 +9,6 @@ Bryan Stansell
---------------------------------------------------------------------------
- conserver.passwd parsing needs improvement
- shouldn't use strtok() (bryan::any == bryan:any)
- empty passwords not allowed
- Telnet protocol should be improved
- Not even RFC 854 compliant
- Data sent to terminal server not encapsulated
@ -89,5 +85,5 @@ Bryan Stansell
- bios support
#
# $Id: TODO,v 1.11 2001-07-25 17:36:21-07 bryan Exp $
# $Id: TODO,v 1.12 2001-07-30 23:28:56-07 bryan Exp $
#

View File

@ -58,6 +58,9 @@
/* Define if you have the `getdtablesize' function. */
#undef HAVE_GETDTABLESIZE
/* Define if you have the `getlogin' function. */
#undef HAVE_GETLOGIN
/* Define if you have the `getopt' function. */
#undef HAVE_GETOPT

2
configure vendored
View File

@ -3390,7 +3390,7 @@ EOF
fi
for ac_func in getopt strerror getrlimit getsid setsid getuserattr setgroups tcgetpgrp tcsetpgrp tcgetattr tcsetattr tcsendbreak setpgrp getutent setttyent getspnam setlinebuf setvbuf ptsname grantpt unlockpt flock sigaction setsockopt getdtablesize putenv memset memcpy memcmp sysconf getpassphrase
for ac_func in getopt strerror getrlimit getsid setsid getuserattr setgroups tcgetpgrp tcsetpgrp tcgetattr tcsetattr tcsendbreak setpgrp getutent setttyent getspnam setlinebuf setvbuf ptsname grantpt unlockpt flock sigaction setsockopt getdtablesize putenv memset memcpy memcmp sysconf getpassphrase getlogin
do
ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh`
echo "$as_me:3396: checking for $ac_func" >&5

View File

@ -218,7 +218,7 @@ AC_CHECK_LIB(crypt,crypt)
dnl ### Check for needed functions. ################################
AC_CHECK_FUNCS(getopt strerror getrlimit getsid setsid getuserattr setgroups tcgetpgrp tcsetpgrp tcgetattr tcsetattr tcsendbreak setpgrp getutent setttyent getspnam setlinebuf setvbuf ptsname grantpt unlockpt flock sigaction setsockopt getdtablesize putenv memset memcpy memcmp sysconf getpassphrase)
AC_CHECK_FUNCS(getopt strerror getrlimit getsid setsid getuserattr setgroups tcgetpgrp tcsetpgrp tcgetattr tcsetattr tcsendbreak setpgrp getutent setttyent getspnam setlinebuf setvbuf ptsname grantpt unlockpt flock sigaction setsockopt getdtablesize putenv memset memcpy memcmp sysconf getpassphrase getlogin)
AC_FUNC_SETPGRP

View File

@ -1,4 +1,4 @@
.\" $Id: conserver.cf.man,v 1.15 2001-07-26 10:23:16-07 bryan Exp $
.\" $Id: conserver.cf.man,v 1.17 2001-08-04 20:54:25-07 bryan Exp $
.\" @(#)constab.5 01/06/91 OSU CIS; Thomas A. Fine
.TH CONSERVER.CF 5 "Local"
.SH NAME
@ -24,10 +24,14 @@ is the configuration file for
.BR conserver (8).
It is read once upon startup;
modifications to the file take effect only upon restarting \fBconserver\fP.
All lines starting with the pound sign `#' are considered comment lines.
Blank lines are ignored.
.PP
The first section of the file has lines that are separated into
Blank lines and comment lines (those beginning with a ``#'' and
optional leading whitespace) are ignored. Non-ignored lines
beginning with whitespace are considered continuations of the
previous line. This allows you to span one logical line over
many physical lines and insert comments wherever appropriate.
.PP
The first section of the file has logical lines that are separated into
five colon-separated fields. Leading and trailing white space in each
field is ignored.
.TP

View File

@ -1,4 +1,4 @@
.\" $Id: conserver.passwd.man,v 1.2 2001-07-22 11:48:29-07 bryan Exp $
.\" $Id: conserver.passwd.man,v 1.4 2001-08-04 20:54:25-07 bryan Exp $
.TH CONSERVER.PASSWD 5 "Local"
.SH NAME
conserver.passwd \- user access information for conserver(8)
@ -14,8 +14,15 @@ Upon each incoming client connection,
so edits to the file take effect immediately.
It reads only until the first \fIusername\fP match.
.PP
Each line consists of three colon-separated fields,
as follows:
Blank lines and comment lines (those beginning with a ``#'' and
optional leading whitespace) are ignored. Non-ignored lines
beginning with whitespace are considered continuations of the
previous line. This allows you to span one logical line over
many physical lines and insert comments wherever appropriate.
.PP
Each logical line consists of three colon-separated fields.
Leading and trailing white space in each
field is ignored.
.TP
.I username
the login name of the authorized user,

View File

@ -167,10 +167,10 @@ contrast for yourself.
<P>
The current version, released on RELEASE_DATE, is <A
HREF="http://www.conserver.com/7.1.0.tar.gz">
7.1.0.tar.gz</A>. You can get it via <A
HREF="ftp://ftp.conserver.com/conserver/7.1.0.tar.gz">FTP</A>
or <A HREF="http://www.conserver.com/7.1.0.tar.gz">HTTP</A>.
HREF="http://www.conserver.com/7.1.1.tar.gz">
7.1.1.tar.gz</A>. You can get it via <A
HREF="ftp://ftp.conserver.com/conserver/7.1.1.tar.gz">FTP</A>
or <A HREF="http://www.conserver.com/7.1.1.tar.gz">HTTP</A>.
See the <A HREF="http://www.conserver.com/CHANGES">CHANGES</A> file for
information on the latest updates.
</P>

View File

@ -1,5 +1,5 @@
/*
* $Id: consent.c,v 5.68 2001-07-26 11:48:43-07 bryan Exp $
* $Id: consent.c,v 5.69 2001-07-29 22:28:40-07 bryan Exp $
*
* Copyright conserver.com, 2000-2001
*
@ -688,9 +688,10 @@ ConsInit(pCE, pfdSet, useHostCache)
#endif
if ((hp = gethostbyname(pCE->networkConsoleHost)) == NULL) {
Error("gethostbyname(%s): %s", pCE->networkConsoleHost,
hstrerror(h_errno));
exit(EX_UNAVAILABLE);
Error("gethostbyname(%s): %s: forcing down",
pCE->networkConsoleHost, hstrerror(h_errno));
ConsDown(pCE, pfdSet);
return;
}
#if HAVE_MEMCPY
(void)memcpy(&port.sin_addr.s_addr, hp->h_addr, hp->h_length);

View File

@ -1,5 +1,5 @@
/*
* $Id: group.c,v 5.126 2001-07-26 11:50:13-07 bryan Exp $
* $Id: group.c,v 5.132 2001-08-04 17:03:30-07 bryan Exp $
*
* Copyright conserver.com, 2000-2001
*
@ -94,19 +94,14 @@ static sig_atomic_t fSawReOpen = 0, fSawReUp = 0, fSawMark =
* given a special epass try it first.
*/
int
CheckPass(pwd, pcEPass, pcWord)
CheckPass(pwd, pcWord)
struct passwd *pwd;
char *pcEPass, *pcWord;
char *pcWord;
{
#if HAVE_GETSPNAM
struct spwd *spwd;
#endif
if ((char *)0 != pcEPass && '\000' != pcEPass[0]) {
if (0 == strcmp(pcEPass, crypt(pcWord, pcEPass))) {
return 1;
}
}
#if HAVE_GETSPNAM
if ('x' == pwd->pw_passwd[0] && '\000' == pwd->pw_passwd[1]) {
if ((struct spwd *)0 != (spwd = getspnam(pwd->pw_name)))
@ -430,8 +425,7 @@ ReapVirt(pGE, prinit)
/* If someone was writing, they fall back to read-only */
if (pCE->pCLwr != (CONSCLIENT *) 0) {
pCE->pCLwr->fwr = 0;
tagLogfile(pCE, "%s detached",
pCE->pCLwr->acid);
tagLogfile(pCE, "%s detached", pCE->pCLwr->acid);
pCE->pCLwr = (CONSCLIENT *) 0;
}
@ -451,7 +445,7 @@ CheckPasswd(pCLServing, pw_string)
{
struct passwd *pwd;
FILE *fp;
char buf[BUFSIZ];
int iLine = 0;
char *server, *servers, *this_pw, *user;
char username[64]; /* same as acid */
#if HAVE_GETSPNAM
@ -462,31 +456,46 @@ CheckPasswd(pCLServing, pw_string)
if ((user = strchr(username, '@')))
*user = '\000';
if ((fp = fopen(pcPasswd, "r")) == NULL) {
if ((fp = fopen(pcPasswd, "r")) == (FILE *) 0) {
Info("Cannot open passwd file %s: %s", pcPasswd, strerror(errno));
if ((struct passwd *)0 == (pwd = getpwuid(0))) {
fileWrite(pCLServing->fd, "no root passwd?\r\n", -1);
return 0;
}
if (0 != CheckPass(pwd, pw_string, pCLServing->accmd)) {
if (fVerbose) {
Info("User %s logging into server %s via root or console passwd", pCLServing->acid, pCLServing->pCEwant->server);
}
if (0 != CheckPass(pwd, pw_string)) {
if (fVerbose)
Info("User %s logging into server %s via root passwd",
pCLServing->acid, pCLServing->pCEwant->server);
return 1;
}
} else {
while (fgets(buf, sizeof(buf), fp) != NULL) {
user = strtok(buf, ":\n");
if (user == NULL)
char *wholeLine;
STRING saveLine = { (char *)0, 0, 0 };
while ((wholeLine = readLine(fp, &saveLine, &iLine)) != (char *)0) {
pruneSpace(wholeLine);
/*printf("whole=<%s>\n", wholeLine); */
if (wholeLine[0] == '\000')
continue;
if (!
(strcmp(user, "*any*") == 0 ||
strcmp(user, username) == 0))
if ((char *)0 == (this_pw = strchr(wholeLine, ':')) ||
(char *)0 == (servers = strchr(this_pw + 1, ':'))) {
Error("%s(%d) bad password line `%s'", pcPasswd, iLine,
wholeLine);
continue;
this_pw = strtok(NULL, ":\n");
}
*this_pw++ = '\000';
*servers++ = '\000';
user = pruneSpace(wholeLine);
this_pw = pruneSpace(this_pw);
servers = pruneSpace(servers);
if (strcmp(user, "*any*") != 0 && strcmp(user, username) != 0)
continue;
if (strcmp(this_pw, "*passwd*") == 0) {
this_pw = NULL;
this_pw = (char *)0;
if ((struct passwd *)0 != (pwd = getpwnam(username))) {
#if HAVE_GETSPNAM
if ('x' == pwd->pw_passwd[0] &&
@ -503,19 +512,23 @@ CheckPasswd(pCLServing, pw_string)
#endif
}
}
if (this_pw == NULL)
break;
servers = strtok(NULL, ":\n");
if (servers == NULL)
if (this_pw == (char *)0)
break;
/*
printf("Got servers <%s> passwd <%s> user <%s>, want <%s>\n",
servers, this_pw, user,
pCLServing->pCEwant->server);
printf
("Got servers <%s> passwd <%s> user <%s>, want <%s>\n",
servers, this_pw, user, pCLServing->pCEwant->server);
*/
if (strcmp(this_pw, crypt(pCLServing->accmd, this_pw)) == 0) {
/* If one is empty and the other isn't, instant failure */
if ((*this_pw == '\000' && *pw_string != '\000') ||
(*this_pw != '\000' && *pw_string == '\000')) {
break;
}
if ((*this_pw == '\000' && *pw_string == '\000') ||
(strcmp(this_pw, crypt(pw_string, this_pw)) == 0)) {
server = strtok(servers, ", \t\n");
while (server) { /* For each server */
if (strcmp(server, "any") == 0) {
@ -555,8 +568,7 @@ CheckPasswd(pCLServing, pw_string)
server = strtok(NULL, ", \t\n");
}
}
fclose(fp);
return 0;
break;
}
fclose(fp);
}
@ -1025,8 +1037,7 @@ Kiddie(pGE, sfd)
for (j = 0;
pCLServing->icursor <
(sizeof(pCLServing->acid) - 1) &&
pCLServing->peername[iConsole] !=
'\000';) {
pCLServing->peername[j] != '\000';) {
pCLServing->acid[pCLServing->icursor++] =
pCLServing->peername[j++];
}
@ -1095,7 +1106,8 @@ Kiddie(pGE, sfd)
goto drop;
}
if ('t' == pCLServing->caccess) {
if (('t' == pCLServing->caccess) ||
(0 != CheckPasswd(pCLServing, ""))) {
goto shift_console;
}
fileWrite(pCLServing->fd, "passwd:\r\n", -1);
@ -1126,7 +1138,8 @@ Kiddie(pGE, sfd)
}
pCLServing->icursor = 0;
if (0 == CheckPasswd(pCLServing, pGE->passwd)) {
if (0 ==
CheckPasswd(pCLServing, pCLServing->accmd)) {
fileWrite(pCLServing->fd, "Sorry.\r\n", -1);
Info("%s: %s: bad passwd",
pCLServing->pCEwant->server,

View File

@ -1,5 +1,5 @@
/*
* $Id: group.h,v 5.17 2001-07-11 12:48:01-07 bryan Exp $
* $Id: group.h,v 5.18 2001-07-30 01:57:42-07 bryan Exp $
*
* Copyright conserver.com, 2000-2001
*
@ -42,7 +42,6 @@ typedef struct grpent { /* group info */
int imembers; /* number of consoles in this group */
CONSENT *pCElist; /* list of consoles in this group */
CONSCLIENT *pCLall; /* all clients to scan after select */
char passwd[MAXPSWDLEN]; /* encrypted password for this group */
} GRPENT;

View File

@ -1,5 +1,5 @@
/*
* $Id: main.c,v 5.75 2001-07-26 11:49:41-07 bryan Exp $
* $Id: main.c,v 5.78 2001-07-27 12:34:48-07 bryan Exp $
*
* Copyright conserver.com, 2000-2001
*
@ -284,6 +284,9 @@ main(argc, argv)
extern char *optarg;
REMOTE *pRCUniq; /* list of uniq console servers */
struct passwd *pwd;
char *origuser = (char *)0;
char *curuser = (char *)0;
int curuid;
outputPid = 1; /* make sure stuff has the pid */
@ -417,10 +420,24 @@ main(argc, argv)
}
Info("%s", THIS_VERSION);
if ((struct passwd *)0 == (pwd = getpwuid(getuid())))
Info("Started by uid %d at %s", getuid(), strtime(NULL));
#if HAVE_GETLOGIN
origuser = getlogin();
#endif
curuid = getuid();
if ((struct passwd *)0 != (pwd = getpwuid(curuid)))
curuser = pwd->pw_name;
if (curuser == (char *)0)
if (origuser == (char *)0)
Info("Started as uid %d by uid %d at %s", curuid, curuid,
strtime(NULL));
else
Info("Started as uid %d by `%s' at %s", curuid, origuser,
strtime(NULL));
else
Info("Started by `%s' at %s", pwd->pw_name, strtime(NULL));
Info("Started as `%s' by `%s' at %s", curuser,
(origuser == (char *)0) ? curuser : origuser, strtime(NULL));
#if HAVE_GETSPNAM
if (0 != geteuid()) {

View File

@ -1,5 +1,5 @@
/*
* $Id: master.c,v 5.60 2001-07-26 00:49:48-07 bryan Exp $
* $Id: master.c,v 5.61 2001-07-30 01:58:00-07 bryan Exp $
*
* Copyright conserver.com, 2000-2001
*
@ -217,7 +217,7 @@ Master(pRCUniq)
unsigned char acIn[1024], acOut[BUFSIZ];
struct sockaddr_in master_port, response_port;
int true = 1;
int pid;
int pid, parentpid;
char *ambiguous = (char *)0;
/* set up signal handler */
@ -357,6 +357,7 @@ Master(pRCUniq)
#endif
continue;
case 0:
parentpid = thepid;
thepid = getpid();
break;
}
@ -365,24 +366,22 @@ Master(pRCUniq)
* (port lookup, who, users, or quit)
*/
fileWrite(csocket, "ok\r\n", -1);
for (i = 0; i < sizeof(acIn); /* i+=nr */ ) {
if (0 >=
(nr = fileRead(csocket, &acIn[i], sizeof(acIn) - 1 - i))) {
i = 0;
for (i = 0; i < sizeof(acIn) - 1; /* i+=nr */ ) {
if ((nr =
fileRead(csocket, &acIn[i], sizeof(acIn) - 1 - i)) <= 0) {
break;
}
i += nr;
if ('\n' == acIn[i - 1]) {
acIn[i] = '\000';
--i;
break;
for (j = 0; j < nr; j++, i++) {
if (acIn[i] == '\n') {
acIn[i] = '\000';
if (i > 0 && acIn[i - 1] == '\r')
acIn[--i] = '\000';
break;
}
}
}
if (i > 0 && '\n' == acIn[i - 1]) {
acIn[--i] = '\000';
}
if (i > 0 && '\r' == acIn[i - 1]) {
acIn[--i] = '\000';
if (j != nr)
break;
acIn[i] = '\000';
}
if (0 == i) {
Error("lost connection");
@ -422,11 +421,11 @@ Master(pRCUniq)
fileWrite(csocket, "must be trusted to terminate\r\n", -1);
} else if ((struct passwd *)0 == (pwd = getpwuid(0))) {
fileWrite(csocket, "no root passwd?\r\n", -1);
} else if (0 == CheckPass(pwd, (char *)0, pcArgs)) {
} else if (0 == CheckPass(pwd, pcArgs)) {
fileWrite(csocket, "Sorry.\r\n", -1);
} else {
fileWrite(csocket, "ok -- terminated\r\n", -1);
fSawQuit = 1;
kill(parentpid, SIGTERM);
}
(void)fileClose(csocket);
exit(EX_OK);

View File

@ -1,5 +1,5 @@
/*
* $Id: readcfg.c,v 5.61 2001-07-23 00:45:49-07 bryan Exp $
* $Id: readcfg.c,v 5.62 2001-08-04 18:33:54-07 bryan Exp $
*
* Copyright conserver.com, 2000-2001
*
@ -216,7 +216,8 @@ ReadCfg(pcFile, fp)
GRPENT *pGE;
int iG, minG;
int iLine;
unsigned char acIn[BUFSIZ];
unsigned char *acIn;
static STRING acInSave = { (char *)0, 0, 0 };
char *acStart;
GRPENT *pGEAll;
CONSENT *pCE;
@ -233,18 +234,14 @@ ReadCfg(pcFile, fp)
ppRC = &pRCList;
iLocal = 0;
buildMyString((char *)0, &acInSave);
iG = minG = 0;
iLine = 0;
while (fgets(acIn, sizeof(acIn) - 1, fp) != NULL) {
while ((acIn = readLine(fp, &acInSave, &iLine)) != (unsigned char *)0) {
char *pcLine, *pcMode, *pcLog, *pcRem, *pcStart, *pcMark;
++iLine;
acStart = pruneSpace(acIn);
if ('#' == acStart[0] || '\000' == acStart[0]) {
continue;
}
if ('%' == acStart[0] && '%' == acStart[1] && '\000' == acStart[2]) {
break;
}
@ -459,18 +456,13 @@ ReadCfg(pcFile, fp)
*/
iG = iAccess = 0;
pACList = (ACCESS *) 0;
while (fgets(acIn, sizeof(acIn) - 1, fp) != NULL) {
while ((acIn = readLine(fp, &acInSave, &iLine)) != (unsigned char *)0) {
char *pcMach, *pcNext, *pcMem;
char cType;
int iLen;
++iLine;
acStart = pruneSpace(acIn);
if ('#' == acStart[0] || '\000' == acStart[0]) {
continue;
}
if ('%' == acStart[0] && '%' == acStart[1] && '\000' == acStart[2]) {
break;
}

View File

@ -1,5 +1,5 @@
/*
* $Id: readcfg.h,v 5.12 2001-07-06 17:11:47-07 bryan Exp $
* $Id: readcfg.h,v 5.13 2001-07-30 01:57:27-07 bryan Exp $
*
* Copyright conserver.com, 2000-2001
*
@ -49,3 +49,4 @@ extern int
iLocal; /* how many local consoles we have */
extern void ReadCfg();
extern char *pruneSpace();

View File

@ -1,5 +1,5 @@
/*
* $Id: util.c,v 1.19 2001-07-26 00:50:17-07 bryan Exp $
* $Id: util.c,v 1.26 2001-08-04 18:33:27-07 bryan Exp $
*
* Copyright conserver.com, 2000-2001
*
@ -14,6 +14,7 @@
#include <signal.h>
#include <config.h>
#include <sys/socket.h>
#include <ctype.h>
#include <compat.h>
#include <port.h>
@ -37,37 +38,135 @@ OutOfMem()
}
char *
buildString(str)
buildMyString(str, msg)
const char *str;
STRING *msg;
{
static char *msg = (char *)0;
static size_t cursize = 0;
static size_t msgsize = 0;
int len;
if ((char *)0 == str) {
if ((char *)0 != msg) {
free(msg);
msg = (char *)0;
msgsize = cursize = 0;
}
return msg;
msg->used = 0;
if (msg->string != (char *)0)
msg->string[0] = '\000';
Debug("buildMyString: reset", len);
return msg->string;
}
len = strlen(str);
if (cursize + len >= msgsize) {
if (0 == msgsize) {
msgsize = (len / 1024 + 1) * 1024 * sizeof(char);
msg = (char *)calloc(1, msgsize);
len = strlen(str) + 1;
if (msg->used + len >= msg->allocated) {
if (0 == msg->allocated) {
msg->allocated = (len / 1024 + 1) * 1024 * sizeof(char);
msg->string = (char *)calloc(1, msg->allocated);
} else {
msgsize += (len / 1024 + 1) * 1024 * sizeof(char);
msg = (char *)realloc(msg, msgsize);
msg->allocated += (len / 1024 + 1) * 1024 * sizeof(char);
msg->string = (char *)realloc(msg->string, msg->allocated);
}
if ((char *)0 == msg)
Debug("buildMyString: tried allocating %lu bytes", msg->allocated);
if (msg->string == (char *)0)
OutOfMem();
}
strcat(msg, str);
cursize += len;
return msg;
strcat(msg->string, str);
msg->used += len;
Debug("buildMyString: added %d chars (%d/%d now)", len, msg->used,
msg->allocated);
return msg->string;
}
char *
buildString(str)
const char *str;
{
static STRING msg = { (char *)0, 0, 0 };
return buildMyString(str, &msg);
}
char *
readLine(fp, save, iLine)
FILE *fp;
STRING *save;
int *iLine;
{
static char buf[1024];
char *wholeline = (char *)0;
char *ret;
int i, buflen, peek, commentCheck = 1, comment = 0;
static STRING bufstr = { (char *)0, 0, 0 };
static STRING wholestr = { (char *)0, 0, 0 };
peek = 0;
wholeline = (char *)0;
buildMyString((char *)0, &bufstr);
buildMyString((char *)0, &wholestr);
while (save->used || ((ret = fgets(buf, sizeof(buf), fp)) != (char *)0)
|| peek) {
/* If we have a previously saved line, use it instead */
if (save->used) {
(void)strcpy(buf, save->string);
buildMyString((char *)0, save);
}
if (peek) {
/* End of file? Never mind. */
if (ret == (char *)0)
break;
/* If we don't have a line continuation and we've seen
* some worthy data
*/
if (!isspace((int)buf[0]) && (wholeline != (char *)0)) {
buildMyString((char *)0, save);
buildMyString(buf, save);
break;
}
peek = 0;
}
if (commentCheck) {
for (i = 0; buf[i] != '\000'; i++)
if (!isspace((int)buf[i]))
break;
if (buf[i] == '#') {
comment = 1;
commentCheck = 0;
} else if (buf[i] != '\000') {
commentCheck = 0;
}
}
/* Check for EOL */
buflen = strlen(buf);
if ((buflen >= 1) && (buf[buflen - 1] == '\n')) {
(*iLine)++; /* Finally have a whole line */
if (comment == 0 && commentCheck == 0) {
/* Finish off the chunk without the \n */
buf[buflen - 1] = '\000';
buildMyString(buf, &bufstr);
wholeline = buildMyString(bufstr.string, &wholestr);
}
peek = 1;
comment = 0;
commentCheck = 1;
buildMyString((char *)0, &bufstr);
} else {
/* Save off the partial chunk */
buildMyString(buf, &bufstr);
}
}
/* If we hit the EOF and weren't peeking ahead
* and it's not a comment
*/
if (!peek && (ret == (char *)0) && (comment == 0) &&
(commentCheck == 0)) {
(*iLine)++;
wholeline = buildMyString(bufstr.string, &wholestr);
}
Debug("readLine: returning <%s>",
(wholeline != (char *)0) ? wholeline : "<NULL>");
return wholeline;
}
void

View File

@ -1,5 +1,5 @@
/*
* $Id: util.h,v 1.8 2001-07-22 12:54:59-07 bryan Exp $
* $Id: util.h,v 1.11 2001-08-04 18:33:17-07 bryan Exp $
*
* Copyright conserver.com, 2000-2001
*
@ -18,6 +18,12 @@ enum consFileType {
#endif
};
typedef struct dynamicString {
char *string;
int used;
int allocated;
} STRING;
typedef struct consFile {
/* Standard socket type stuff */
enum consFileType ftype;
@ -52,3 +58,5 @@ extern int fileSend();
extern int fileFDNum();
extern void OutOfMem();
extern char *buildString();
extern char *buildMyString();
extern char *readLine();

View File

@ -1,5 +1,5 @@
/*
* $Id: version.h,v 1.26 2001-07-26 11:53:55-07 bryan Exp $
* $Id: version.h,v 1.27 2001-08-04 21:09:31-07 bryan Exp $
*
* Copyright conserver.com, 2000-2001
*
@ -14,4 +14,4 @@
@(#) Copyright 2000 conserver.com.\n\
All rights reserved.\n"
#define THIS_VERSION "conserver.com version 7.1.0"
#define THIS_VERSION "conserver.com version 7.1.1"

View File

@ -4,7 +4,7 @@
#
%define pkg conserver
%define ver 7.1.0
%define ver 7.1.1
# 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.0"
VERSION="7.1.1"
DESC="Console server and client"
CLASSES=none
ARCH=sparc