File: 0001_set-default-values-for-ssh-connection.patch

package info (click to toggle)
libnet-sftp-sftpserver-perl 1.1.0-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 492 kB
  • sloc: perl: 1,929; makefile: 10; sh: 2
file content (19 lines) | stat: -rw-r--r-- 758 bytes parent folder | download | duplicates (5)
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";
 }