[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  Running the server
. . -> [Subject]  Running Smaug in Raspian

Running Smaug in Raspian

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Pages: 1 2  

Posted by Lerkista   (57 posts)  [Biography] bio
Date Tue 25 Jun 2019 04:23 PM (UTC)

Amended on Tue 25 Jun 2019 04:24 PM (UTC) by Lerkista

Message
Hi

I have a litte problem running Smaugfuss, i have this code in account.c:

"argument" is the name you enter at login:
                argument[0] = UPPER( argument[0] );
                snprintf( buf, MAX_STRING_LENGTH, "Nombre: -%s-\r\n", argument );
                write_to_buffer( d, buf, 0 );


In CYGWIN works fine and shows: "Nombre: -Lerkista-"
but in Raspbian shows: "Nombre: -lerkista-", don't know why UPPER don't work, i also tried to change it to:

               argument[0] = toupper( argument[0] );


But it's the same, don't make the first letter to uppercase

Anyone knows how to fix that?

Thanks
[Go to top] top

Posted by Fiendish   USA  (2,525 posts)  [Biography] bio   Global Moderator
Date Reply #1 on Tue 25 Jun 2019 04:39 PM (UTC)

Amended on Tue 25 Jun 2019 04:51 PM (UTC) by Fiendish

Message
When asking for help with code that doesn't work, please link to the complete source code that you're using. We need to see all of it, not just some microscopic part.

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Lerkista   (57 posts)  [Biography] bio
Date Reply #2 on Tue 25 Jun 2019 07:33 PM (UTC)

Amended on Tue 25 Jun 2019 07:39 PM (UTC) by Lerkista

Message
Fiendish said:

When asking for help with code that doesn't work, please link to the complete source code that you're using. We need to see all of it, not just some microscopic part.


I don't gonna share my source code, since i've work a lot on it, but with Smaugfuss 1.9.3 from: https://github.com/Arthmoor/SmaugFUSS i can reproduce a similar problem

I only apply this changes to make it run in Raspbian: http://gammon.com.au/Arduino/smaugfuss_diffs.txt

In comm.c line 1840 i add:
  bug("Name: %s", argument);


Raspbian:
Enter your character's name, or type new: lerkista

No such player exists.
Please check your spelling, or type new to start a new player.

Name: lerkista
Password: 

Tue Jun 25 15:25:31 2019 :: [*****] BUG: Name: Vlerkista
Tue Jun 25 15:25:33 2019 :: [*****] BUG: Name: Lerkista
Tue Jun 25 15:25:33 2019 :: Preloading player data for: Lerkista (1K)

First try failed because somehow a V is added first to the name, the second try is register normally and it detected the account

CYGWIN:
Enter your character's name, or type new: lerkista
Password: 

Tue Jun 25 16:31:16 2019 :: [*****] BUG: Name: Lerkista
Tue Jun 25 16:31:16 2019 :: Preloading player data for: Lerkista (1K)


This error don't happended here, same source

Here is a "V" added first, in my source "ÿþV" are added, but just in the first input
[Go to top] top

Posted by Nick Gammon   Australia  (23,017 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Tue 25 Jun 2019 08:51 PM (UTC)
Message
ÿþV is 0xFF 0xFE 0x56 in hex.

That is: IAC DONT TELOPT_COMPRESS2

In other words, your client is telling the server to not use MCCP compression, and you are not detecting that telnet subnegotiation option, and trying to treat it as part of the character name.

The server needs to allow for telnet negotiation sequences and not pass them through as commands that the player types.

When you try to log in a second time it doesn't send that sequence again, and therefore you succeed. The client sends the sequence once after connecting.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Lerkista   (57 posts)  [Biography] bio
Date Reply #4 on Tue 25 Jun 2019 09:20 PM (UTC)
Message
Nick Gammon said:

ÿþV is 0xFF 0xFE 0x56 in hex.

That is: IAC DONT TELOPT_COMPRESS2

In other words, your client is telling the server to not use MCCP compression, and you are not detecting that telnet subnegotiation option, and trying to treat it as part of the character name.

The server needs to allow for telnet negotiation sequences and not pass them through as commands that the player types.

When you try to log in a second time it doesn't send that sequence again, and therefore you succeed. The client sends the sequence once after connecting.


Ok, any idea why that behavior is only in Raspbian?
[Go to top] top

Posted by Nick Gammon   Australia  (23,017 posts)  [Biography] bio   Forum Administrator
Date Reply #5 on Tue 25 Jun 2019 09:58 PM (UTC)
Message
What client are you using, and are you using the same client in both cases?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Lerkista   (57 posts)  [Biography] bio
Date Reply #6 on Tue 25 Jun 2019 10:32 PM (UTC)
Message
Nick Gammon said:

What client are you using, and are you using the same client in both cases?


I've tried with Cygwin terminal, SecureCRT, and Raspbian terminal

I've running Smaug in Cygwin, CentOs and Raspbian, and the problem is only with Raspbian
[Go to top] top

Posted by Nick Gammon   Australia  (23,017 posts)  [Biography] bio   Forum Administrator
Date Reply #7 on Wed 26 Jun 2019 02:43 AM (UTC)
Message

Are you using the same client in the version that works, compared to the version that doesn’t work? Please clearly state what you are doing.


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (23,017 posts)  [Biography] bio   Forum Administrator
Date Reply #8 on Wed 26 Jun 2019 02:56 AM (UTC)
Message

In comm.c in my version of SmaugFUSS I see this directly after the client connects:

The string will_compress2_str is this:

Some clients may not recognize TELOPT_COMPRESS2 and therefore reply IAC DONT TELOPT_COMPRESS2 (as I mentioned earlier, is happening to you).

The code in read_from_buffer looks like it should handle IAC DONT, however to see what is going wrong I suggest running under the debugger.

Debugging with gdb


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Lerkista   (57 posts)  [Biography] bio
Date Reply #9 on Wed 26 Jun 2019 04:25 AM (UTC)
Message
I finally fix the problem

I edit read_to_buffer and add this:

  for (p = (unsigned char *)d->inbuf; *p; p++)
  {
    if (*p == IAC)
    {
      bug("IAC %s", d->inbuf);
      if (memcmp (p, (unsigned char *)do_mxp_str, strlen ((const char *)do_mxp_str)) == 0)
      {
        bug("MXP ON");
        turn_on_mxp (d);
        /* remove string from input buffer */
        memmove (p, (unsigned char *)&p [strlen ((const char *)do_mxp_str)], strlen ((const char*)&p [strlen ((const char *)do_mxp_str)]) + 1);
        p--; /* adjust to allow for discarded bytes */
      } /* end of turning on MXP */
      else  if (memcmp (p, (unsigned char *)dont_mxp_str, strlen ((const char*)dont_mxp_str)) == 0)
      {
        bug("MXP OFF");
        d->mxp = FALSE;
        /* remove string from input buffer */
        memmove (p, (unsigned char *)&p [strlen ((const char *)dont_mxp_str)], strlen ((const char *)&p [strlen ((const char *)dont_mxp_str)]) + 1);
        p--; /* adjust to allow for discarded bytes */
      } /* end of turning off MXP */
      else if(memcmp (p, (unsigned char *)do_mccp_str, strlen ((const char *)do_mccp_str)) == 0)
      {
        bug("MCCP ON");   
        compressStart( d );
        /* remove string from input buffer */
        memmove (p, (unsigned char *)&p [strlen ((const char *)do_mccp_str)], strlen ((const char*)&p [strlen ((const char *)do_mccp_str)]) + 1);
        p--; /* adjust to allow for discarded bytes */
      } /* end of turning on MCCP */
      else if(memcmp (p, (unsigned char *)dont_mccp_str, strlen ((const char*)dont_mccp_str)) == 0)
      {
        bug("MCCP OFF");
        compressEnd( d );
        /* remove string from input buffer */
        memmove (p, (unsigned char *)&p [strlen ((const char *)dont_mccp_str)], strlen ((const char *)&p [strlen ((const char *)dont_mccp_str)]) + 1);
        p--; /* adjust to allow for discarded bytes */
      }
      else if(memcmp (p, (unsigned char *)do_echo_str, strlen ((const char *)do_echo_str)) == 0)
      {
        bug("ECHO ON");   
        /* remove string from input buffer */
        memmove (p, (unsigned char *)&p [strlen ((const char *)do_echo_str)], strlen ((const char*)&p [strlen ((const char *)do_echo_str)]) + 1);
        p--; /* adjust to allow for discarded bytes */
      } /* end of turning on ECHO */
      else if(memcmp (p, (unsigned char *)dont_echo_str, strlen ((const char*)dont_echo_str)) == 0)
      {
        bug("ECHO OFF");
        /* remove string from input buffer */
        memmove (p, (unsigned char *)&p [strlen ((const char *)dont_echo_str)], strlen ((const char *)&p [strlen ((const char *)dont_echo_str)]) + 1);
        p--; /* adjust to allow for discarded bytes */
      }         
    } /* end of finding an IAC */
  }


Don't remember where i get the MXP code, but i copy and adjust it to COMPRESS2 and ECHO, because the IAC sent by the client keeps repeating without this code and mess with my inputs

With the bug messages as debug the log show:
MUD startup - Lua extension called
Wed Jun 26 00:14:37 2019 :: [*****] BUG: IAC ÿýVÿý[
Wed Jun 26 00:14:37 2019 :: [*****] BOOT: [*****] BUG: IAC ÿýVÿý[
Wed Jun 26 00:14:37 2019 :: [*****] BUG: MCCP ON
Wed Jun 26 00:14:37 2019 :: [*****] BOOT: [*****] BUG: MCCP ON
Wed Jun 26 00:14:37 2019 :: [*****] BUG: IAC ÿý[
Wed Jun 26 00:14:37 2019 :: [*****] BOOT: [*****] BUG: IAC ÿý[
Wed Jun 26 00:14:37 2019 :: [*****] BUG: MXP ON
Wed Jun 26 00:14:37 2019 :: [*****] BOOT: [*****] BUG: MXP ON
Wed Jun 26 00:14:39 2019 :: [*****] BUG: IAC ÿý\
Wed Jun 26 00:14:39 2019 :: [*****] BOOT: [*****] BUG: IAC ÿý\
Wed Jun 26 00:14:39 2019 :: [*****] BUG: ECHO OFF
Wed Jun 26 00:14:39 2019 :: [*****] BOOT: [*****] BUG: ECHO OFF
Wed Jun 26 00:14:41 2019 :: Cargando cuenta: Lerkista
Wed Jun 26 00:14:42 2019 :: [*****] BUG: IAC ÿþ\
Wed Jun 26 00:14:42 2019 :: [*****] BOOT: [*****] BUG: IAC ÿþ\
Wed Jun 26 00:14:42 2019 :: [*****] BUG: ECHO ON
Wed Jun 26 00:14:42 2019 :: [*****] BOOT: [*****] BUG: ECHO ON
Wed Jun 26 00:14:45 2019 :: Preloading player data for: Lerkista (2K)
Wed Jun 26 00:14:45 2019 :: Loading player data for: Lerkista (2K)


Still don't understand why this happened only in Raspbian
[Go to top] top

Posted by Nick Gammon   Australia  (23,017 posts)  [Biography] bio   Forum Administrator
Date Reply #10 on Wed 26 Jun 2019 05:50 AM (UTC)
Message
Probably because of a different client, however you chose not to disclose whether or not you use a different client with Raspian.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Lerkista   (57 posts)  [Biography] bio
Date Reply #11 on Wed 26 Jun 2019 01:35 PM (UTC)
Message
Nick Gammon said:

Probably because of a different client, however you chose not to disclose whether or not you use a different client with Raspian.


As i said before, i've used SecureCRT, Cygwin terminal and Rasbian terminal

I have the same source (except for the changes you suggest to make it run in Raspbian), in Cygwin, CentOS and Raspbian, and don't matter which client i use, the problem only happened when connected to the Raspbian server

i download mushclient and mudlet, but since i changed the source in Raspbian, i haven't tried with those
[Go to top] top

Posted by Lerkista   (57 posts)  [Biography] bio
Date Reply #12 on Wed 26 Jun 2019 02:31 PM (UTC)
Message
Here is a sourcecode:

https://www.dropbox.com/s/ia7xkteo9stvy7j/smaugfuss193-mxp.tgz?dl=0

running in Raspbian, the first attempt to login fail, because it adds a V before the name (i've added a bug() to see that in log)
[Go to top] top

Posted by Nick Gammon   Australia  (23,017 posts)  [Biography] bio   Forum Administrator
Date Reply #13 on Wed 26 Jun 2019 08:11 PM (UTC)
Message
Lerkista said:

I finally fix the problem ...


So it is fixed, then?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Lerkista   (57 posts)  [Biography] bio
Date Reply #14 on Wed 26 Jun 2019 10:57 PM (UTC)
Message
Nick Gammon said:

Lerkista said:

I finally fix the problem ...


So it is fixed, then?


Yes, i know that maybe the solution is not the optimal but works (at least for the moment without many tests)

I only shared the source code in case you want to investigate because the error only shows in Raspbian and not in another distro
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


39,860 views.

This is page 1, subject is 2 pages long: 1 2  [Next page]

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]