[ Avaa Bypassed ]




Upload:

Command:

www-data@160.79.109.87: ~ $
#!/usr/bin/perl
# Create, update or delete a target

use strict;
use warnings;
no warnings 'redefine';
no warnings 'uninitialized';
require './iscsi-target-lib.pl';
our (%text, %in, %config);
&ReadParse();
&error_setup($text{'target_err'});
&lock_file($config{'config_file'});
my $pconf = &get_iscsi_config_parent();
my $conf = $pconf->{'members'};

# Get the target
my $target;
if ($in{'new'}) {
	$target = { 'name' => 'Target',
		    'members' => [ ] };
	}
else {
	($target) = grep { $_->{'value'} eq $in{'oldname'} }
			 &find($conf, "Target");
	$target || &error($text{'target_egone'});
	}

if ($in{'delete'}) {
	# Delete the target
	&save_directive($conf, $pconf, [ $target ], [ ]);
	}
else {
	# Validate and save directives, starting with target name
	my $host;
	if ($in{'new'}) {
		$host = &find_host_name($conf) || &generate_host_name();
		}
	else {
		($host) = split(/:/, $target->{'value'});
		}
	$in{'name'} =~ /^[a-z0-9\.\_\-]+$/i || &error($text{'target_ename'});
	$target->{'value'} = $host.":".$in{'name'};

	# Validate logical units
	my @luns = &find_value($target->{'members'}, "Lun");
	my @newluns;
	my $lastlunid = 0;
	for(my $i=0; defined($in{"mode".$i}); $i++) {
		my ($lunid, $lunstr) = split(/\s+/, $luns[$i]);
		$lunid ||= ($lastlunid + 1);
		$lastlunid = $lunid;
		my %lunopts = map { split(/=/, $_) } split(/,/, $lunstr);

		# Clear variables that we will set below
		delete($lunopts{"Path"});
		delete($lunopts{"Type"});
		delete($lunopts{"Sectors"});

		if ($in{"mode".$i} eq "none") {
			# Nothing to do
			next;
			}
		elsif ($in{"mode".$i} eq "part") {
			# Regular partition
			$lunopts{"Path"} = $in{"part".$i};
			}
		elsif ($in{"mode".$i} eq "raid") {
			# RAID device
			$lunopts{"Path"} = $in{"raid".$i};
			}
		elsif ($in{"mode".$i} eq "lvm") {
			# LVM logical volume
			$lunopts{"Path"} = $in{"lvm".$i};
			}
		elsif ($in{"mode".$i} eq "other") {
			# Some other file
			$in{"other".$i} =~ /^\/\S+$/ && -r $in{"other".$i} ||
				&error(&text('target_eother', $i+1));
			$lunopts{"Path"} = $in{"other".$i};
			}
		elsif ($in{"mode".$i} eq "null") {
			# Null-IO device
			$lunopts{"Type"} = "nullio";
			$in{"null".$i} =~ /^\d+$/ && $in{"null".$i} > 0 ||
				&error(&text('target_esectors', $i+1));
			$lunopts{"Sectors"} = $in{"null".$i};
			}

		if ($in{"mode".$i} ne "null") {
			# Save IO mode
			$lunopts{"Type"} = $in{"type".$i};
			$lunopts{"IOMode"} = $in{"iomode".$i};
			}

		push(@newluns, $lunid." ".
			       join(",", map { $_."=".$lunopts{$_} }
					     grep { $lunopts{$_} ne "" }
						  (keys %lunopts)));
		}
	&save_directive($conf, $target, "Lun", \@newluns);

	# Validate incoming user(s)
	my @iusers;
	if (!$in{"iuser_def"}) {
		for(my $i=0; defined($in{"uname_$i"}); $i++) {
			next if (!$in{"uname_$i"});
			$in{"uname_$i"} =~ /^\S+$/ ||
				&error(&text('target_eiuser', $i+1));
			$in{"upass_$i"} =~ /^\S+$/ ||
				&error(&text('target_eipass', $i+1));
			push(@iusers, $in{"uname_$i"}." ".$in{"upass_$i"});
			}
		@iusers || &error($text{'target_eiusernone'});
		}
	&save_directive($conf, $target, "IncomingUser", \@iusers);

	# Validate outgoing user
	if ($in{"ouser_def"}) {
		&save_directive($conf, $target, "OutgoingUser", [ ]);
		}
	else {
		$in{"ouser"} =~ /^\S+$/ || &error($text{'target_eouser'});
		$in{"opass"} =~ /^\S+$/ || &error($text{'target_eopass'});
		&save_directive($conf, $target, "OutgoingUser",
			[ $in{"ouser"}." ".$in{"opass"} ]);
		}

	# Save alias
	if ($in{'alias_def'}) {
		&save_directive($conf, $target, "Alias", [ ]);
		}
	else {
		$in{'alias'} =~ /^[a-z0-9\.\_\-]+$/i ||
			&error($text{'target_ealias'});
		&save_directive($conf, $target, "Alias", [ $in{'alias'} ]);
		}

	# Save digest modes
	&save_directive($conf, $target, "HeaderDigest",
			$in{'hdigest'} ? [ $in{'hdigest'} ] : [ ]);
	&save_directive($conf, $target, "DataDigest",
			$in{'ddigest'} ? [ $in{'ddigest'} ] : [ ]);

	# Save the target
	&save_directive($conf, $pconf, $in{'new'} ? [ ] : [ $target ],
			[ $target ]);
	}

&flush_file_lines($config{'config_file'});
&unlock_file($config{'config_file'});
&webmin_log($in{'delete'} ? 'delete' : $in{'new'} ? 'create' : 'modify',
	    'target', $target->{'value'});
&redirect("");

Filemanager

Name Type Size Permission Actions
help Folder 0755
images Folder 0755
lang Folder 0755
atboot.cgi File 1.02 KB 0755
config File 211 B 0644
config-debian-linux File 231 B 0644
config-debian-linux-ALL-4.0 File 201 B 0644
config-openSUSE-Linux-15.0-ALL File 223 B 0644
config-suse-linux File 223 B 0644
config.info File 309 B 0644
config.info.ca File 393 B 0644
config.info.de File 333 B 0644
config.info.no File 302 B 0644
delete_allows.cgi File 764 B 0755
delete_targets.cgi File 874 B 0755
down_allow.cgi File 578 B 0755
edit_addr.cgi File 1003 B 0755
edit_allow.cgi File 1.55 KB 0755
edit_auth.cgi File 1.41 KB 0755
edit_conn.cgi File 1.42 KB 0755
edit_manual.cgi File 652 B 0755
edit_target.cgi File 5.68 KB 0755
edit_timeout.cgi File 903 B 0755
index.cgi File 3.44 KB 0755
install_check.pl File 348 B 0755
iscsi-target-lib.pl File 12.14 KB 0644
list_allow.cgi File 1.64 KB 0755
log_parser.pl File 484 B 0755
module.info File 205 B 0644
module.info.af File 0 B 0644
module.info.af.auto File 130 B 0644
module.info.ar File 0 B 0644
module.info.ar.auto File 159 B 0644
module.info.be File 0 B 0644
module.info.be.auto File 207 B 0644
module.info.bg File 0 B 0644
module.info.bg.auto File 184 B 0644
module.info.ca File 149 B 0644
module.info.cs File 0 B 0644
module.info.cs.auto File 120 B 0644
module.info.da File 0 B 0644
module.info.da.auto File 119 B 0644
module.info.de File 103 B 0644
module.info.el File 0 B 0644
module.info.el.auto File 221 B 0644
module.info.es File 0 B 0644
module.info.es.auto File 144 B 0644
module.info.eu File 0 B 0644
module.info.eu.auto File 114 B 0644
module.info.fa File 0 B 0644
module.info.fa.auto File 185 B 0644
module.info.fi File 0 B 0644
module.info.fi.auto File 116 B 0644
module.info.fr File 0 B 0644
module.info.fr.auto File 144 B 0644
module.info.he File 0 B 0644
module.info.he.auto File 147 B 0644
module.info.hr File 0 B 0644
module.info.hr.auto File 126 B 0644
module.info.hu File 0 B 0644
module.info.hu.auto File 153 B 0644
module.info.it File 0 B 0644
module.info.it.auto File 144 B 0644
module.info.ja File 0 B 0644
module.info.ja.auto File 181 B 0644
module.info.ko File 0 B 0644
module.info.ko.auto File 159 B 0644
module.info.lt File 0 B 0644
module.info.lt.auto File 134 B 0644
module.info.lv File 0 B 0644
module.info.lv.auto File 128 B 0644
module.info.ms File 131 B 0644
module.info.mt File 0 B 0644
module.info.mt.auto File 128 B 0644
module.info.nl File 0 B 0644
module.info.nl.auto File 130 B 0644
module.info.no File 19 B 0644
module.info.no.auto File 99 B 0644
module.info.pl File 0 B 0644
module.info.pl.auto File 135 B 0644
module.info.pt File 0 B 0644
module.info.pt.auto File 129 B 0644
module.info.pt_BR File 0 B 0644
module.info.pt_BR.auto File 135 B 0644
module.info.ro File 0 B 0644
module.info.ro.auto File 129 B 0644
module.info.ru File 0 B 0644
module.info.ru.auto File 219 B 0644
module.info.sk File 0 B 0644
module.info.sk.auto File 119 B 0644
module.info.sl File 0 B 0644
module.info.sl.auto File 111 B 0644
module.info.sv File 0 B 0644
module.info.sv.auto File 112 B 0644
module.info.th File 0 B 0644
module.info.th.auto File 260 B 0644
module.info.tr File 0 B 0644
module.info.tr.auto File 133 B 0644
module.info.uk File 0 B 0644
module.info.uk.auto File 188 B 0644
module.info.ur File 0 B 0644
module.info.ur.auto File 243 B 0644
module.info.vi File 0 B 0644
module.info.vi.auto File 134 B 0644
module.info.zh File 0 B 0644
module.info.zh.auto File 112 B 0644
module.info.zh_TW File 0 B 0644
module.info.zh_TW.auto File 112 B 0644
restart.cgi File 355 B 0755
save_addr.cgi File 943 B 0755
save_allow.cgi File 1.27 KB 0755
save_auth.cgi File 1.22 KB 0755
save_conn.cgi File 1.34 KB 0755
save_manual.cgi File 455 B 0755
save_target.cgi File 4.1 KB 0755
save_timeout.cgi File 862 B 0755
start.cgi File 332 B 0755
stop.cgi File 307 B 0755
up_allow.cgi File 576 B 0755