!C99Shell v. 1.0 pre-release build #16!

Software: Apache/2.0.54 (Fedora). PHP/5.0.4 

uname -a: Linux mina-info.me 2.6.17-1.2142_FC4smp #1 SMP Tue Jul 11 22:57:02 EDT 2006 i686 

uid=48(apache) gid=48(apache) groups=48(apache)
context=system_u:system_r:httpd_sys_script_t
 

Safe-mode: OFF (not secure)

/usr/libexec/webmin/iscsi-tgtd/   drwxr-xr-x
Free 3.79 GB of 27.03 GB (14.03%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     save_target.cgi (4.42 KB)      -rwxr-xr-x
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
#!/usr/bin/perl
# Create, update or delete a target

use strict;
use warnings;
require './iscsi-tgtd-lib.pl';
our (%text, %in, %config);
&ReadParse();
&error_setup($text{'target_err'});
my $conf = &get_tgtd_config();

# Get the target
my $target;
my $addfile;
if ($in{'new'}) {
    $target = { 'name' => 'target',
            'type' => 1,
            'members' => [ ] };
    if (-d $config{'add_file'}) {
        $addfile = $config{'add_file'}."/".$in{'name'}.".conf";
        }
    elsif ($config{'add_file'}) {
        $addfile = $config{'add_file'};
        }
    }
else {
    ($target) = grep { $_->{'value'} eq $in{'oldname'} }
             &find($conf, "Target");
    $target || &error($text{'target_egone'});
    }
my $lockfile = $target->{'file'} || $addfile;
&lock_file($lockfile);

if ($in{'delete'}) {
    # Delete the target
    &save_directive($conf, $target, undef);
    &delete_if_empty($target->{'file'});
    }
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($target->{'members'}, "backing-store"),
            &find($target->{'members'}, "direct-store"));
    @luns = sort { $a->{'file'} <=> $b->{'file'} } @luns;
    my (@backluns, @directluns);
    for(my $i=0; defined($in{"mode".$i}); $i++) {
        my $path;
        if ($in{"mode".$i} eq "none") {
            # Nothing to do
            next;
            }
        elsif ($in{"mode".$i} eq "part") {
            # Regular partition
            $path = $in{"part".$i};
            }
        elsif ($in{"mode".$i} eq "raid") {
            # RAID device
            $path = $in{"raid".$i};
            }
        elsif ($in{"mode".$i} eq "lvm") {
            # LVM logical volume
            $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));
            $path = $in{"other".$i};
            }
        my $newlun = $i >= @luns ? { } : $luns[$i];
        $newlun->{'name'} = $in{"type".$i};
        $newlun->{'value'} = $path;
        my $cache = $in{"cache".$i} ? { 'name' => 'write-cache',
                        'value' => $in{"cache".$i} }
                        : undef;
        &save_directive($conf, "write-cache", $cache, $newlun);
        if ($newlun->{'name'} eq "backing-store") {
            push(@backluns, $newlun);
            }
        else {
            push(@directluns, $newlun);
            }
        }
    &save_multiple_directives($conf, "backing-store", \@backluns, $target);
    &save_multiple_directives($conf, "direct-store", \@directluns,$target);

    # 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,
                { 'name' => 'incominguser',
                  'value' => $in{"uname_$i"}." ".$in{"upass_$i"} });
            }
        @iusers || &error($text{'target_eiusernone'});
        }
    &save_multiple_directives($conf, "incominguser", \@iusers, $target);

    # Validate outgoing user(s)
    if (!$in{"ouser_def"}) {
                $in{"ouser"} =~ /^\S+$/ || &error($text{'target_eouser'});
                $in{"opass"} =~ /^\S+$/ || &error($text{'target_eopass'});
        my $ouser = { 'name' => "outgoinguser",
                  'value' => $in{"ouser"}." ".$in{"opass"} };
        &save_directive($conf, "outgoinguser", $ouser, $target);
        }
    else {
        &save_directive($conf, "outgoinguser", undef, $target);
        }

    # Save allowed IPs
    my @addrs;
    if (!$in{"iaddress_def"}) {
        foreach my $a (split(/\s+/, $in{"iaddress"})) {
            &check_ipaddress($a) || &error($text{'target_eaddr'});
            push(@addrs, { 'name' => "initiator-address",
                       'value' => $a });
            }
        }
    &save_multiple_directives($conf, "initiator-address", \@addrs, $target);

    # Save allowed initiators
    my @names;
    if (!$in{"iname_def"}) {
        foreach my $a (split(/\s+/, $in{"iname"})) {
            $a =~ /^[:a-z0-9\.\_\-]+$/i ||
                &error($text{'target_eaname'});
            push(@names, { 'name' => "initiator-name",
                       'value' => $a });
            }
        }
    &save_multiple_directives($conf, "initiator-name", \@names, $target);

    # Save the target
    if ($in{'new'}) {
        &save_directive($conf, undef, $target, undef, $addfile);
        }
    else {
        &save_directive($conf, $target, $target);
        }
    }

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

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 1.0 pre-release build #16 powered by Captain Crunch Security Team | http://ccteam.ru | Generation time: 0.0033 ]--