From 00ad847b90aac60226094e06dbbc60dad4a19999 Mon Sep 17 00:00:00 2001 From: Xavier Guimard Date: Tue, 15 Oct 2013 12:47:30 +0000 Subject: [PATCH] ip() compatibility with Apache-1.3 --- .../lib/Lemonldap/NG/Handler/Simple.pm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Simple.pm b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Simple.pm index da773e929..27636b26a 100644 --- a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Simple.pm +++ b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Simple.pm @@ -250,12 +250,7 @@ sub lmSetApacheUser { # @return string sub regRemoteIp { my ( $class, $str ) = splice @_; - if ( MP() == 2 ) { - $str =~ s/\$datas->\{ip\}/\$apacheRequest->connection->remote_ip/g; - } - else { - $str =~ s/\$datas->\{ip\}/\$apacheRequest->remote_ip/g; - } + $str =~ s/\$datas->\{ip\}/ip()/g; return $str; } @@ -922,7 +917,12 @@ sub retrieveSession { sub ip { my $ip = 'unknownIP'; - eval { $ip = $apacheRequest->connection->remote_ip }; + eval { + $ip = + ( MP() == 2 ) + ? $apacheRequest->connection->remote_ip + : $apacheRequest->remote_ip; + }; return $ip; }