📄 save_net.cgi
字号:
#!/usr/local/bin/perl# save_net.cgi# Save inputs from conf_net.cgirequire './samba-lib.pl';$whatfailed = "Failed to save options";&ReadParse();$global = &get_share("global");if (!$in{dead_time_def} && $in{dead_time} !~ /^\d+$/) { &error("'$in{dead_time}' is not a valid disconnect timeout"); }&setval("dead time", $in{dead_time_def} ? 0 : $in{dead_time}, 0);&setval("hosts equiv", $in{hosts_equiv_def} ? "" : $in{hosts_equiv}, "");if ($in{interfaces_def}) { &delval("interfaces"); }else { for($i=0; defined($in{"interface_ip$i"}); $i++) { if ($in{"interface_ip$i"} !~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/) { next; } @ip = ($1, $2, $3, $4); if ($in{"interface_nm$i"} !~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/) { next; } @nm = ($1, $2, $3, $4); foreach $j (@ip, @nm) { if ($j < 0 || $j > 255) { &error("'$j' is not a valid IP byte"); } } push(@ifaces, join('.',@ip)."/".join('.',@nm)); } &setval("interfaces", join(' ', @ifaces), ""); }if (!$in{keepalive_def} && $in{keepalive} !~ /^\d+$/) { &error("'$in{keepalive}' is not a valid keepalive interval"); }&setval("keepalive", $in{keepalive_def} ? 0 : $in{keepalive}, 0);if (!$in{max_xmit_def} && $in{max_xmit} !~ /^\d+$/) { &error("'$in{max_xmit}' is not a valid maxiumum packet size"); }&setval("max xmit", $in{max_xmit_def} ? 0 : $in{max_xmit}, 0);&setval("socket address", $in{socket_address_def} ? "" : $in{socket_address}, "");foreach (@sock_opts) { /^([A-Z\_]+)(.*)$/; if ($2 eq "*") { if ($in{$1}) { push(@sopts, "$1=".$in{"$1_val"}); } } else { if ($in{$1}) { push(@sopts, $1); } } }&setval("socket options", join(' ',@sopts), "");if ($global) { &modify_share("global", "global"); }else { &create_share("global"); }&redirect("");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -