Disable nested execute. The execute protocol is flawed and cannot be

implemented correctly by asynchronous clients --- unless a client
waits for a prompt after sending the execute command and its argument,
it is prone to send more input before the C_EXECUTE arrives.  That
input overtakes the contents of the script file.  This is almost
certain to happen when the execute is in a script file.  Disabling
that is probably more useful and certainly less painful than
documenting this mess.  The client rejects nested execute since
servcmd.c rev. 1.42.
(EXEC): new.
(player_coms): Require it for execute.
(player_set_nstat): Set it in nstat.
(execute): Clear it in nstat.
This commit is contained in:
Markus Armbruster 2007-12-09 17:24:30 +00:00
parent ed8e0cd552
commit adfab4344e
4 changed files with 5 additions and 1 deletions

View file

@ -261,6 +261,7 @@ execute(void)
prexec(p);
while (!failed && status()) {
player->nstat &= ~EXEC;
if (recvclient(buf, sizeof(buf)) < 0)
break;
if (parse(buf, scanspace, player->argp, player->comtail,
@ -278,6 +279,7 @@ execute(void)
if (failed) {
while (recvclient(buf, sizeof(buf)) >= 0) ;
}
pr("Execute : %s\n", failed ? "aborted" : "terminated");
player->eof = 0;
return RET_OK;