Issues during login

Posted by Alkarindil on Sat 22 Jan 2011 12:54 AM — 4 posts, 24,054 views.

Brazil #0
Hi there!

I was looking for an older version of my SMAUG codes to get some snippets I am not able to find again on the Internet. So I decided to code in this older version.

The thing is: everytime I try to do the login, I get an error in the nanny function.
By the first attempt, this condition becomes true and it returns an error:

if(!check_parse_name(argument, (d->newstate != 0))){
//error
return;
}

In the second attempt it works fine.
I used some printf in the server and I discovered that in the first time I write the nickname, the argument passed to nanny is (without the cotes): " 'lordrom"; with a space, an apostrophe and then the name.

Once the argument is passed, the function get rid of the space, but the apostrophe remains.

I am looking for the root of this problem, but I wasn't able to find it. Can you help-me?

This is part of the nanny code:


void nanny( DESCRIPTOR_DATA *d, char *argument )
{
    char buf[MAX_STRING_LENGTH];
    char arg[MAX_STRING_LENGTH];
    CHAR_DATA *ch;
    char *pwdnew;
    char *p;
    int iClass;
    int iRace;
    int iTown;
    extern int top_nation;
    bool fOld, chk;

printf("1. %s\n\r", argument);

    while ( isspace(*argument) )
    argument++;

printf("2. %s\n\r", argument);

    ch = d->character;

    switch ( d->connected ){
        default:
            bug( "Nanny: bad d->connected %d.", d->connected );
            close_socket( d, TRUE );
        return;
    //-----------------------------------
        case CON_GET_NAME:
            if ( argument[0] == '\0' ){
                close_socket( d, FALSE );
                return;
            }
            argument[0] = UPPER(argument[0]);

            /* Old players can keep their characters. -- Alty */
            if ( !check_parse_name( argument, (d->newstate != 0) ) ){
                write_to_buffer( d, "Prohibited name. Please try again.\n\rName: ", 0 ); //this is the error
                return;
            }

(...)


This is the MUD window:


[welcome things]
Enter your character's name, or type new: lordrom
Prohibited name. Please try again.
Name: lordrom
Password:


And this is what I get in the console. Take a look in the password (123) and the way the nickname first appear and how my second try goes.


Fri Jan 21 22:52:03 2011 :: Sock.sinaddr:  127.0.0.1, port 1572.
Fri Jan 21 22:52:03 2011 :: [*****] BUG: Auth_open: connection refused
1.  'lordrom
2. 'lordrom
1. lordrom
2. lordrom
Fri Jan 21 22:52:10 2011 :: Preloading player data for: Lordrom (0K)
1. 123
2. 123
Fri Jan 21 22:52:11 2011 :: Loading player data for: Lordrom (0K)
Fri Jan 21 22:52:11 2011 :: Lordrom@127.0.0.1((connect refused)) is connected.


Hope you can help-me, this thing is starting to bother me.

Thanks in advance!
Amended on Sat 22 Jan 2011 12:58 AM by Alkarindil
Australia Forum Administrator #1
Alkarindil said:


By the first attempt, this condition becomes true and it returns an error:

if(!check_parse_name(argument, (d->newstate != 0))){
//error
return;
}

In the second attempt it works fine.



Do you mean the first attempt after you start Smaug, or the first attempt at this client? I seem to recall that under certain circumstances the telnet negotiation (eg NAWS) was sending characters that were being taken as the name or password by the server. If you are using an older version of Smaug, it may not have the more modern telnet negotiation handling in the comms module.

I would try turning on packet debug in the client (if you are using MUSHclient) and seeing exactly what the client is sending.
Brazil #2
Well, I gave up setting this. I am moving to a Linux-based code and I shall try to apply the same snippets.

The thing is.. I cannot find those snippets anymore! x(
USA #3
One might ask which snippets you're unable to find in case one has a copy of them archived somewhere or knows where to find them... ;)

[Edit] Oops, nevermind, I see this was already addressed in another thread at
Template:post=10898
Please see the forum thread: http://gammon.com.au/forum/?id=10898.