ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/login.ext
(Generate patch)

Comparing deliantra/server/ext/login.ext (file contents):
Revision 1.113 by root, Sat Aug 28 00:30:28 2010 UTC vs.
Revision 1.118 by root, Thu Nov 8 00:16:07 2012 UTC

3# login handling 3# login handling
4 4
5use Fcntl; 5use Fcntl;
6use Coro::AIO; 6use Coro::AIO;
7 7
8our $MAX_DISCONNECT_TIME = $cf::CFG{max_disconnect_time} || 3600; 8CONF MAX_DISCONNECT_TIME = 3600;
9 9
10# paranoia function to overwrite a string-in-place 10# paranoia function to overwrite a string-in-place
11sub nuke_str { 11sub nuke_str {
12 substr $_[0], 0, (length $_[0]), "x" x length $_[0] 12 substr $_[0], 0, (length $_[0]), "x" x length $_[0]
13} 13}
60 or return; 60 or return;
61 my $x = $ob->x; 61 my $x = $ob->x;
62 my $y = $ob->y; 62 my $y = $ob->y;
63 63
64 # never happens normally, but helps when shell users make mistakes 64 # never happens normally, but helps when shell users make mistakes
65 $m->in_memory == cf::MAP_ACTIVE 65 $m->linkable
66 or return 1; 66 or return 1;
67 67
68# return 0;#d# 68# return 0;#d#
69# warn join ":", $m->at ($x, $y);#d# 69# warn join ":", $m->at ($x, $y);#d#
70# warn "FOO$m { ".scalar ($m->at ($x, $y))." }\n"; 70# warn "FOO$m { ".scalar ($m->at ($x, $y))." }\n";
140} 140}
141 141
142sub compare_password($$) { 142sub compare_password($$) {
143 my ($pass, $token) = @_; 143 my ($pass, $token) = @_;
144 144
145 if ($token =~ /\!(.*)/) { 145 if ($token =~ /!!(.*)/) {
146 return +(substr $pass, 0, 8) eq pack "H*", $1;
147 } elsif ($token =~ /!(.*)/) {
146 return $pass eq pack "H*", $1; 148 return $pass eq pack "H*", $1;
147 } else { 149 } else {
148 return $token eq crypt $pass, $token; 150 return $token eq crypt $pass, $token;
149 } 151 }
150} 152}
288 ); 290 );
289 next; 291 next;
290 } 292 }
291 } else { 293 } else {
292 # unable to load the playerfile: 294 # unable to load the playerfile:
293 # check wether the player dir exists, which means the file is corrupted or 295 # check whether the player dir exists, which means the file is corrupted or
294 # something very similar. 296 # something very similar.
295 if (!aio_stat cf::player::playerdir $user) { 297 if (!aio_stat cf::player::playerdir $user) {
296 $ns->send_drawinfo ( 298 $ns->send_drawinfo (
297 "Unable to retrieve this player. It might be a locked or broken account. " 299 "Unable to retrieve this player. It might be a locked or broken account. "
298 . "If this is your account, ask a dungeon master for assistance. " 300 . "If this is your account, ask a dungeon master for assistance. "
495 497
496 $pl->save; 498 $pl->save;
497 499
498 $ob->send_msg ($cf::SAY_CHANNEL => "In the future, you will wake up here when you die.", cf::NDI_DEF | cf::NDI_REPLY); 500 $ob->send_msg ($cf::SAY_CHANNEL => "In the future, you will wake up here when you die.", cf::NDI_DEF | cf::NDI_REPLY);
499 501
502 my $ns = $pl->ns
503 or return;
504
500 $pl->ns->query (cf::CS_QUERY_SINGLECHAR, "Do you want to continue playing (y/n)?", sub { 505 $ns->query (cf::CS_QUERY_SINGLECHAR, "Do you want to continue playing (y/n)?", sub {
501 if ($_[0] !~ /^[yY]/) { 506 if ($_[0] !~ /^[yY]/) {
502 $pl->invoke (cf::EVENT_PLAYER_LOGOUT, 1); 507 $pl->invoke (cf::EVENT_PLAYER_LOGOUT, 1);
503 $pl->deactivate; 508 $pl->deactivate;
504 $pl->ns->destroy; 509 $pl->ns->destroy;
505 } 510 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines