[ Avaa Bypassed ]




Upload:

Command:

www-data@18.216.248.35: ~ $
#!/usr/bin/perl
# mass_delete_user.cgi
# Delete multiple users, after asking for confirmation

require './ldap-useradmin-lib.pl';
&ReadParse();
$ldap = &ldap_connect();
%ulist = map { $_->{'user'}, $_ } &list_users();
&error_setup($text{'umass_err'});
foreach $name (split(/\0/, $in{'d'})) {
	$user = $ulist{$name};
	if ($user) {
		&can_edit_user($user) ||
			&error(&text('umass_euser', $name));
		push(@dlist, $user);
		$delete_sys = $user if ($user->{'uid'} < 10 &&
		    (!$delete_sys || $user->{'uid'} < $delete_sys->{'uid'}));
		}
	}
@dlist || &error($text{'umass_enone'});

if ($in{'disable'}) {
	# Disabling a bunch of users
	&ui_print_unbuffered_header(undef, $text{'dmass_title'}, "");

	if ($in{'confirmed'}) {
		foreach $user (@dlist) {
			# Show username
			print "<b>",&text('dmass_doing', $user->{'user'}),"</b><br>\n";
			print "<ul>\n";

			# Run the before command
			local @secs;
			foreach $g (&list_groups()) {
				@mems = split(/,/, $g->{'members'});
				if (&indexof($user->{'user'}, @mems) >= 0) {
					push(@secs, $g->{'gid'});
					}
				}
			&set_user_envs($user, 'MODIFY_USER', undef, \@secs);
			$merr = &making_changes();
			&error(&text('usave_emaking', "<tt>$merr</tt>"))
				if (defined($merr));

			# Do it
			&lock_user_files();
			print "$text{'dmass_pass'}<br>\n";
			if ($user->{'pass'} !~ /^$useradmin::disable_string/) {
				$user->{'pass'} =
				    $useradmin::disable_string.$user->{'pass'};
				&modify_user($user, $user);
				print "$text{'udel_done'}<p>\n";
				}
			else {
				print "$text{'dmass_already'}<p>\n";
				}
			&unlock_user_files();

			&made_changes();
			print "</ul>\n";
			}

		&webmin_log("disable", "users", scalar(@dlist),
			    { 'user' => [ map { $_->{'user'} } @dlist ] });

		&ui_print_footer("", $text{'index_return'});
		}
	else {
		# Ask if the user is sure
		print &ui_confirmation_form(
			"mass_delete_user.cgi",
			&text('dmass_sure', scalar(@dlist)),
			[ [ "confirmed", 1 ],
			  [ "disable", 1 ],
			  map { [ "d", $_->{'user'} ] } @dlist ],
			[ [ undef, $text{'dmass_dis'} ] ],
			);

		&ui_print_footer("", $text{'index_return'});
		}
	}
elsif ($in{'enable'}) {
	# Enabling a bunch of users
	&ui_print_unbuffered_header(undef, $text{'emass_title'}, "");

	foreach $user (@dlist) {
		# Show username
		print "<b>",&text('emass_doing', $user->{'user'}),"</b><br>\n";
		print "<ul>\n";

		# Run the before command
		local @secs;
		foreach $g (&list_groups()) {
			@mems = split(/,/, $g->{'members'});
			if (&indexof($user->{'user'}, @mems) >= 0) {
				push(@secs, $g->{'gid'});
				}
			}
		&set_user_envs($user, 'MODIFY_USER', undef, \@secs);
		$merr = &making_changes();
		&error(&text('usave_emaking', "<tt>$merr</tt>"))
			if (defined($merr));

		# Do it
		&lock_user_files();
		print "$text{'emass_pass'}<br>\n";
		if ($user->{'pass'} =~ s/^$useradmin::disable_string//) {
			&modify_user($user, $user);
			print "$text{'udel_done'}<p>\n";
			}
		else {
			print "$text{'emass_already'}<p>\n";
			}
		&unlock_user_files();

		&made_changes();
		print "</ul>\n";
		}

	&webmin_log("enable", "users", scalar(@dlist),
		    { 'user' => [ map { $_->{'user'} } @dlist ] });

	&ui_print_footer("", $text{'index_return'});
	}
else {
	# Deleting a bunch of users
	&ui_print_unbuffered_header(undef, $text{'umass_title'}, "");

	if ($in{'confirmed'}) {
		foreach $user (@dlist) {
			# Show username
			print "<b>",&text('umass_doing', $user->{'user'}),"</b><br>\n";
			print "<ul>\n";

			# Run the before command
			local @secs;
			foreach $g (&list_groups()) {
				@mems = split(/,/, $g->{'members'});
				if (&indexof($user->{'user'}, @mems) >= 0) {
					push(@secs, $g->{'gid'});
					}
				}
			&set_user_envs($user, 'DELETE_USER', undef, \@secs);
			$merr = &making_changes();
			&error(&text('usave_emaking', "<tt>$merr</tt>"))
				if (defined($merr));

			# Go ahead and do it!
			if ($mconfig{'default_other'}) {
				print "$text{'udel_other'}<br>\n";
				local $error_must_die = 1;
				eval { &other_modules("useradmin_delete_user",$user); };
				if ($@) {
					print &text('udel_failed', $@),"<p>\n";
					}
				else {
					print "$text{'udel_done'}<p>\n";
					}
				}

			# Delete from the LDAP db	
			&lock_user_files();
			print "$text{'udel_pass'}<br>\n";
			&delete_user($user);
			print "$text{'udel_done'}<p>\n";

			# Delete from groups
			print "$text{'udel_groups'}<br>\n";
			foreach $g (&list_groups()) {
				@mems = split(/,/, $g->{'members'});
				$idx = &indexof($user->{'user'}, @mems);
				if ($idx >= 0) {
					splice(@mems, $idx, 1);
					%newg = %$g;
					$newg{'members'} = join(',', @mems);
					&modify_group($g, \%newg);
					}
				$mygroup = $g if ($g->{'group'} eq $user->{'user'});
				}
			print "$text{'udel_done'}<p>\n";

			# Delete private group
			if ($mygroup && !$mygroup->{'members'}) {
				local $another;
				foreach $ou (&list_users()) {
					$another = $ou if ($ou->{'gid'} == $mygroup->{'gid'});
					}
				if (!$another) {
					print "$text{'udel_ugroup'}<br>\n";
					&delete_group($mygroup);
					print "$text{'udel_done'}<p>\n";
					}
				}
			&unlock_user_files();

			# Delete his addressbook entry
			if ($config{'addressbook'}) {
				print "$text{'udel_book'}<br>\n";
				$err = &delete_ldap_subtree($ldap, "ou=$user->{'user'}, $config{'addressbook'}");
				if ($err) {
					print &text('udel_failed', $err),"<p>\n";
					}
				else {
					print "$text{'udel_done'}<p>\n";
					}
				}

			# Delete home directory
			if ($in{'delhome'} && $user->{'home'} !~ /^\/+$/) {
				print "$text{'udel_home'}<br>\n";
				if ($config{'delete_only'}) {
					&lock_file($user->{'home'});
					&system_logged("find \"$user->{'home'}\" ! -type d -user $user->{'uid'} | xargs rm -f >/dev/null 2>&1");
					&system_logged("find \"$user->{'home'}\" -type d -user $user->{'uid'} | xargs rmdir >/dev/null 2>&1");
					rmdir($user->{'home'});
					&unlock_file($user->{'home'});
					}
				else {
					&system_logged("rm -rf \"$user->{'home'}\" >/dev/null 2>&1");
					}
				print "$text{'udel_done'}<p>\n";

				# Delete his IMAP mailbox only if home gets
				# deleted, too
				if ($config{'imap_host'}) {
					print "$text{'udel_imap'}<br>\n";
					$imap = &imap_connect();
					$rv = $imap->delete("user".
						$config{'imap_foldersep'}.
						$user->{'user'});
					$imap->logout();
					print "$text{'udel_done'}<p>\n";
					}
				}

			&made_changes();
			print "</ul>\n";
			}

		&webmin_log("delete", "users", scalar(@dlist),
			    { 'user' => [ map { $_->{'user'} } @dlist ] });

		&ui_print_footer("", $text{'index_return'});
		}
	else {
		# Sum up home directories
		foreach $user (@dlist) {
			if ($user->{'home'} ne "/" && -d $user->{'home'}) {
				$size += &disk_usage_kb($user->{'home'});
				}
			}

		# Ask if the user is sure
		print &ui_confirmation_form(
			"mass_delete_user.cgi",
			&text('umass_sure', scalar(@dlist),
			      &nice_size($size*1024)),
			[ [ "confirmed", 1 ],
			  map { [ "d", $_->{'user'} ] } @dlist ],
			[ [ undef, $text{'umass_del1'} ],
			  [ "delhome", $text{'umass_del2'} ] ],
			&ui_checkbox("others", 1, $text{'udel_dothers'},
                             	     $mconfig{'default_other'}),
			$delete_sys && $delete_sys->{'user'} eq 'root' ?
				"<font color=#ff0000>$text{'udel_root'}</font>"
				: ""
			);

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


Filemanager

Name Type Size Permission Actions
help Folder 0755
images Folder 0755
lang Folder 0755
CHANGELOG File 6.18 KB 0644
acl_security.pl File 7.55 KB 0755
batch_exec.cgi File 15.72 KB 0755
batch_form.cgi File 2.49 KB 0755
cgi_args.pl File 501 B 0755
config File 388 B 0644
config-ALL-linux File 416 B 0644
config-coherent-linux File 385 B 0644
config-debian-linux File 406 B 0644
config-debian-linux-3.1 File 395 B 0644
config-debian-linux-4.0-ALL File 388 B 0644
config-debian-squirrelmail-linux File 560 B 0644
config-macos File 466 B 0644
config-mandrake-linux File 385 B 0644
config-openSUSE-Linux-15.0-ALL File 394 B 0644
config-pardus-linux File 397 B 0644
config-redhat-linux File 385 B 0644
config-sol-linux File 385 B 0644
config-suse-linux File 394 B 0644
config-syno-linux File 452 B 0644
config-trustix-linux File 394 B 0644
config-united-linux File 394 B 0644
config.info File 5.65 KB 0644
config.info.ca File 6 KB 0644
config.info.de File 6.47 KB 0644
config.info.es File 4.93 KB 0644
config.info.fr File 0 B 0644
config.info.nl File 5.99 KB 0644
config.info.no File 5.75 KB 0644
config.info.pt_BR File 6.06 KB 0644
cpan_modules.pl File 85 B 0755
defaultacl File 318 B 0644
edit_group.cgi File 4.17 KB 0755
edit_user.cgi File 14.83 KB 0755
index.cgi File 7.52 KB 0755
install_check.pl File 612 B 0755
ldap-useradmin-lib.pl File 33.58 KB 0755
log_parser.pl File 1.55 KB 0755
mass_delete_group.cgi File 2.04 KB 0755
mass_delete_user.cgi File 7.17 KB 0755
module.info File 261 B 0644
module.info.af File 0 B 0644
module.info.af.auto File 172 B 0644
module.info.ar File 0 B 0644
module.info.ar.auto File 234 B 0644
module.info.be File 0 B 0644
module.info.be.auto File 320 B 0644
module.info.bg File 0 B 0644
module.info.bg.auto File 270 B 0644
module.info.ca File 169 B 0644
module.info.cs File 35 B 0644
module.info.cs.auto File 126 B 0644
module.info.da File 0 B 0644
module.info.da.auto File 155 B 0644
module.info.de File 174 B 0644
module.info.el File 0 B 0644
module.info.el.auto File 347 B 0644
module.info.es File 31 B 0644
module.info.es.auto File 142 B 0644
module.info.eu File 0 B 0644
module.info.eu.auto File 186 B 0644
module.info.fa File 0 B 0644
module.info.fa.auto File 284 B 0644
module.info.fi File 0 B 0644
module.info.fi.auto File 185 B 0644
module.info.fr File 0 B 0644
module.info.fr.auto File 190 B 0644
module.info.he File 0 B 0644
module.info.he.auto File 194 B 0644
module.info.hr File 0 B 0644
module.info.hr.auto File 183 B 0644
module.info.hu File 0 B 0644
module.info.hu.auto File 193 B 0644
module.info.it File 0 B 0644
module.info.it.auto File 157 B 0644
module.info.ja File 0 B 0644
module.info.ja.auto File 205 B 0644
module.info.ko File 0 B 0644
module.info.ko.auto File 174 B 0644
module.info.lt File 0 B 0644
module.info.lt.auto File 184 B 0644
module.info.lv File 0 B 0644
module.info.lv.auto File 176 B 0644
module.info.ms File 172 B 0644
module.info.mt File 0 B 0644
module.info.mt.auto File 168 B 0644
module.info.nl File 35 B 0644
module.info.nl.auto File 142 B 0644
module.info.no File 32 B 0644
module.info.no.auto File 126 B 0644
module.info.pl File 0 B 0644
module.info.pl.auto File 186 B 0644
module.info.pt File 0 B 0644
module.info.pt.auto File 163 B 0644
module.info.pt_BR File 38 B 0644
module.info.pt_BR.auto File 134 B 0644
module.info.ro File 0 B 0644
module.info.ro.auto File 184 B 0644
module.info.ru File 0 B 0644
module.info.ru.auto File 279 B 0644
module.info.sk File 0 B 0644
module.info.sk.auto File 192 B 0644
module.info.sl File 0 B 0644
module.info.sl.auto File 185 B 0644
module.info.sv File 0 B 0644
module.info.sv.auto File 166 B 0644
module.info.th File 0 B 0644
module.info.th.auto File 303 B 0644
module.info.tr File 0 B 0644
module.info.tr.auto File 194 B 0644
module.info.uk File 0 B 0644
module.info.uk.auto File 289 B 0644
module.info.ur File 0 B 0644
module.info.ur.auto File 295 B 0644
module.info.vi File 0 B 0644
module.info.vi.auto File 206 B 0644
module.info.zh File 0 B 0644
module.info.zh.auto File 130 B 0644
module.info.zh_TW File 0 B 0644
module.info.zh_TW.auto File 136 B 0644
postinstall.pl File 224 B 0755
prefs.info File 50 B 0644
raw.cgi File 967 B 0755
save_group.cgi File 9.38 KB 0755
save_user.cgi File 24.6 KB 0755
search_group.cgi File 1.31 KB 0755
search_user.cgi File 1.46 KB 0755