Fix CLEAR APC command #16
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
CLEAR APCcommands documented purpose is to cause Kermit to remain on the command screen after executing an APC command. As such, this command itself is allowed to be executed by APC.However, the mechanim the command uses to achieve its goal has an unfortunate side-effect: for the rest of the APC sequence, Kermit now thinks the commands its executing came from the user at the command screen - not the remote host. As a result it stops checking whether subsequent commands are allowed to be executed via APC which is a problem. As APC is off by default the overall impact should be small.
The fix is to set a dedicated flag instead of clearing the apc status, and defer apc clearing until the very end of the APC sequence.
If APC is currently set to UNCHECKED then on non-K95 platforms the former behaviour is preserved as in this state the host can already run what it likes and I'm not sure if actually clearing the APC status mid-APC sequence may have desirable effects in some situations. K95 platforms are excluded as clearing the APC status from inside an APC results in a deadlock (this is how I stumbled on the issue).