fix(telnet): stop Mudlet masking all input for the whole session#632
Closed
MorquinDevlar wants to merge 1 commit into
Closed
fix(telnet): stop Mudlet masking all input for the whole session#632MorquinDevlar wants to merge 1 commit into
MorquinDevlar wants to merge 1 commit into
Conversation
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.
3cce9bb to
ae023bb
Compare
Volte6
requested changes
Jun 17, 2026
Volte6
left a comment
Member
There was a problem hiding this comment.
One small change request.
This is a lot of change for mudlet, with special exceptions. That's annoying. Oh well.
Comment on lines
+139
to
+145
| TELNET_NEWENV_IS IACByte = 0 // Client -> Server: here are my variables | ||
| TELNET_NEWENV_SEND IACByte = 1 // Server -> Client: please send these variables | ||
| TELNET_NEWENV_INFO IACByte = 2 // Client -> Server: a variable changed | ||
| TELNET_NEWENV_VAR IACByte = 0 // A well-known variable name follows | ||
| TELNET_NEWENV_VALUE IACByte = 1 // A variable value follows | ||
| TELNET_NEWENV_ESC IACByte = 2 // Escape the next byte (it is data, not a code) | ||
| TELNET_NEWENV_USERVAR IACByte = 3 // A user-defined variable name follows |
Member
There was a problem hiding this comment.
These IACByte's are already defined - should be aliases:
TELNET_NEWENV_IS = TELNET_OPT_TXBIN
TELNET_NEWENV_SEND = TELNET_OPT_ECHO
TELNET_NEWENV_INFO = TELNET_OPT_RECONN
TELNET_NEWENV_VAR = TELNET_OPT_TXBIN
TELNET_NEWENV_VALUE = TELNET_NEWENV_SEND
TELNET_NEWENV_ESC = TELNET_NEWENV_INFO
TELNET_NEWENV_USERVAR = TELNET_OPT_SUP_GO_AHD
Contributor
Author
|
Superseded by #633, re-opened from a fork ( |
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.
Problem
When connecting with Mudlet (raw telnet, not the web client), the input line is masked (hidden) for the entire session - the username prompt, every command, everything - not just password prompts.
Root cause
On connect,
handleTelnetConnection()unconditionally sentIAC WILL ECHOto every telnet client and never withdrew it. GoMud runs in character-at-a-time mode and does server-side echo (echoing each typed character itself, emitting mask characters for passwords). That is correct for raw character-mode telnet clients that rely on the server to echo.Mudlet, however, echoes locally and interprets the telnet ECHO option purely as a password-masking hint:
IAC WILL ECHO-> hide/mask the input lineIAC WONT ECHO-> show the input lineBecause the server asserted
WILL ECHOonce at connect and never sentWONT ECHO(its masking is done at the application layer), Mudlet stayed in "masked" mode permanently.Fix
Detect the client type at connect and branch the echo behavior. Raw-telnet and web-client behavior are unchanged; the new behavior applies only to local-echo (Mudlet) clients.
IAC WONT ECHOIAC WILL ECHOIAC WONT ECHODetection (the timing problem)
GoMud does not know a client is Mudlet at the moment it must choose the connect-time echo baseline (GMCP detection arrives too late). This adds a short, synchronous MNES
NEW-ENVIRONprobe before the first prompt: the server requestsCLIENT_NAME/CLIENT_VERSION, and Mudlet repliesCLIENT_NAME=Mudlet. The probe is bounded (200ms per read, 2s overall); a client that ignoresNEW-ENVIRONfalls back to non-Mudlet and still logs in. AI connections skip the probe and keep the historical baseline.Changes
internal/connections/clientsettings.go- addIsMudlet/DetectionComplete.internal/connections/connectiondetails.go-SetReadDeadlinefor bounded probe reads (telnet path only).internal/term/{telnet,term}.go-NEW-ENVIRONsub-negotiation codes, request/response matchers, and aTelnetRequestMNESVarshelper.internal/inputhandlers/term_iac.go- negotiateNEW-ENVIRONand recordIsMudletfromCLIENT_NAME(+ unit test for the response parser).main.go-detectClientTypeprobe and the echo-baseline branch; the login handler is now added to the chain after detection.internal/inputhandlers/login_prompt_handler.go- skip server echo/mask and the Enter newline for local-echo clients; toggleWILL/WONT ECHOmasking around Mudlet password steps.Test plan
telnet/tintin++): unchanged - server echoes input, passwords masked with mask chars.TEXTMASKtoggles the password field; no double echo.NEW-ENVIRONfalls back to non-Mudlet within ~2s and still logs in.Automated:
make validateandgo test ./...pass; addedTestNewEnvironIsMudlet/TestNewEnvironResponseMatcher.