Merge pull request #108 from beckerg/beckerg/spymode

Prevent spy-mode clients (i.e., console -s ...) from being promoted to console writer
This commit is contained in:
Bryan Stansell 2024-06-03 17:50:47 -07:00 committed by GitHub
commit 5cd5df957c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3243,7 +3243,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);
} }
@ -3790,7 +3789,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);
@ -3798,7 +3799,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);
@ -3837,7 +3840,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);
@ -3845,7 +3850,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,
@ -3924,10 +3931,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);
@ -3989,7 +3998,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,