mirror of
https://github.com/webmin/webmin.git
synced 2026-02-03 14:13:29 +00:00
If not binding to an IP, add a Listen directive for a custom port if needed https://github.com/webmin/webmin/issues/2341
This commit is contained in:
@@ -131,7 +131,7 @@ close(FILE);
|
||||
foreach $a (@addrs) {
|
||||
local $ip = &to_ipaddress($a);
|
||||
if ($in{'listen'} && $ip) {
|
||||
# add Listen if needed
|
||||
# add Listen on the IP if needed
|
||||
local @listen = &find_directive("Listen", $conf);
|
||||
local $lfound;
|
||||
foreach $l (@listen) {
|
||||
@@ -189,6 +189,22 @@ foreach $a (@addrs) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($in{'listen'} && $addr eq "*" && $portnum ne "*") {
|
||||
# Add Listen on the port if needed
|
||||
local @listen = &find_directive("Listen", $conf);
|
||||
local $lfound;
|
||||
foreach $l (@listen) {
|
||||
$lfound++ if ($l eq '*' && $portnum == $defport ||
|
||||
&check_ipaddress($l) && $portnum == $defport ||
|
||||
$l =~ /:(\d+)$/ && $portnum == $1 ||
|
||||
$l =~ /^\d+$/ && $portnum == $l);
|
||||
}
|
||||
if (!$lfound && @listen > 0) {
|
||||
# Apache is not listening on the port for all IPs
|
||||
&save_directive("Listen", [ @listen, $portnum ], $conf, $conf);
|
||||
}
|
||||
}
|
||||
|
||||
# Create the structure
|
||||
if (@addrs) {
|
||||
$ap = join(" ", map { $_.$port } @addrs);
|
||||
|
||||
Reference in New Issue
Block a user