fix(telnet): stop Mudlet masking all input for the whole session (#633) - #1
Merged
Conversation
* fix(telnet): stop Mudlet masking all input for the whole session Mudlet (and other local-echo clients) treat telnet WILL ECHO as a "mask this field" hint rather than a server-echo request. GoMud asserted WILL ECHO unconditionally at connect and never withdrew it, so Mudlet masked every keystroke for the entire session. Detect the client type at connect via an MNES NEW-ENVIRON probe and branch the echo behavior: - Mudlet: baseline WONT ECHO (Mudlet echoes locally); the server no longer echoes/masks per character or emits its own newline. Password prompts are masked by transiently asserting WILL ECHO and withdrawing it (WONT ECHO) once the step validates. - Raw telnet: unchanged - WILL ECHO baseline with server-side echo and mask-character passwords. - Web client: unchanged - TEXTMASK toggling, no server-side per-char echo. Detection is synchronous and bounded (200ms per read, 2s overall); a client that ignores NEW-ENVIRON falls back to non-Mudlet and still logs in. AI connections skip the probe and keep the historical baseline. Changes: - connections.ClientSettings: add IsMudlet / DetectionComplete. - ConnectionDetails.SetReadDeadline for the bounded probe reads. - term: NEW-ENVIRON sub-negotiation codes, request/response matchers, and a TelnetRequestMNESVars helper. - TelnetIACHandler: negotiate NEW-ENVIRON and record IsMudlet from CLIENT_NAME, plus a unit test for the response parser. - main.go: detectClientType probe and echo-baseline branch. - login_prompt_handler: skip server echo/mask and newline for local-echo clients; toggle ECHO masking around Mudlet password steps. * term: alias NEW-ENVIRON codes to existing telnet constants Address review feedback on PR #633: the NEW-ENVIRON sub-negotiation codes share byte values with telnet option constants already defined in this block, so alias them instead of re-declaring literals. Values are unchanged (IS/VAR=0, SEND/VALUE=1, INFO/ESC=2, USERVAR=3), so behavior is identical. * telnet: offer EOR and broaden NEW-ENVIRON detection for Mudlet masking Real-Mudlet testing showed password masking half-working: Mudlet honored WILL ECHO (command echo suppressed) but did not put asterisks on the input line. Aligns the connect/detection sequence with a known-working downstream fork: - Offer WILL EOR at connect. Mudlet prefers EOR over GA to delimit prompts; with SUPPRESS-GO-AHEAD set and no EOR, Mudlet has no prompt anchor for its input-line masking. - Request ALL NEW-ENVIRON variables (empty SEND) instead of naming specific ones - broadly compatible; Mudlet returns CLIENT_NAME among them. - Match the NEW-ENVIRON IS response on the 'IAC SB NEW-ENVIRON IS' prefix alone (tolerant of TCP segmentation / trailing bytes), and make the parser treat IAC as a name/value terminator so a trailing IAC SE never bleeds into the final variable's value.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Mudlet (and other local-echo clients) treat telnet WILL ECHO as a "mask this field" hint rather than a server-echo request. GoMud asserted WILL ECHO unconditionally at connect and never withdrew it, so Mudlet masked every keystroke for the entire session.
Detect the client type at connect via an MNES NEW-ENVIRON probe and branch the echo behavior:
Detection is synchronous and bounded (200ms per read, 2s overall); a client that ignores NEW-ENVIRON falls back to non-Mudlet and still logs in. AI connections skip the probe and keep the historical baseline.
Changes:
Address review feedback on PR GoMudEngine#633: the NEW-ENVIRON sub-negotiation codes share byte values with telnet option constants already defined in this block, so alias them instead of re-declaring literals. Values are unchanged (IS/VAR=0, SEND/VALUE=1, INFO/ESC=2, USERVAR=3), so behavior is identical.
Real-Mudlet testing showed password masking half-working: Mudlet honored WILL ECHO (command echo suppressed) but did not put asterisks on the input line. Aligns the connect/detection sequence with a known-working downstream fork:
Description
Provide a description of this Pull Request.
Changes
Provide a bullet point list of noteworthy changes in this Pull Request:
x,y,z.x,y,z, fromthistothatsettingX-valueOld=>valueNew