[ Avaa Bypassed ]




Upload:

Command:

www-data@18.188.66.142: ~ $
# dfs-lib.pl
# Common functions for managing dfstab files

BEGIN { push(@INC, ".."); };
use WebminCore;
&init_config();
%access = &get_module_acl();

$default_type = 'nfs';
if ($config{'fstypes_file'} && open(TYPES, "<".$config{'fstypes_file'})) {
	if (<TYPES> =~ /^(\S+)/) {
		$default_type = $1;
		}
	close(TYPES);
	}
%access = &get_module_acl();

# list_shares()
# Returns a list of structures containing share details
sub list_shares
{
local $lnum = 0;
local @rv;
open(DFS, "<".$config{'dfstab_file'});
while(<DFS>) {
	s/\r|\n//g; s/#.*$//;
	if (/^\s*\S*share\s+(.*)/) {
		# Found a share line
		local $share = { 'line' => $lnum,
				 'index' => scalar(@rv) };
		local $line = $1;
		while($line =~ /\\$/) {
			$_ = <DFS>;
			s/\r|\n//g; s/#.*$//;
			$line =~ s/\\$//;
			$line .= $_;
			$lnum++;
			}
		$share->{'eline'} = $lnum;
		if ($line =~ /\s(\/\S+)/) {
			$share->{'dir'} = $1;
			}
		if ($line =~ /-d\s+"([^"]+)"/) { $share->{'desc'} = $1; }
		elsif ($line =~ /-d\s+(\S+)/) { $share->{'desc'} = $1; }
		if ($line =~ /-o\s+"([^"]+)"/) { $share->{'opts'} = $1; }
		elsif ($line =~ /-o\s+(\S+)/) { $share->{'opts'} = $1; }
		if ($line =~ /\s-F\s+(\S+)/) { $share->{'type'} = $1; }
		else { $share->{'type'} = $default_type; }
		push(@rv, $share);
		}
	$lnum++;
	}
close(DFS);
return @rv;
}

# create_share(&share)
# Add a new share to the dfstab file
sub create_share
{
&open_tempfile(DFS, ">> $config{dfstab_file}");
&print_tempfile(DFS, &share_line($_[0]),"\n");
&close_tempfile(DFS);
}

# modify_share(&share)
# Modify an existing share
sub modify_share
{
local $lref = &read_file_lines($config{'dfstab_file'});
splice(@$lref, $_[0]->{'line'}, $_[0]->{'eline'} - $_[0]->{'line'} + 1,
       &share_line($_[0]));
&flush_file_lines();
}

# share_line(&share)
sub share_line
{
local $s = "share";
$s .= " -d \"$_[0]->{'desc'}\"" if ($_[0]->{'desc'});
$s .= " -o $_[0]->{'opts'}" if ($_[0]->{'opts'});
$s .= " -F $_[0]->{'type'}" if ($_[0]->{'type'} &&
				$_[0]->{'type'} ne $default_type);
$s .= " $_[0]->{'dir'}";
return $s;
}

# delete_share(&share)
# Delete the share for a particular directory
sub delete_share
{
local $lref = &read_file_lines($config{'dfstab_file'});
splice(@$lref, $_[0]->{'line'}, $_[0]->{'eline'} - $_[0]->{'line'} + 1);
&flush_file_lines();
}

# parse_options(string)
# Parse a mount options string like rw=foo,nosuid,... into the associative
# array %options. Parts with no value are given an empty string as the value
sub parse_options
{
local($opt);
undef(%options);
foreach $opt (split(/,/, $_[0])) {
	if ($opt =~ /^([^=]+)=(.*)$/) {
		$options{$1} = $2;
		}
	else {
		$options{$opt} = "";
		}
	}
return \%options;
}

# join_options([&options])
# Returns a list of options from the %options array, in the form used in
# the dfstab file
sub join_options
{
local $o = $_[0] ? $_[0] : \%options;
local(@list, $k);
foreach $k (keys %$o) {
	if ($o->{$k} eq "") {
		push(@list, $k);
		}
	else {
		push(@list, "$k=$o->{$k}");
		}
	}
return join(',', @list);
}

# apply_configuration()
# Apply the NFS configuration, returning undef on success or an error message
# on failure
sub apply_configuration
{
local $temp = &transname();
&system_logged("$config{unshare_all_command} >/dev/null 2>&1");
&system_logged("$config{share_all_command} >/dev/null 2>$temp");
local $why = `/bin/cat $temp`;
unlink($temp);
if ($why =~ /\S+/) {
	return $why;
	}
return undef;
}

1;


Filemanager

Name Type Size Permission Actions
help Folder 0755
images Folder 0755
lang Folder 0755
CHANGELOG File 196 B 0644
acl_security.pl File 468 B 0755
backup_config.pl File 602 B 0755
config-openserver File 123 B 0644
config-solaris File 153 B 0644
config-unixware File 123 B 0644
config.info File 211 B 0644
config.info.ca File 267 B 0644
config.info.de File 232 B 0644
config.info.es File 247 B 0644
config.info.fr File 161 B 0644
config.info.hu File 209 B 0644
config.info.nl File 215 B 0644
config.info.pl File 234 B 0644
config.info.sv File 165 B 0644
config.info.tr File 141 B 0644
config.info.zh File 125 B 0644
config.info.zh_TW File 167 B 0644
defaultacl File 7 B 0644
delete_share.cgi File 354 B 0755
delete_shares.cgi File 481 B 0755
dfs-lib.pl File 3.32 KB 0755
edit_share.cgi File 4.14 KB 0755
index.cgi File 2.76 KB 0755
log_parser.pl File 882 B 0755
module.info File 193 B 0644
module.info.af File 0 B 0644
module.info.af.auto File 113 B 0644
module.info.ar File 0 B 0644
module.info.ar.auto File 139 B 0644
module.info.be File 0 B 0644
module.info.be.auto File 159 B 0644
module.info.bg File 0 B 0644
module.info.bg.auto File 190 B 0644
module.info.ca File 0 B 0644
module.info.ca.auto File 131 B 0644
module.info.cs File 0 B 0644
module.info.cs.auto File 115 B 0644
module.info.da File 0 B 0644
module.info.da.auto File 107 B 0644
module.info.de File 0 B 0644
module.info.de.auto File 112 B 0644
module.info.el File 0 B 0644
module.info.el.auto File 191 B 0644
module.info.es File 0 B 0644
module.info.es.auto File 119 B 0644
module.info.eu File 0 B 0644
module.info.eu.auto File 128 B 0644
module.info.fa File 0 B 0644
module.info.fa.auto File 143 B 0644
module.info.fi File 0 B 0644
module.info.fi.auto File 103 B 0644
module.info.fr File 0 B 0644
module.info.fr.auto File 131 B 0644
module.info.he File 0 B 0644
module.info.he.auto File 131 B 0644
module.info.hr File 0 B 0644
module.info.hr.auto File 130 B 0644
module.info.hu File 0 B 0644
module.info.hu.auto File 141 B 0644
module.info.it File 0 B 0644
module.info.it.auto File 121 B 0644
module.info.ja File 0 B 0644
module.info.ja.auto File 139 B 0644
module.info.ko File 0 B 0644
module.info.ko.auto File 128 B 0644
module.info.lt File 0 B 0644
module.info.lt.auto File 114 B 0644
module.info.lv File 0 B 0644
module.info.lv.auto File 120 B 0644
module.info.ms File 0 B 0644
module.info.ms.auto File 115 B 0644
module.info.mt File 0 B 0644
module.info.mt.auto File 109 B 0644
module.info.nl File 0 B 0644
module.info.nl.auto File 123 B 0644
module.info.no File 0 B 0644
module.info.no.auto File 111 B 0644
module.info.pl File 0 B 0644
module.info.pl.auto File 117 B 0644
module.info.pt File 0 B 0644
module.info.pt.auto File 134 B 0644
module.info.pt_BR File 0 B 0644
module.info.pt_BR.auto File 143 B 0644
module.info.ro File 0 B 0644
module.info.ro.auto File 136 B 0644
module.info.ru File 0 B 0644
module.info.ru.auto File 152 B 0644
module.info.sk File 0 B 0644
module.info.sk.auto File 120 B 0644
module.info.sl File 0 B 0644
module.info.sl.auto File 130 B 0644
module.info.sv File 0 B 0644
module.info.sv.auto File 107 B 0644
module.info.th File 0 B 0644
module.info.th.auto File 198 B 0644
module.info.tr File 0 B 0644
module.info.tr.auto File 149 B 0644
module.info.uk File 0 B 0644
module.info.uk.auto File 153 B 0644
module.info.ur File 0 B 0644
module.info.ur.auto File 190 B 0644
module.info.vi File 0 B 0644
module.info.vi.auto File 142 B 0644
module.info.zh File 0 B 0644
module.info.zh.auto File 113 B 0644
module.info.zh_TW File 0 B 0644
module.info.zh_TW.auto File 122 B 0644
rbac-mapping File 115 B 0644
restart_sharing.cgi File 302 B 0755
save_share.cgi File 3.71 KB 0755