Gammon Forum
Entire forum
SMAUG
SMAUG coding
Name auth system, exploit?
Name auth system, exploit?
|
It is now over 60 days since the last post. This thread is closed.
  Refresh page
Posted by
| Zeno
USA (2,871 posts) bio
|
Date
| Fri 24 Sep 2004 02:32 AM (UTC) |
Message
| If I deny a name, they change it, then both characters now exist. For example, Bob renames to Bobby, both Bob and Bobby remain, so they have duplicate equipment now, etc. This is pretty bad. How would I fix this?
oldname = ch->name;
sprintf( fname, "%s%c/%s", PLAYER_DIR, tolower(argument[0]),
capitalize( argument ) );
if ( stat( fname, &fst ) != -1 )
{
send_to_char("That name is already taken. Please choose another.\n\r", ch);
return;
}
STRFREE( ch->name );
ch->name = STRALLOC( argument );
STRFREE( ch->pcdata->filename );
ch->pcdata->filename = STRALLOC( argument );
send_to_char("Your name has been changed.\n\r", ch);
ch->pcdata->auth_state = 0;
sprintf( buf, "%s changed name to %s.", oldname, ch->name);
to_channel( buf, CHANNEL_AUTH, "Auth", LEVEL_NEOPHYTE );
return;
}
|
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | top |
|
Posted by
| Greven
Canada (835 posts) bio
|
Date
| Reply #1 on Fri 24 Sep 2004 06:05 AM (UTC) Amended on Fri 24 Sep 2004 06:07 AM (UTC) by Greven
|
Message
| You can add this in like such: oldname = ch->name;
sprintf( fname, "%s%c/%s", PLAYER_DIR, tolower(argument[0]),
capitalize( argument ) );
if ( stat( fname, &fst ) != -1 )
{
send_to_char("That name is already taken. Please choose another.\n\r", ch);
return;
}
sprintf( fname, "%s%c/%s", PLAYER_DIR, tolower(ch->name[0]),
capitalize( ch->name ) );
if (access(fname, F_OK) == 0)
unlink(fname);
STRFREE( ch->name );
ch->name = STRALLOC( argument );
STRFREE( ch->pcdata->filename );
ch->pcdata->filename = STRALLOC( argument );
send_to_char("Your name has been changed.\n\r", ch);
ch->pcdata->auth_state = 0;
sprintf( buf, "%s changed name to %s.", oldname, ch->name);
to_channel( buf, CHANNEL_AUTH, "Auth", LEVEL_NEOPHYTE );
return;
}
That should check if they have a pfile (perhaps they have not been authed yet), and if they do, remove it. |
Nobody ever expects the spanish inquisition!
darkwarriors.net:4848
http://darkwarriors.net | 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.
7,808 views.
It is now over 60 days since the last post. This thread is closed.
  Refresh page
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.