squelch useless "undefined" warnings

Normal users will never need this change but the big boys like to play
on the server side directly... and sometimes the SSH_CONNECTION var is
not set
This commit is contained in:
Sitaram Chamarty 2011-02-25 20:31:11 +05:30
parent cec94a3664
commit 46528f0cc7

View file

@ -119,7 +119,7 @@ sub log_it {
my ($ip, $logmsg);
open my $log_fh, ">>", $ENV{GL_LOG} or die "open log failed: $!\n";
# first space sep field is client ip, per "man ssh"
($ip = $ENV{SSH_CONNECTION}) =~ s/ .*//;
($ip = $ENV{SSH_CONNECTION} || '(no-IP)') =~ s/ .*//;
# the first part of logmsg is the actual command used; it's either passed
# in via arg1, or picked up from SSH_ORIGINAL_COMMAND
$logmsg = $_[0] || $ENV{SSH_ORIGINAL_COMMAND}; shift;