From 6745ad94128adc65342f372e896d7e15d84b4cf0 Mon Sep 17 00:00:00 2001 From: GeorgeClark Date: Thu, 29 Sep 2011 17:03:43 +0000 Subject: [PATCH] Item10637: Undefined variable errors Don't touch the IP address unless parameters are present. git-svn-id: http://svn.foswiki.org/trunk@12649 0b4bb1d4-4e5a-0410-9cc4-b2b747904278 --- .../Foswiki/Logger/PlainFile/Obfuscating.pm | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/core/lib/Foswiki/Logger/PlainFile/Obfuscating.pm b/core/lib/Foswiki/Logger/PlainFile/Obfuscating.pm index 4c2dd28de5..d9fba4a5fd 100644 --- a/core/lib/Foswiki/Logger/PlainFile/Obfuscating.pm +++ b/core/lib/Foswiki/Logger/PlainFile/Obfuscating.pm @@ -53,18 +53,20 @@ sub log { # print STDERR "field $field \n"; # } - unless ( $_[4] =~ /^AUTHENTICATION FAILURE/ ) { - - if ( $Foswiki::cfg{Log}{Obfuscating}{MaskIP} ) { - $_[5] = 'x.x.x.x'; - } - else { - my $md5hex = md5_hex( $_[5] ); - $_[5] = - hex( substr( $md5hex, 0, 2 ) ) . '.' - . hex( substr( $md5hex, 2, 2 ) ) . '.' - . hex( substr( $md5hex, 4, 2 ) ) . '.' - . hex( substr( $md5hex, 6, 2 ) ); + if ( @_ > 4 ) { + unless ( $_[4] =~ /^AUTHENTICATION FAILURE/ ) { + + if ( $Foswiki::cfg{Log}{Obfuscating}{MaskIP} ) { + $_[5] = 'x.x.x.x'; + } + else { + my $md5hex = md5_hex( $_[5] ); + $_[5] = + hex( substr( $md5hex, 0, 2 ) ) . '.' + . hex( substr( $md5hex, 2, 2 ) ) . '.' + . hex( substr( $md5hex, 4, 2 ) ) . '.' + . hex( substr( $md5hex, 6, 2 ) ); + } } }