Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ SMAUG
➜ Compiling the server
➜ Problems with crypt
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Gaurnar
(8 posts) Bio
|
| Date
| Thu 07 Jul 2005 09:54 AM (UTC) |
| Message
| I have encountered a problem with passwords.(I've compiled smaug1.4a under Cygwin) I can't login as Lordrom, because smaug tells that my password is incorrect. I tried looking into the code, and found the function "crypt" in charge of password comparing. What is that function and can it be responsible for that kind of problem?
Here is the part of the code where the password is being compared:
if ( strcmp( crypt( argument, ch->pcdata->pwd ),
ch->pcdata->pwd ) )
{
write_to_buffer( d, "Incorrect password.\n\r", 0 );
d->character->desc = NULL;
close_socket( d, FALSE );
return;
}
P.S: I didn't change anything in the code | | Top |
|
| Posted by
| Zeno
USA (2,871 posts) Bio
|
| Date
| Reply #1 on Thu 07 Jul 2005 04:28 PM (UTC) |
| Message
| | Do passwords work correctly otherwise? Like if you create a new character? If so, it is not a code problem and most likely it is just the incorrect password. |
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | | Top |
|
| Posted by
| David Haley
USA (3,881 posts) Bio
|
| Date
| Reply #2 on Thu 07 Jul 2005 05:29 PM (UTC) |
| Message
| | There's some issue where the Windows crypt function simply returns the same password as what got typed, due to export law restrictions. E.g. crypt(hello) --> hello. If you're using Cygwin, the WIN32 preprocessor directive [i]might[/i] be defined and so it [i]might[/i] be falling back on the straight-through crypt. If that's the case, the Lordrom character might have an encrypted password stored, but crypt will never yield that password. Try changing the Lordrom password to the plaintext version and see if that works. |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | | Top |
|
| Posted by
| Gaurnar
(8 posts) Bio
|
| Date
| Reply #3 on Fri 08 Jul 2005 03:51 AM (UTC) |
| Message
| | to Zeno: I have the same problem with newly created characters, so I think that's the problem with crypt function. | | Top |
|
| Posted by
| Zeno
USA (2,871 posts) Bio
|
| Date
| Reply #4 on Fri 08 Jul 2005 04:43 AM (UTC) |
| Message
| | Might be. Try attaching gdb to it and printing the password of the character then print the argument. |
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | | Top |
|
| Posted by
| Gaurnar
(8 posts) Bio
|
| Date
| Reply #5 on Fri 08 Jul 2005 07:49 AM (UTC) |
| Message
| I tried printing password and argument and found out that they are equal! Can it be a strcmp function's error?
Though (while creating a new character) it says that the password I typed in to confirm is different from the password I typed in for the character, next time it seems to be allright! Look:
-- comments
---------------------------------
Make sure to use a password that won't be easily guessed by someone else.
Pick a good password for Max: qwerty
qwerty -- argument
qwerty -- password
Please retype the password to confirm: qwerty
qwerty -- argument
qwerty -- password
Passwords don't match.
Retype password:
qwerty -- argument
qwerty -- password
Please retype the password to confirm: qwerty --OK
Choose your sex: (M/F/N) | | Top |
|
| Posted by
| Zeno
USA (2,871 posts) Bio
|
| Date
| Reply #6 on Fri 08 Jul 2005 05:57 PM (UTC) |
| Message
| | What about printing a password in crypt? Or you can try using the 'formpass' command on the MUD. |
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | | Top |
|
| Posted by
| Gaurnar
(8 posts) Bio
|
| Date
| Reply #7 on Sat 09 Jul 2005 02:47 AM (UTC) |
| Message
| I have rewritten the code, so I don't use crypt anymore. But still it doesn't work, and I can't get the idea why.
Here's the code:
---------
case CON_GET_NEW_PASSWORD:
write_to_buffer( d, "\n\r", 2 );
if ( strlen(argument) < 5 )
{
write_to_buffer( d,
"Пароль должен содержать по крайней мере 5 символов.\n\rПароль: ", // it's some Russian
0 );
return;
}
pwdnew = argument;
for ( p = pwdnew; *p != '\0'; p++ )
{
if ( *p == '~' )
{
write_to_buffer( d,
"Неприемлемый пароль.\n\rПароль: ",
0 );
return;
}
}
DISPOSE( ch->pcdata->pwd );
ch->pcdata->pwd = str_dup( pwdnew );
write_to_buffer( d, "\n\rPlease retype the password to confirm: ", 0 );
d->connected = CON_CONFIRM_NEW_PASSWORD;
break;
case CON_CONFIRM_NEW_PASSWORD:
write_to_buffer( d, "\n\r", 2 );
if (strcmp(argument, ch->pcdata->pwd ))
{
write_to_buffer( d, "Passwords don't match.\n\rRetype password: ",
0 );
d->connected = CON_GET_NEW_PASSWORD;
return;
}
-------
Please, help me! | | Top |
|
| Posted by
| Zeno
USA (2,871 posts) Bio
|
| Date
| Reply #8 on Sat 09 Jul 2005 02:51 AM (UTC) |
| Message
| | What's wrong? They don't match? Try printing argument and ch->password->pwd |
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | | Top |
|
| Posted by
| Gaurnar
(8 posts) Bio
|
| Date
| Reply #9 on Sat 09 Jul 2005 08:47 AM (UTC) |
| Message
| Finally, I've got the idea. Could you please tell me some alternatives for isascii and isprint functions, the problem is that they don't support letters of Russian alphabet. I tried iswascii, but there is no such function declared in Cygwin. When I tried to remove these functions from the code, the problem with passwords occured. Here is the piece of the code that is malfunctioning with letters of Russian alphabet:
------------------------
if ( d->inbuf[i] == '\b' && k > 0 )
--k;
else if ( isascii(d->inbuf[i]) && isprint(d->inbuf[i]) )
d->incomm[k++] = d->inbuf[i]; | | Top |
|
| Posted by
| Samson
USA (683 posts) Bio
|
| Date
| Reply #10 on Mon 11 Jul 2005 12:13 PM (UTC) |
| Message
| Bit late to the table here, but did you try downloading the Cygwin crypt library? It's in the development or library sections listed as libcrypt and probably would have solved your problem with minimal hassle.
The other alternative would have been to install the MD5 password snippet which doesn't require the use of any crypt libraries and would also likely have solved the problem.
If it's due to the code not accepting Russian characters, there's a line in the comm.c file ( don't know off hand exactly where ) that makes a call to isprint() and can be modified to allow what you need. | | Top |
|
| Posted by
| Gaurnar
(8 posts) Bio
|
| Date
| Reply #11 on Wed 13 Jul 2005 08:07 AM (UTC) |
| Message
| 2Samson: What do you mean by "modify" the line with isprint in it? How should I change it?
Speaking about crypt, I'm using a NOCRYPT define in the source, so it should work fine, but it doesn't. | | Top |
|
| Posted by
| Zeno
USA (2,871 posts) Bio
|
| Date
| Reply #12 on Wed 13 Jul 2005 03:17 PM (UTC) |
| Message
| | Look over "man isprint" for what it checks and if it allows Russian characters. If it doesn't, remove the check. |
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | | Top |
|
| Posted by
| Gaurnar
(8 posts) Bio
|
| Date
| Reply #13 on Thu 14 Jul 2005 04:30 AM (UTC) |
| Message
| | Yeah, it doesn't allow Russian characters, but if I remove it I get the problem with the passwords, which I told you about before. Even in that case SMAUG doesn't support Russian characters, though I know for certain that there's a way for making him support them, because in Russia we have a MUD game based on SMAUG that is in Russian. Help me! | | 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.
43,059 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top