1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
Description: Let log initialization succeed during unit tests
Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
--- a/lib/Net/SFTP/SftpServer.pm
+++ b/lib/Net/SFTP/SftpServer.pm
@@ -298,7 +298,13 @@
sub initLog {
my $syslog = shift;
openlog( 'sftp', 'pid', $syslog);
- my ($remote_ip, $remote_port, $local_ip, $local_port) = split(' ', $ENV{SSH_CONNECTION});
+ my $remote_ip = 'REMOTE_IP_NOT_SET';
+ my $remote_port = "0";
+ my $local_ip = 'LOCAL_IP_NOT_SET';
+ my $local_port = "0";
+ if ( $ENV{SSH_CONNECTION} ) {
+ ($remote_ip, $remote_port, $local_ip, $local_port) = split(' ', $ENV{SSH_CONNECTION});
+ }
logGeneral "Client connected from $remote_ip:$remote_port";
logDetail "Client connected to $local_ip:$local_port";
}
|