mirror of
https://github.com/moparisthebest/curl
synced 2024-12-22 08:08:50 -05:00
Allow setting the IP address on which to listen for connections.
This commit is contained in:
parent
551abba277
commit
0ed57d370d
@ -82,6 +82,7 @@ my $ipv6;
|
|||||||
my $ext; # append to log/pid file names
|
my $ext; # append to log/pid file names
|
||||||
my $grok_eprt;
|
my $grok_eprt;
|
||||||
my $port = 8921; # just a default
|
my $port = 8921; # just a default
|
||||||
|
my $listenaddr = "127.0.0.1"; # just a default
|
||||||
my $pidfile = ".ftpd.pid"; # a default, use --pidfile
|
my $pidfile = ".ftpd.pid"; # a default, use --pidfile
|
||||||
|
|
||||||
do {
|
do {
|
||||||
@ -109,6 +110,10 @@ do {
|
|||||||
$port = $ARGV[1];
|
$port = $ARGV[1];
|
||||||
shift @ARGV;
|
shift @ARGV;
|
||||||
}
|
}
|
||||||
|
elsif($ARGV[0] eq "--addr") {
|
||||||
|
$listenaddr = $ARGV[1];
|
||||||
|
shift @ARGV;
|
||||||
|
}
|
||||||
} while(shift @ARGV);
|
} while(shift @ARGV);
|
||||||
|
|
||||||
sub catch_zap {
|
sub catch_zap {
|
||||||
@ -569,7 +574,8 @@ sub PASV_command {
|
|||||||
|
|
||||||
if($cmd ne "EPSV") {
|
if($cmd ne "EPSV") {
|
||||||
# PASV reply
|
# PASV reply
|
||||||
my $p="127,0,0,1";
|
my $p=$listenaddr;
|
||||||
|
$p =~ s/\./,/g;
|
||||||
if($pasvbadip) {
|
if($pasvbadip) {
|
||||||
$p="1,2,3,4";
|
$p="1,2,3,4";
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ use File::Spec;
|
|||||||
my $verbose=0; # set to 1 for debugging
|
my $verbose=0; # set to 1 for debugging
|
||||||
|
|
||||||
my $port = 8999; # just our default, weird enough
|
my $port = 8999; # just our default, weird enough
|
||||||
|
my $listenaddr = "127.0.0.1"; # address on which to listen
|
||||||
|
|
||||||
my $path = `pwd`;
|
my $path = `pwd`;
|
||||||
chomp $path;
|
chomp $path;
|
||||||
@ -51,6 +52,10 @@ do {
|
|||||||
$username=$ARGV[1];
|
$username=$ARGV[1];
|
||||||
shift @ARGV;
|
shift @ARGV;
|
||||||
}
|
}
|
||||||
|
elsif($ARGV[0] eq "-l") {
|
||||||
|
$listenaddr=$ARGV[1];
|
||||||
|
shift @ARGV;
|
||||||
|
}
|
||||||
elsif($ARGV[0] =~ /^(\d+)$/) {
|
elsif($ARGV[0] =~ /^(\d+)$/) {
|
||||||
$port = $1;
|
$port = $1;
|
||||||
}
|
}
|
||||||
@ -160,7 +165,7 @@ AuthorizedKeysFile $path/curl_client_key.pub
|
|||||||
HostKey $path/curl_host_dsa_key
|
HostKey $path/curl_host_dsa_key
|
||||||
PidFile $path/.ssh.pid
|
PidFile $path/.ssh.pid
|
||||||
Port $port
|
Port $port
|
||||||
ListenAddress localhost
|
ListenAddress $listenaddr
|
||||||
Protocol 2
|
Protocol 2
|
||||||
AllowTcpForwarding yes
|
AllowTcpForwarding yes
|
||||||
GatewayPorts no
|
GatewayPorts no
|
||||||
@ -210,7 +215,7 @@ my @dsahostkey = do { local $/ = ' '; <DSAKEYFILE> };
|
|||||||
close DSAKEYFILE || die "Could not close DSAKEYFILE";
|
close DSAKEYFILE || die "Could not close DSAKEYFILE";
|
||||||
|
|
||||||
open(KNOWNHOSTS, ">$knownhostsfile") || die "Could not write $knownhostsfile";
|
open(KNOWNHOSTS, ">$knownhostsfile") || die "Could not write $knownhostsfile";
|
||||||
print KNOWNHOSTS "[127.0.0.1]:$port ssh-dss $dsahostkey[1]\n" || die 'Could not write to KNOWNHOSTS';
|
print KNOWNHOSTS "[$listenaddr]:$port ssh-dss $dsahostkey[1]\n" || die 'Could not write to KNOWNHOSTS';
|
||||||
close KNOWNHOSTS || die "Could not close KNOWNHOSTS";
|
close KNOWNHOSTS || die "Could not close KNOWNHOSTS";
|
||||||
|
|
||||||
open(SSHFILE, ">$conffile_ssh") || die "Could not write $conffile_ssh";
|
open(SSHFILE, ">$conffile_ssh") || die "Could not write $conffile_ssh";
|
||||||
|
Loading…
Reference in New Issue
Block a user