1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
#### Command AUTH
if ($command eq "auth")
{
if ($nb_arg < 2) {
$sock->sendnotice($user->nick, "com_auth");
return
}
my ($idnick, $password) = $msg[1] $msg[2];
my $id_host = getinfo(lc($idnick), "host");
if (!$id_host) {
$sock->sendnotice($user->nick, "noaccess");
return;
}
$id_host =~ s/\./\\\./g;
$id_host =~ s/\?/\./g;
$id_host =~ s/\*/\.\*/g;
if ($user->mask !~ /^$id_host$/i) {
$sock->sendnotice($user->nick, "badhost");
return;
}
my $id_password = getinfo(lc($idnick), "pass");
if ($id_password ne $password) {
$sock->sendnotice($user->nick, "badpass");
return;
}
if ($user->isauth && $user->{'authid'} eq $idnick) {
$sock->sendnotice($user->nick, "authed");
return ;
}
my $suspend = getinfo($idnick, "suspend");
if ($suspend) {
$sock->sendnotice($user->nick, "suspend");
return;
}
$user->{'auth'} = 1;
$user->{'authid'} = $idnick;
$user->{'authtime'} = time;
$sock->sendnotice($user->nick, "authentified");
} |
Partager