mth icon indicating copy to clipboard operation
mth copied to clipboard

Windows Telnet Echo Issue

Open msocorcim opened this issue 3 years ago • 2 comments

On my ROM with MTH 1.5, a Windows Telnet Session (tested with Win 10 and 11) has improper echos. I tested this with BasedMUD with the same results. This doesn't affect PuTTY telnet, the Linux netkit console telnet client, or any of several mud clients tested. Our user was able to use PuTTY, so this is no big deal, but it would be nice being able to identify a Windows telnet session and to limit option negotiations to those the client can process gracefully.

Below, I'm typing the name Msocorcim.

Do you want ANSI? (Y/n) yy Ansi enabled!

THIS IS A MUD BASED ON.....

                            ROM Version 2.4 beta

           Original DikuMUD by Hans Staerfeldt, Katja Nyboe,
           Tom Madsen, Michael Seifert, and Sebastian Hammer
           Based on MERC 2.1 code by Hatchet, Furey, and Kahn
           ROM 2.4 copyright (c) 1993-1998 Russ Taylor

By what name do you wish to be known? MMsoMsocoMsocorcMsocorcim

msocorcim avatar Oct 12 '22 19:10 msocorcim

Looks like the problem is in telopt.c with the code starting with:

if (HAS_BIT(d->mth->comm_flags, COMM_FLAG_REMOTEECHO))

Try replacing that code block with:

        if (HAS_BIT(d->mth->comm_flags, COMM_FLAG_REMOTEECHO))
        {
                pto = out + outlen;

                skip = strlen((char *) pto);

                for (cnt = 0 ; cnt < skip ; cnt++)
                {
                        switch (pto[cnt])
                        {
                                case   8:
                                case 127:
                                        pto[cnt] = '\b';
                                        write_to_descriptor(d->descriptor, "\b \b", 3);
                                        break;

                                case '\n':
                                        write_to_descriptor(d->descriptor, "\r\n", 2);
                                        break;

                                default:
                                        if (HAS_BIT(d->mth->comm_flags, COMM_FLAG_PASSWORD))
                                        {
                                                write_to_descriptor(d->descriptor, "*", 1);
                                        }
                                        else
                                        {
                                                write_to_descriptor(d->descriptor, (char *) (pto + cnt), 1);
                                        }
                                        break;
                        }
                }
        }

scandum avatar Oct 13 '22 19:10 scandum

Thanks! That works well with the Windows Telnet. (replaced "d->descriptor" with "d" for ROM)

msocorcim avatar Oct 13 '22 22:10 msocorcim