MINI SHELL

Server : Apache/2.2.2 (Fedora)
System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686
User : apache ( 48)
PHP Version : 5.2.9
Disable Function : NONE
Directory :  /proc/self/root/usr/libexec/webmin/frox/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/self/root/usr/libexec/webmin/frox/save_acl.cgi
#!/usr/bin/perl
# Save access control options

require './frox-lib.pl';
&ReadParse();
&error_setup($text{'acl_err'});
$conf = &get_config();

&save_opt_textbox($conf, "Timeout", \&check_timeout);
&save_opt_textbox($conf, "MaxForks", \&check_forks);
&save_opt_textbox($conf, "MaxForksPerHost", \&check_forks);
&save_opt_textbox($conf, "MaxTransferRate", \&check_rate);
&save_yesno($conf, "DoNTP");
&save_opt_textbox($conf, "NTPAddress", \&check_ntp);

for($i=0; defined($in{"action_$i"}); $i++) {
	next if (!$in{"action_$i"});
	local @val;
	push(@val, $in{"action_$i"});
	if ($in{"src_${i}_def"}) {
		push(@val, "*");
		}
	else {
		&valid_srcdest($in{"src_$i"}) ||
			&error(&text('acl_esrc', $i+1));
		push(@val, $in{"src_$i"});
		}
	push(@val, "-");
	if ($in{"dest_${i}_def"}) {
		push(@val, "*");
		}
	else {
		&valid_srcdest($in{"dest_$i"}) ||
			&error(&text('acl_edest', $i+1));
		push(@val, $in{"dest_$i"});
		}
	if (!$in{"ports_${i}_def"}) {
		foreach $p (split(/,/, $in{"ports_$i"})) {
			$p =~ /^\d+$/ || $p =~ /^\d+\-\d+$/ ||
				&error(&text('acl_eports', $i+1));
			}
		push(@val, $in{"ports_$i"});
		}
	push(@acl, join(" ", @val));
	}
@acl || &error($text{'acl_enone'});
&save_directive($conf, "ACL", \@acl);

&lock_file($config{'frox_conf'});
&flush_file_lines();
&unlock_file($config{'frox_conf'});
&webmin_log("acl");
&redirect("");

sub check_timeout
{
return $_[0] =~ /^\d+$/ ? undef : $text{'acl_etimeout'};
}

sub check_forks
{
return $_[0] =~ /^\d+$/ ? undef : $text{'acl_eforks'};
}

sub check_rate
{
return $_[0] =~ /^\d+$/ ? undef : $text{'acl_erate'};
}

sub check_ntp
{
return $_[0] =~ /^(\S+):(\d+)$/ && gethostbyname($1) ? undef
						     : $text{'acl_entp'};
}


sub valid_srcdest
{
return gethostbyname($_[0]) ||
	   ($_[0] =~ /^([0-9\.]+)\/(\d+)$/ &&
	    &check_ipaddress($1) && $2 > 0 && $2 <= 32) ||
	   ($_[0] =~ /^([0-9\.]+)\/([0-9\.]+)$/ &&
	    &check_ipaddress($1) && &check_ipaddress($2));
}


Anon7 - 2021