Merge branch 'master' into increase-gss-buffers

This commit is contained in:
Bryan Stansell 2025-01-28 15:19:59 -08:00 committed by GitHub
commit ccf3a7a21f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 87 additions and 32 deletions

View File

@ -3,7 +3,7 @@ env:
freebsd_13_task: freebsd_13_task:
freebsd_instance: freebsd_instance:
image_family: freebsd-13-2 image_family: freebsd-13-3
install_script: install_script:
- pkg install -y autoconf automake - pkg install -y autoconf automake
- ./package/setup-configure - ./package/setup-configure

View File

@ -385,11 +385,14 @@ Turn redirection on or off (see the
.B \-R .B \-R
command-line flag). command-line flag).
.TP .TP
\f3reinitcheck\fP \f2number\fP \f3reinitcheck\fP \f2number\fP[\f3s\fP|\f3m\fP]
.br .br
Set the number of minutes used between reinitialization checks (see the Set the number of minutes used between reinitialization checks (see the
.B \-O .B \-O
command-line flag). command-line flag).
If an `s' or `m' is used after
.IR number ,
the specified time is interpreted as seconds or minutes.
.TP .TP
\f3secondaryport\fP \f2number\fP|\f2name\fP \f3secondaryport\fP \f2number\fP|\f2name\fP
.br .br

View File

@ -1,6 +1,7 @@
### Path settings ### Path settings
datarootdir = @datarootdir@ datarootdir = @datarootdir@
srcdir = @srcdir@ srcdir = @srcdir@
VPATH = @srcdir@
top_srcdir = @top_srcdir@ top_srcdir = @top_srcdir@
prefix = @prefix@ prefix = @prefix@
exec_prefix = @exec_prefix@ exec_prefix = @exec_prefix@

View File

@ -146,6 +146,12 @@ AccType(INADDR_STYPE *addr, char **peername)
so = sizeof(*addr); so = sizeof(*addr);
#if USE_IPV6 #if USE_IPV6
/*
* XXX where is the TRUST_REVERSE_DNS support for IPv6???
*
* XXX IPv4 should use getnameinfo() et al as well
* (if available, they are in IEEE Std 1003.1g-2000)
*/
error = error =
getnameinfo((struct sockaddr *)addr, so, ipaddr, sizeof(ipaddr), getnameinfo((struct sockaddr *)addr, so, ipaddr, sizeof(ipaddr),
NULL, 0, NI_NUMERICHOST); NULL, 0, NI_NUMERICHOST);
@ -153,7 +159,11 @@ AccType(INADDR_STYPE *addr, char **peername)
Error("AccType(): getnameinfo failed: %s", gai_strerror(error)); Error("AccType(): getnameinfo failed: %s", gai_strerror(error));
goto common_ret; goto common_ret;
} }
CONDDEBUG((1, "AccType(): ip=%s", ipaddr)); CONDDEBUG((1, "AccType(): ip=%s (%s)", ipaddr,
addr->ss_family == AF_UNSPEC ? "AF_UNSPEC" :
addr->ss_family == AF_LOCAL ? "AF_LOCAL" :
addr->ss_family == AF_INET ? "AF_INET" :
addr->ss_family == AF_INET6 ? "AF_INET6" : "IF_???"));
error = error =
getnameinfo((struct sockaddr *)addr, so, host, sizeof(host), NULL, getnameinfo((struct sockaddr *)addr, so, host, sizeof(host), NULL,
@ -189,7 +199,7 @@ AccType(INADDR_STYPE *addr, char **peername)
common_ret: common_ret:
if (config->loghostnames == FLAGTRUE && !error) if (config->loghostnames == FLAGTRUE && !error)
*peername = StrDup(host); *peername = StrDup(host);
#else #else /* !USE_IPV6 */
# if TRUST_REVERSE_DNS # if TRUST_REVERSE_DNS
/* if we trust reverse dns, we get the names associated with /* if we trust reverse dns, we get the names associated with
* the address we're checking and then check each of those * the address we're checking and then check each of those

View File

@ -798,6 +798,8 @@ ConsDown(CONSENT *pCE, FLAG downHard, FLAG force)
if (pCE->type == EXEC && pCE->execSlaveFD != 0) { if (pCE->type == EXEC && pCE->execSlaveFD != 0) {
close(pCE->execSlaveFD); close(pCE->execSlaveFD);
pCE->execSlaveFD = 0; pCE->execSlaveFD = 0;
free(pCE->execSlave);
pCE->execSlave = NULL;
} }
pCE->fup = 0; pCE->fup = 0;
pCE->nolog = 0; pCE->nolog = 0;
@ -913,6 +915,9 @@ ConsInit(CONSENT *pCE)
case HOST: case HOST:
{ {
#if USE_IPV6 #if USE_IPV6
/* XXX IPv4 should use getaddrinfo() and getnameinfo() as well,
* (if available, they are in IEEE Std 1003.1g-2000)
*/
int error; int error;
char host[NI_MAXHOST]; char host[NI_MAXHOST];
char serv[NI_MAXSERV]; char serv[NI_MAXSERV];
@ -927,7 +932,7 @@ ConsInit(CONSENT *pCE)
Sleep(100000); /* Not all terminal servers can keep up */ Sleep(100000); /* Not all terminal servers can keep up */
#if USE_IPV6 #if USE_IPV6
# if HAVE_MEMSET # if HAVE_MEMSET /* XXX memset() is C89!!! */
memset(&hints, 0, sizeof(hints)); memset(&hints, 0, sizeof(hints));
# else # else
bzero(&hints, sizeof(hints)); bzero(&hints, sizeof(hints));
@ -964,8 +969,12 @@ ConsInit(CONSENT *pCE)
# if HAVE_SETSOCKOPT # if HAVE_SETSOCKOPT
if (setsockopt if (setsockopt
(cofile, SOL_SOCKET, SO_KEEPALIVE, (cofile, SOL_SOCKET, SO_KEEPALIVE,
(char *)&one, sizeof(one)) < 0) (char *)&one, sizeof(one)) < 0) {
Error
("[%s] %s:%s setsockopt(%u,SO_KEEPALIVE): %s",
pCE->server, host, serv, cofile, strerror(errno));
goto fail; goto fail;
}
# endif # endif
if (!SetFlags(cofile, O_NONBLOCK, 0)) if (!SetFlags(cofile, O_NONBLOCK, 0))
goto fail; goto fail;
@ -973,20 +982,25 @@ ConsInit(CONSENT *pCE)
ret = connect(cofile, rp->ai_addr, rp->ai_addrlen); ret = connect(cofile, rp->ai_addr, rp->ai_addrlen);
if (ret == 0 || errno == EINPROGRESS) if (ret == 0 || errno == EINPROGRESS)
goto success; goto success;
Error("[%s] %s:%s connect(%u): %s",
pCE->server, host, serv, cofile, strerror(errno));
fail: fail:
close(cofile); close(cofile);
} else {
Error
("[%s] %s:%s socket(AF_INET,SOCK_STREAM): %s",
pCE->server, host, serv, strerror(errno));
} }
rp = rp->ai_next; rp = rp->ai_next;
} }
Error("[%s]: Unable to connect to %s:%s", pCE->server, Error("[%s] Unable to connect to %s:%s, forcing down", pCE->server,
host, serv); pCE->host, serv);
ConsDown(pCE, FLAGTRUE, FLAGTRUE); ConsDown(pCE, FLAGTRUE, FLAGTRUE);
return; return;
success: success:
freeaddrinfo(ai); freeaddrinfo(ai);
#else #else /* !USE_IPV6 */
# if HAVE_MEMSET # if HAVE_MEMSET
memset((void *)&port, 0, sizeof(port)); memset((void *)&port, 0, sizeof(port));
# else # else

View File

@ -262,7 +262,7 @@ DestroyString(STRING *msg)
{ {
if (msg->prev == (STRING *)0 && msg->next == (STRING *)0 && if (msg->prev == (STRING *)0 && msg->next == (STRING *)0 &&
allStrings != msg) { allStrings != msg) {
CONDDEBUG((1, "DestroyString(): 0x%lx non-pooled string destroyed", CONDDEBUG((3, "DestroyString(): 0x%lx non-pooled string destroyed",
(void *)msg, stringCount)); (void *)msg, stringCount));
} else { } else {
if (msg->prev != (STRING *)0) if (msg->prev != (STRING *)0)
@ -273,7 +273,7 @@ DestroyString(STRING *msg)
allStrings = msg->next; allStrings = msg->next;
} }
stringCount--; stringCount--;
CONDDEBUG((1, CONDDEBUG((3,
"DestroyString(): 0x%lx string destroyed (count==%d)", "DestroyString(): 0x%lx string destroyed (count==%d)",
(void *)msg, stringCount)); (void *)msg, stringCount));
} }
@ -296,7 +296,7 @@ AllocString(void)
allStrings = s; allStrings = s;
InitString(s); InitString(s);
stringCount++; stringCount++;
CONDDEBUG((1, "AllocString(): 0x%lx created string #%d", (void *)s, CONDDEBUG((3, "AllocString(): 0x%lx created string #%d", (void *)s,
stringCount)); stringCount));
return s; return s;
} }
@ -2415,7 +2415,7 @@ GetWord(FILE *fp, int *line, short spaceok, STRING *word)
while ((c = fgetc(fp)) != EOF) { while ((c = fgetc(fp)) != EOF) {
if (c == '\n') { if (c == '\n') {
(*line)++; (*line)++;
if (checkInc == -2) if (checkInc == -2 || checkInc == 0)
checkInc = -1; checkInc = -1;
} }
if (comment) { if (comment) {
@ -2592,11 +2592,17 @@ ParseFile(char *filename, FILE *fp, int level)
strerror(errno)); strerror(errno));
} else { } else {
char *fname; char *fname;
char *sfile;
int sline;
/* word gets destroyed, so save the name */ /* word gets destroyed, so save the name */
fname = StrDup(word->string); fname = StrDup(word->string);
sfile = file;
sline = line;
ParseFile(fname, lfp, level + 1); ParseFile(fname, lfp, level + 1);
fclose(lfp); fclose(lfp);
free(fname); free(fname);
file = sfile;
line = sline;
} }
} else { } else {
switch (state) { switch (state) {

View File

@ -1023,7 +1023,7 @@ ReUp(GRPENT *pGE, short automatic)
/* update all the timers */ /* update all the timers */
if (automatic == 0 || automatic == 2) { if (automatic == 0 || automatic == 2) {
if (config->reinitcheck) if (config->reinitcheck)
timers[T_REINIT] = tyme + (config->reinitcheck * 60); timers[T_REINIT] = tyme + config->reinitcheck;
} }
if (!fNoautoreup) if (!fNoautoreup)
timers[T_AUTOUP] = tyme + 60; timers[T_AUTOUP] = tyme + 60;
@ -2183,7 +2183,7 @@ CommandExamine(GRPENT *pGE, CONSCLIENT *pCLServing, CONSENT *pCEServing,
char p = '\000'; char p = '\000';
switch (pCE->type) { switch (pCE->type) {
case EXEC: case EXEC:
d = pCE->execSlave; d = (pCE->execSlaveFD > 0) ? pCE->execSlave : "(inactive)";
b = "Local"; b = "Local";
p = ' '; p = ' ';
break; break;
@ -2351,7 +2351,8 @@ CommandInfo(GRPENT *pGE, CONSCLIENT *pCLServing, CONSENT *pCEServing,
case EXEC: case EXEC:
FilePrint(pCLServing->fd, FLAGTRUE, "|:%s,%lu,%s,%d:", FilePrint(pCLServing->fd, FLAGTRUE, "|:%s,%lu,%s,%d:",
(pCE->exec != (char *)0 ? pCE->exec : "/bin/sh"), (pCE->exec != (char *)0 ? pCE->exec : "/bin/sh"),
(unsigned long)pCE->ipid, pCE->execSlave, (unsigned long)pCE->ipid,
(pCE->execSlaveFD > 0) ? pCE->execSlave : "(inactive)",
FileFDNum(pCE->cofile)); FileFDNum(pCE->cofile));
break; break;
#if HAVE_FREEIPMI #if HAVE_FREEIPMI
@ -3269,7 +3270,6 @@ DoClientRead(GRPENT *pGE, CONSCLIENT *pCLServing)
TagLogfileAct(pCEServing, "%s attached", TagLogfileAct(pCEServing, "%s attached",
pCLServing->acid->string); pCLServing->acid->string);
} else { } else {
ClientWantsWrite(pCLServing);
FileWrite(pCLServing->fd, FLAGFALSE, FileWrite(pCLServing->fd, FLAGFALSE,
"[spy]\r\n", -1); "[spy]\r\n", -1);
} }
@ -3816,7 +3816,9 @@ DoClientRead(GRPENT *pGE, CONSCLIENT *pCLServing)
case 'c': case 'c':
if (!pCLServing->fwr) { if (!pCLServing->fwr) {
goto unknownchar; FileWrite(pCLServing->fd, FLAGFALSE,
"attach to toggle flow control]\r\n", -1);
continue;
} }
CommandChangeFlow(pGE, pCLServing, CommandChangeFlow(pGE, pCLServing,
pCEServing, tyme); pCEServing, tyme);
@ -3824,7 +3826,9 @@ DoClientRead(GRPENT *pGE, CONSCLIENT *pCLServing)
case 'd': /* down a console */ case 'd': /* down a console */
if (!pCLServing->fwr) { if (!pCLServing->fwr) {
goto unknownchar; FileWrite(pCLServing->fd, FLAGFALSE,
"attach to down console]\r\n", -1);
continue;
} }
CommandDown(pGE, pCLServing, pCEServing, CommandDown(pGE, pCLServing, pCEServing,
tyme); tyme);
@ -3863,7 +3867,9 @@ DoClientRead(GRPENT *pGE, CONSCLIENT *pCLServing)
case 'L': case 'L':
if (!pCLServing->fwr) { if (!pCLServing->fwr) {
goto unknownchar; FileWrite(pCLServing->fd, FLAGFALSE,
"attach to toggle logging]\r\n", -1);
continue;
} }
CommandLogging(pGE, pCLServing, pCEServing, CommandLogging(pGE, pCLServing, pCEServing,
tyme); tyme);
@ -3871,7 +3877,9 @@ DoClientRead(GRPENT *pGE, CONSCLIENT *pCLServing)
case 'l': /* halt character 1 */ case 'l': /* halt character 1 */
if (!pCLServing->fwr) { if (!pCLServing->fwr) {
goto unknownchar; FileWrite(pCLServing->fd, FLAGFALSE,
"attach to send break]\r\n", -1);
continue;
} }
if (pCEServing->fronly) { if (pCEServing->fronly) {
FileWrite(pCLServing->fd, FLAGFALSE, FileWrite(pCLServing->fd, FLAGFALSE,
@ -3950,10 +3958,12 @@ DoClientRead(GRPENT *pGE, CONSCLIENT *pCLServing)
break; break;
case 's': /* spy mode */ case 's': /* spy mode */
if (!pCLServing->fwr) {
goto unknownchar;
}
pCLServing->fwantwr = 0; pCLServing->fwantwr = 0;
if (!pCLServing->fwr) {
FileWrite(pCLServing->fd, FLAGFALSE,
"ok]\r\n", -1);
continue;
}
BumpClient(pCEServing, (char *)0); BumpClient(pCEServing, (char *)0);
TagLogfileAct(pCEServing, "%s detached", TagLogfileAct(pCEServing, "%s detached",
pCLServing->acid->string); pCLServing->acid->string);
@ -4015,7 +4025,9 @@ DoClientRead(GRPENT *pGE, CONSCLIENT *pCLServing)
case '!': /* invoke a task */ case '!': /* invoke a task */
if (!pCLServing->fwr) { if (!pCLServing->fwr) {
goto unknownchar; FileWrite(pCLServing->fd, FLAGFALSE,
"attach to invoke task]\r\n", -1);
continue;
} }
pCLServing->iState = S_TASK; pCLServing->iState = S_TASK;
FileWrite(pCLServing->fd, FLAGFALSE, FileWrite(pCLServing->fd, FLAGFALSE,

View File

@ -1365,7 +1365,7 @@ main(int argc, char **argv)
break; break;
case 'O': case 'O':
/* How often to try opening all down consoles, in minutes */ /* How often to try opening all down consoles, in minutes */
optConf->reinitcheck = atoi(optarg); optConf->reinitcheck = atoi(optarg) * 60;
break; break;
case 'p': case 'p':
if ((optConf->primaryport = StrDup(optarg)) == (char *)0) if ((optConf->primaryport = StrDup(optarg)) == (char *)0)

View File

@ -4562,6 +4562,7 @@ void
ConfigItemReinitcheck(char *id) ConfigItemReinitcheck(char *id)
{ {
char *p; char *p;
int factor = 0;
CONDDEBUG((1, "ConfigItemReinitcheck(%s) [%s:%d]", id, file, line)); CONDDEBUG((1, "ConfigItemReinitcheck(%s) [%s:%d]", id, file, line));
@ -4570,18 +4571,22 @@ ConfigItemReinitcheck(char *id)
return; return;
} }
for (p = id; *p != '\000'; p++) for (p = id; factor == 0 && *p != '\000'; p++)
if (!isdigit((int)(*p))) if (*p == 's' || *p == 'S')
factor = 1;
else if (*p == 'm' || *p == 'M')
factor = 60;
else if (!isdigit((int)(*p)))
break; break;
/* if it wasn't a number */ /* if it wasn't a number or a qualifier wasn't at the end */
if (*p != '\000') { if (*p != '\000') {
if (isMaster) if (isMaster)
Error("invalid reinitcheck value `%s' [%s:%d]", id, file, Error("invalid reinitcheck value `%s' [%s:%d]", id, file,
line); line);
return; return;
} }
parserConfigTemp->reinitcheck = atoi(id); parserConfigTemp->reinitcheck = atoi(id) * (factor == 0 ? 60 : factor);
} }
void void

View File

@ -18,7 +18,7 @@ typedef struct config {
char *primaryport; char *primaryport;
FLAG redirect; FLAG redirect;
FLAG loghostnames; FLAG loghostnames;
int reinitcheck; int reinitcheck; /* stored in sec, configured in min or sec */
char *secondaryport; char *secondaryport;
char *unifiedlog; char *unifiedlog;
int initdelay; int initdelay;

View File

@ -1,6 +1,7 @@
### Path settings ### Path settings
datarootdir = @datarootdir@ datarootdir = @datarootdir@
srcdir = @srcdir@ srcdir = @srcdir@
VPATH = @srcdir@
top_srcdir = @top_srcdir@ top_srcdir = @top_srcdir@
prefix = @prefix@ prefix = @prefix@
exec_prefix = @exec_prefix@ exec_prefix = @exec_prefix@

View File

@ -7,6 +7,9 @@ default * {
timestamp ""; timestamp "";
include full; include full;
} }
config * {
reinitcheck 1s;
}
break 5 { break 5 {
string "\rtest\r"; string "\rtest\r";
} }