[ Avaa Bypassed ]




Upload:

Command:

www-data@18.188.66.142: ~ $
#!/usr/bin/perl
# save_share.cgi
# Save changes to a shared directory

require './dfs-lib.pl';
&error_setup($text{'save_err'});
use Socket;
&ReadParse();
@shlist = &list_shares();

if ($in{'delete'}) {
	# Redirect to deletion CGI
	&redirect("delete_share.cgi?idx=$in{'idx'}");
	exit;
	}

# check inputs
if ($in{directory} !~ /^\/.*/) {
	&error(&text('save_edirectory', $in{'directory'}));
	}
if (!(-d $in{directory})) {
	&error(&text('save_edirectory2', $in{'directory'}));
	}
@rolist = split(/\s+/, $in{rolist}); &check_hosts(@rolist);
@rwlist = split(/\s+/, $in{rwlist}); &check_hosts(@rwlist);
@rtlist = split(/\s+/, $in{rtlist}); &check_hosts(@rtlist);
if ($in{readwrite} == 2 && !@rwlist) {
	&error($text{'save_erw'});
	}
if ($in{readonly} == 2 && !@rolist) {
	&error($text{'save_ero'});
	}
if ($in{root} == 2 && !@rtlist) {
	&error($text{'save_eroot'});
	}

# Remove from the read-only list any hosts shared read-write as well
if ($in{readwrite} == 1) {
	$in{readonly} = 0;
	}
elsif ($in{readwrite} == 2) {
	foreach $rwh (@rwlist) {
		if (($idx = &indexof($rwh, @rolist)) != -1) {
			splice(@rolist, $idx, 1);
			}
		}
	if (@rolist == 0 && $in{readonly} == 2) {
		$in{readonly} = 0;
		}
	}

&lock_file($config{dfstab_file});
foreach $s (@shlist) {
	$taken = $s if ($s->{'dir'} eq $in{directory});
	}

if (defined($in{'idx'})) {
	$share = $shlist[$in{'idx'}];
	$olddir = $share->{'dir'};
	}
$share->{'dir'} = $in{'directory'};
$share->{'desc'} = $in{'desc'};
$share->{'type'} = 'nfs';

if (defined($in{'idx'})) {
	# Changing an existing share
	if ($taken && $taken->{'index'} != $in{'idx'}) {
		&error(&text('save_ealready', $in{'directory'}));
		}
	&parse_options($share->{'opts'});
	&set_options();
	$share->{'opts'} = &join_options();
	&modify_share($share);
	}
else {
	# Creating a new share
	if ($taken) {
		&error(&text('save_ealready', $in{'directory'}));
		}
	&set_options();
	$share->{'opts'} = &join_options();
	&create_share($share);
	}
&unlock_file($config{dfstab_file});
if (defined($in{'idx'})) {
	&webmin_log('modify', 'share', $olddir, \%in);
	}
else {
	&webmin_log('create', 'share', $share->{'dir'}, \%in);
	}
&redirect("");

# set_options()
# Fill in the options associative array
sub set_options
{
if ($in{readonly} == 0) { delete($options{"ro"}); }
elsif ($in{readonly} == 1) { $options{"ro"} = ""; }
elsif ($in{readonly} == 2) { $options{"ro"} = join(':', @rolist); }

if ($in{readwrite} == 0) { delete($options{"rw"}); }
elsif ($in{readwrite} == 1) { $options{"rw"} = ""; }
elsif ($in{readwrite} == 2) { $options{"rw"} = join(':', @rwlist); }

if ($in{root} == 0) { delete($options{"root"}); }
elsif ($in{root} == 2) { $options{"root"} = join(':', @rtlist); }

if (!$access{'simple'}) {
	if ($in{nosub}) { $options{"nosub"} = ""; }
	else { delete($options{"nosub"}); }

	if ($in{nosuid}) { $options{"nosuid"} = ""; }
	else { delete($options{"nosuid"}); }

	if ($in{secure}) { $options{"secure"} = ""; }
	else { delete($options{"secure"}); }

	if ($in{kerberos}) { $options{"kerberos"} = ""; }
	else { delete($options{"kerberos"}); }

	if ($in{'anon_m'} == 0) { delete($options{"anon"}); }
	elsif ($in{'anon_m'} == 1) { $options{"anon"} = -1; }
	else { $options{"anon"} = getpwnam($in{"anon"}); }

	if ($in{aclok}) { $options{"aclok"} = ""; }
	else { delete($options{"aclok"}); }

	if ($gconfig{'os_version'} >= 7) {
		if ($in{'public'}) { $options{'public'} = ""; }
		else { delete($options{'public'}); }
		if (!$in{'index_def'}) { $options{'index'} = $in{'index'}; }
		else { delete($options{'index'}); }
		}
	}
}

# check_hosts(host, host, ...)
# Die if any of the listed hosts does not exist
sub check_hosts
{
local $h;
if ($gconfig{'os_version'} < 7) {
	foreach $h (@_) {
		&to_ipaddress($h) || &to_ip6address($h) ||
			&error(&text('save_ehost', $h));
		}
	}
}



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