save_nat.cgi

来自「linux环境下的一个防火墙程序的源代码」· CGI 代码 · 共 41 行

CGI
41
字号
#!/usr/bin/perl#======================================================================# Turtle Firewall webmin module## Copyright (c) Andrea Frigido# You may distribute under the terms of either the GNU General Public# License#======================================================================do 'lib.pl';my $idx = $in{'idx'};my $virtual = $in{'virtual'};my $real = $in{'real'};my ($service, $port) = formServiceParse( $in{'servicetype'}, $in{'service2'}, $in{'service3'}, $in{'port'} );my $active = $in{'active'};# Cut interface$virtual =~ s/ \(.*\)$//;if( $in{'delete'} ) {	# delete NAT	$whatfailed = $text{save_nat_error_title1};	$fw->DeleteNat( $idx );} else {	$whatfailed = $in{'new'} ? $text{save_nat_error_title2} : $text{save_nat_error_title3};	if( $real eq '' ) {		error( $text{save_nat_error1} );	}	if( $in{'new'} ) {		$fw->AddNat( 0, $virtual, $real, $service, $port, $active );	} else {		$fw->AddNat( $idx, $virtual, $real, $service, $port, $active );	}}$fw->SaveFirewall();redirect( 'list_nat.cgi' );

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?