From a716c510bc854cd242d7625e2d9c60108e58a212 Mon Sep 17 00:00:00 2001 From: pdbogen Date: Tue, 2 Jun 2009 20:52:00 +0000 Subject: [PATCH] Automatic unidentify on server actions was broken, is fixed now. git-svn-id: https://www.cernu.us/~pdbogen/svn/destult2@99 088b83a4-0077-4247-935c-42ec02c2848b --- core.pl | 7 ++++--- irc.pl | 20 +++++++++++++++----- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/core.pl b/core.pl index d96d6c0..526bcb8 100644 --- a/core.pl +++ b/core.pl @@ -165,6 +165,7 @@ sub cmd { if( exists( $heap->{ 'commands' }->{ uc( $cmd ) } ) ) { if( ( $Destult::config{ 'SECURITY' } =~ /high/i || exists $heap->{ 'cmdaccess' }->{ uc( $cmd ) } ) && !$trusted ) { + print( "CORE: Rejecting access-controlled command attempt from $who (untrusted source)\n" ); $kernel->post( $src, $replypath, "$who: Use of access-controled commands is not allowed from untrusted sources.", @@ -218,9 +219,9 @@ sub access2 { } sub unidentify { - my( $kernel, $heap, $whom ) = @_[ KERNEL, HEAP, ARG0 ]; - if( exists( $heap->{ 'identified' }->{ $whom } ) ) { - delete $heap->{ 'identified' }->{ $whom }; + my( $kernel, $heap, $whom, $src ) = @_[ KERNEL, HEAP, ARG0, ARG1 ]; + if( exists( $heap->{ 'identified' } ) && exists( $heap->{ 'identified' }->{ $src.uc( $whom ) } ) ) { + delete $heap->{ 'identified' }->{ $src.uc( $whom ) }; } } diff --git a/irc.pl b/irc.pl index 88fa0c4..8a94a6b 100644 --- a/irc.pl +++ b/irc.pl @@ -199,7 +199,6 @@ sub on_public { $msg =~ s/(\x3)[0-9]{0,2}//g; $msg =~ s/\x02//g; $cmd = ( split( / /, $msg, 2 ) )[0]; - print( "$bridged -> ".($bridged==0)."\n" ); $kernel->post( "core", "core_public", $who, $msg, $self->{ "ssid" }, $dest->[0], "send_public_to", ($bridged==0) ); } @@ -254,22 +253,33 @@ sub send_private { sub on_kick { my( $kernel, $heap, $whom ) = @_[ KERNEL, HEAP, ARG2 ]; - $kernel->post( "core", "unidentify", uc( $whom ) ); + my $self = $_[HEAP]->{ "self" }; + print( "IRC: $whom kicked\n" ); + $kernel->post( "core", "unidentify", uc( $whom ), $self->{ "ssid" } ); } + sub on_nick { my( $kernel, $heap, $whom ) = @_[ KERNEL, HEAP, ARG0 ]; + my $self = $_[HEAP]->{ "self" }; $whom = ( split( /!/, $whom, 2 ) )[0]; - $kernel->post( "core", "unidentify", uc( $whom ) ); + print( "IRC: $whom changed nick\n" ); + $kernel->post( "core", "unidentify", uc( $whom ), $self->{ "ssid" } ); } + sub on_part { my( $kernel, $heap, $whom ) = @_[ KERNEL, HEAP, ARG0 ]; + my $self = $_[HEAP]->{ "self" }; $whom = ( split( /!/, $whom, 2 ) )[0]; - $kernel->post( "core", "unidentify", uc( $whom ) ); + print( "IRC: $whom parted\n" ); + $kernel->post( "core", "unidentify", uc( $whom ), $self->{ "ssid" } ); } + sub on_quit { my( $kernel, $heap, $whom ) = @_[ KERNEL, HEAP, ARG0 ]; + my $self = $_[HEAP]->{ "self" }; $whom = ( split( /!/, $whom, 2 ) )[0]; - $kernel->post( "core", "unidentify", uc( $whom ) ); + print( "IRC: $whom quit\n" ); + $kernel->post( "core", "unidentify", uc( $whom ), $self->{ "ssid" } ); } sub do_mode { -- 2.11.0