From 35b711d03848ee3a30607e8f1476911d1984f1bd Mon Sep 17 00:00:00 2001 From: pdbogen Date: Tue, 2 Jun 2009 14:18:39 +0000 Subject: [PATCH] Pass the trusted bit along in the destination hash we give to commands, so that PARSE can pass it back when dereferencing aliases. Also, send high security notifications via a private reply, instead of publicly. git-svn-id: https://www.cernu.us/~pdbogen/svn/destult2@98 088b83a4-0077-4247-935c-42ec02c2848b --- commands.yaml | 2 +- core.pl | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/commands.yaml b/commands.yaml index 4d49136..0c30718 100644 --- a/commands.yaml +++ b/commands.yaml @@ -410,7 +410,7 @@ PARSE: |- $response = $responses[ int( rand( scalar( @responses ) ) ) ].$author; } elsif( $response =~ /(.+)/ ) { $response =~ s///; - $kernel->post( "core", "cmd", $who, "~+".$response, $src, $dest->{ 'dest' }, $replypath ); + $kernel->post( "core", "cmd", $who, "~+".$response, $src, $dest->{ 'dest' }, $replypath, $dest->{ 'trusted' } ); return; } else { my @responses = split( /\|/, $response ); diff --git a/core.pl b/core.pl index e3c6260..d96d6c0 100644 --- a/core.pl +++ b/core.pl @@ -155,9 +155,9 @@ sub cmd { !exists $heap->{ 'identified' }->{ $src.uc( $who ) } && $cmd !~ /identify|register|title/i ) { $kernel->post( $src, - $replypath, + "send_private", "$who: Destult is operating in high security mode; all use must be from identified users. Please REGISTER and then IDENTIFY.", - { dest=>$dest, src=>$who, no_throttle=>$no_throttle } + { dest=>$who, src=>$who, no_throttle=>$no_throttle, trusted => $trusted } ); return; } @@ -168,21 +168,21 @@ sub cmd { $kernel->post( $src, $replypath, "$who: Use of access-controled commands is not allowed from untrusted sources.", - { dest=>$dest, src=>$who, no_throttle=>$no_throttle } + { dest=>$dest, src=>$who, no_throttle=>$no_throttle, trusted => $trusted } ); return; } if( !exists $heap->{ 'cmdaccess' }->{ uc( $cmd ) } || ( exists $heap->{ 'identified' }->{ $src.uc( $who ) } && accessLevel( $kernel, $heap, uc( $who ), $src ) >= $heap->{ 'cmdaccess' }->{ uc( $cmd ) } ) ) { - &{ $heap->{ 'commands' }->{ uc( $cmd ) } }( $kernel, $heap, $who, $subj, $src, { dest => $dest, src=>$who, no_throttle => $no_throttle }, $replypath ); + &{ $heap->{ 'commands' }->{ uc( $cmd ) } }( $kernel, $heap, $who, $subj, $src, { dest => $dest, src=>$who, no_throttle => $no_throttle, trusted => $trusted }, $replypath ); } else { - $kernel->post( $src, $replypath, "$who: An access level of ".$heap->{ 'cmdaccess' }->{ uc( $cmd ) }." is required for '$cmd'", { dest=>$dest, src=>$who, no_throttle=>$no_throttle } ); + $kernel->post( $src, $replypath, "$who: An access level of ".$heap->{ 'cmdaccess' }->{ uc( $cmd ) }." is required for '$cmd'", { dest=>$dest, src=>$who, no_throttle=>$no_throttle, trusted => $trusted } ); } } elsif( exists( $heap->{ 'db' }->{ uc( $what ) } ) && !$noparse ) { - &{ $heap->{ 'commands' }->{ 'PARSE' } }( $kernel, $heap, $who, $what, $src, { dest => $dest, src=>$who, no_throttle => $no_throttle }, $replypath ); + &{ $heap->{ 'commands' }->{ 'PARSE' } }( $kernel, $heap, $who, $what, $src, { dest => $dest, src=>$who, no_throttle => $no_throttle, trusted => $trusted }, $replypath ); } else { - $kernel->post( $src, "send_private", "Huh?", { dest => $who, src => $who } ); + $kernel->post( $src, "send_private", "Huh?", { dest => $who, src => $who, trusted => $trusted } ); } } -- 2.11.0