Skip to content

Instantly share code, notes, and snippets.

@ilkkao
Created July 31, 2013 19:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ilkkao/6125242 to your computer and use it in GitHub Desktop.
Save ilkkao/6125242 to your computer and use it in GitHub Desktop.
Test one
if (!defined($sec_cookie) || !defined($userid) || !exists($users{$userid}) ||
!exists($users{$userid}{"secret_cookie"}) ||
$sec_cookie ne $users{$userid}{"secret_cookie"} ||
$users{$userid}{"secret_cookie"} == 0)
{
my $expected = "undef";
$expected = $users{$userid}{"secret_cookie"} if (exists($users{$userid}{"secret_cookie"}));
$sec_cookie = "undef" if (!defined($sec_cookie));
$userid = "undef" if (!defined($userid));
#Send imposter away. reply_send is used not to distrubt legimate user session
&reply_send(0, $socket, 0, $jsonid, "DIE Security violation!");
dprint(1, 0, "WWW: Mismatch: " . $expected .
" != $sec_cookie , userid: $userid");
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment