Skip to content

fix(telnet): stop Mudlet masking all input for the whole session (#633) - #1

Merged
ccubed merged 1 commit into
ccubed:masterfrom
GoMudEngine:master
Jul 17, 2026
Merged

fix(telnet): stop Mudlet masking all input for the whole session (#633)#1
ccubed merged 1 commit into
ccubed:masterfrom
GoMudEngine:master

Conversation

@ccubed

@ccubed ccubed commented Jul 17, 2026

Copy link
Copy Markdown
Owner
  • 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 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.

  • 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.

Description

Provide a description of this Pull Request.

Changes

Provide a bullet point list of noteworthy changes in this Pull Request:

  • Added x, y, z.
  • Changed x, y, z, from this to that
  • Modified settingX - valueOld => valueNew

* 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.
@ccubed ccubed self-assigned this Jul 17, 2026
@ccubed
ccubed merged commit bc99b5a into ccubed:master Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants