From 539dc12fbd0f0bcc794f4ef31416295fbbc42c8d Mon Sep 17 00:00:00 2001 From: pdbogen Date: Wed, 17 Feb 2010 14:55:13 +0000 Subject: [PATCH] When identifying as another user, track *that* username in the identified array and check its access level, instead of checking the current nick's access level. git-svn-id: https://www.cernu.us/~pdbogen/svn/destult2@108 088b83a4-0077-4247-935c-42ec02c2848b --- commands.yaml | 4 ++-- core.pl | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/commands.yaml b/commands.yaml index f04ecdd..68cbf15 100644 --- a/commands.yaml +++ b/commands.yaml @@ -235,7 +235,7 @@ IDENTIFY: |- if( exists( $heap->{ 'users' }->{ uc( $whom ) } ) ) { if( $heap->{ 'users' }->{ uc( $whom ) } eq md5_hex( $password ) ) { - $heap->{ 'identified' }->{ $src.uc( $who ) } = 1; + $heap->{ 'identified' }->{ $src.uc( $who ) } = uc( $whom ); $kernel->post( $src, $replypath, "Hello, $who.", $dest ); } else { $kernel->post( $src, $replypath, "Authentication failed.", $dest ); @@ -411,7 +411,7 @@ PARSE: |- if( exists( $heap->{ 'factoidAccess' }->{ uc( $factoid ) } ) && ( !exists( $heap->{ 'identified' }->{ $src.uc( $who ) } ) || - accessLevel( $kernel, $heap, uc( $who ), $src ) < $heap->{ 'factoidAccess' }->{ uc( $factoid ) } ) ) { + accessLevel( $kernel, $heap, $heap->{ 'identified' }->{ $src.uc( $who ) }, $src ) < $heap->{ 'factoidAccess' }->{ uc( $factoid ) } ) ) { $kernel->post( $src, $replypath, "$who: An access level of ".$heap->{ 'factoidAccess' }->{ uc( $factoid ) }." is required for the factoid '$factoid'", $dest ); return; } diff --git a/core.pl b/core.pl index 36f4004..8fa1fa6 100644 --- a/core.pl +++ b/core.pl @@ -42,7 +42,7 @@ sub seen { if( exists( $heap->{ 'memo' } ) && exists( $heap->{ 'memo' }->{ uc( $who ) } ) ) { if( exists( $heap->{ 'identified' }->{ $src.uc( $who ) } ) ) { - $kernel->yield( "cmd", $who, "CHECKMEMO", $src, $who, "send_private", $trusted ); + $kernel->yield( "cmd", $who, "CHECKMEMO", $src, $heap->{ 'identified' }->{ $src.uc( $who ) }, "send_private", $trusted ); } else { $kernel->yield( "cmd", $who, "COUNTMEMO", $src, $who, "send_private", $trusted ); } @@ -180,7 +180,7 @@ sub cmd { } if( !exists $heap->{ 'cmdaccess' }->{ uc( $cmd ) } || ( exists $heap->{ 'identified' }->{ $src.uc( $who ) } && - accessLevel( $kernel, $heap, uc( $who ), $src ) >= $heap->{ 'cmdaccess' }->{ uc( $cmd ) } ) ) { + accessLevel( $kernel, $heap, $heap->{ 'identified' }->{ $src.uc( $who ) }, $src ) >= $heap->{ 'cmdaccess' }->{ uc( $cmd ) } ) ) { &{ $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, trusted => $trusted } ); -- 2.11.0