From 1da4484dcd5a2c88d36d13ec456e0d752c38c953 Mon Sep 17 00:00:00 2001 From: pdbogen Date: Thu, 4 Jun 2009 14:15:34 +0000 Subject: [PATCH] Fix some spurious warnings about untrusted sources. git-svn-id: https://www.cernu.us/~pdbogen/svn/destult2@100 088b83a4-0077-4247-935c-42ec02c2848b --- core.pl | 12 +++++++----- irc.pl | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/core.pl b/core.pl index 526bcb8..7ab74ac 100644 --- a/core.pl +++ b/core.pl @@ -34,13 +34,15 @@ POE::Session->create( ) or die( "Unable to create core POE session." ); sub seen { - my( $kernel, $heap, $who ) = @_[ KERNEL, HEAP, ARG0 ]; + my( $kernel, $heap, $who, $src, $trusted ) = @_[ KERNEL, HEAP, ARG0, ARG2, ARG5 ]; if( !exists( $heap->{ 'seen' } ) ) { $heap->{ 'seen' } = { }; } $heap->{ 'seen' }->{ uc( $who ) } = time; - if( exists( $heap->{ 'memo' } ) && exists( $heap->{ 'memo' }->{ uc( $who ) } ) ) { - $kernel->yield( "cmd", $who, "CHECKMEMO", $_[ARG2], $who, "send_private" ); + if( exists( $heap->{ 'memo' } ) && + exists( $heap->{ 'memo' }->{ uc( $who ) } ) && + exists( $heap->{ 'identified' }->{ $src.uc( $who ) } ) ) { + $kernel->yield( "cmd", $who, "CHECKMEMO", $src, $who, "send_private", $trusted ); } } @@ -153,7 +155,7 @@ sub cmd { if( $Destult::config{ 'SECURITY' } =~ /high/i && !exists $heap->{ 'identified' }->{ $src.uc( $who ) } && - $cmd !~ /identify|register|title/i ) { + $cmd !~ /identify|register|title|seen/i ) { $kernel->post( $src, "send_private", "$who: Destult is operating in high security mode; all use must be from identified users. Please REGISTER and then IDENTIFY.", @@ -239,7 +241,7 @@ sub advertise { # this should check for hooks stored on the heap. TODO. sub on_public { my( $kernel, $heap, $who, $what, $src, $dest, $replypath, $trusted ) = @_[ KERNEL, HEAP, ARG0, ARG1, ARG2, ARG3, ARG4, ARG5 ]; - $kernel->yield( "seen", $who, $what, $src, $dest, $replypath ); + $kernel->yield( "seen", $who, $what, $src, $dest, $replypath, $trusted ); my $cmd = ( split( / /, $what, 2 ) )[0]; # Check for the presence of a command if( $cmd =~ /^~.*/ ) { diff --git a/irc.pl b/irc.pl index 8a94a6b..0b8eee4 100644 --- a/irc.pl +++ b/irc.pl @@ -209,7 +209,7 @@ sub on_private { $msg =~ s/(\x3)[0-9]{0,2}//g; $msg =~ s/\x02//g; $cmd = ( split( / /, $msg, 2 ) )[0]; - $kernel->post( "core", "seen", $who ); + $kernel->post( "core", "seen", $who, $msg, $self->{ "ssid" }, $who, "send_private", 1 ); $kernel->post( "core", "cmd", $who, $msg, $self->{ "ssid" }, $who, "send_private", 1 ); } -- 2.11.0