/usr/share/usermin
NameSizeModeActions
at/-0755rm
authentic-theme/-0755rm
blue-theme/-0755rm
changepass/-0755rm
chfn/-0755rm
commands/-0755rm
cron/-0755rm
cshrc/-0755rm
fetchmail/-0755rm
filemin/-0755rm
filter/-0755rm
forward/-0755rm
gnupg/-0755rm
gray-theme/-0755rm
htaccess/-0755rm
htaccess-htpasswd/-0755rm
images/-0755rm
lang/-0755rm
language/-0755rm
mailbox/-0755rm
mailcap/-0755rm
man/-0755rm
mysql/-0755rm
plan/-0755rm
postgresql/-0755rm
proc/-0755rm
procmail/-0755rm
quota/-0755rm
schedule/-0755rm
shell/-0755rm
spam/-0755rm
ssh/-0755rm
theme/-0755rm
tunnel/-0755rm
twofactor/-0755rm
ulang/-0755rm
unauthenticated/-0755rm
updown/-0755rm
usermount/-0755rm
vendor_perl/-0755rm
xterm/-0755rm
acl_security.pl29590755editdlrm
chooser.cgi73870755editdlrm
config-aix2270644editdlrm
config-cobalt-linux2640644editdlrm
config-coherent-linux2640644editdlrm
config-corel-linux2640644editdlrm
config-debian-linux2640644editdlrm
config-freebsd2560644editdlrm
config-generic-linux2640644editdlrm
config-gentoo-linux2640644editdlrm
config-hpux2430644editdlrm
config-irix2840644editdlrm
config-lib.pl121200755editdlrm
config-macos2600644editdlrm
config-mandrake-linux2780644editdlrm
config-msc-linux2640644editdlrm
config-netbsd2830644editdlrm
config-open-linux2640644editdlrm
config-openbsd2410644editdlrm
config-openmamba-linux2640644editdlrm
config-openserver2360644editdlrm
config-osf12660644editdlrm
config-redhat-linux2640644editdlrm
config-slackware-linux2800644editdlrm
config-sol-linux2640644editdlrm
config-solaris4170644editdlrm
config-suse-linux2640644editdlrm
config-trustix-linux2640644editdlrm
config-turbo-linux2640644editdlrm
config-united-linux2640644editdlrm
config-unixware2860644editdlrm
copyconfig.pl44360755editdlrm
date_chooser.cgi22410755editdlrm
deb-name80644editdlrm
defaultacl980644editdlrm
defaulttheme160644editdlrm
entities_map.txt15010644editdlrm
favicon.ico150860644editdlrm
feedback.cgi65190755editdlrm
feedback_form.cgi35330755editdlrm
group_chooser.cgi76900755editdlrm
help.cgi23130755editdlrm
html-editor-lib.pl181470644editdlrm
index.cgi57810755editdlrm
install-module.pl13040755editdlrm
install-type40644editdlrm
javascript-lib.pl150420755editdlrm
lang_list.txt25700644editdlrm
LICENCE15160644editdlrm
LICENCE.ja16540644editdlrm
maketemp.pl4240755editdlrm
mime.types127130644editdlrm
miniserv.pem29690644editdlrm
miniserv.pl1894390755editdlrm
newmods.pl12800755editdlrm
oschooser.pl46550755editdlrm
os_list.txt358250644editdlrm
pam_login.cgi44290755editdlrm
password_change.cgi71920755editdlrm
password_form.cgi13270755editdlrm
perlpath.pl5710755editdlrm
README19720644editdlrm
robots.txt260644editdlrm
session_login.cgi52300755editdlrm
setup.sh268100755editdlrm
switch_user.cgi4040755editdlrm
thirdparty.pl17740755editdlrm
uconfig.cgi14280755editdlrm
uconfig_save.cgi14900755editdlrm
ui-lib.pl1159450755editdlrm
update-from-repo.sh151240755editdlrm
updateboot.pl24290755editdlrm
uptracker.cgi29560755editdlrm
usermin-init19270755editdlrm
usermin-pam1010644editdlrm
usermin-pam-osx2430644editdlrm
usermin-systemd4430644editdlrm
user_chooser.cgi75710755editdlrm
version60644editdlrm
web-lib-funcs.pl4051600755editdlrm
web-lib.pl9070755editdlrm
webmin-search-lib.pl96970755editdlrm
WebminCore.pm88730644editdlrm
webmin_search.cgi26970755editdlrm
Edit: /usr/share/usermin/password_change.cgi (7192B)
#!/usr/bin/perl # password_change.cgi # Actually update a user's password by directly modifying /etc/shadow BEGIN { push(@INC, "."); }; use WebminCore; $ENV{'MINISERV_INTERNAL'} || die "Can only be called by miniserv.pl"; &init_config(); &ReadParse(); &get_miniserv_config(\%miniserv); $miniserv{'passwd_mode'} == 2 || die "Password changing is not enabled!"; # Validate inputs $in{'new1'} ne '' || &pass_error($text{'password_enew1'}); $in{'new1'} eq $in{'new2'} || &pass_error($text{'password_enew2'}); # Is this a Webmin user? if (&foreign_check("acl")) { &foreign_require("acl", "acl-lib.pl"); ($wuser) = grep { $_->{'name'} eq $in{'user'} } &acl::list_users(); if ($wuser) { if ($wuser->{'pass'} eq 'x') { # A Webmin user, but using Unix authentication $wuser = undef; } elsif ($wuser->{'pass'} eq '*LK*' || $wuser->{'pass'} =~ /^\!/) { &pass_error("Webmin users with locked accounts cannot change ". "their passwords!"); } } } if (!$in{'pam'} && !$wuser) { $miniserv{'passwd_cindex'} ne '' && $miniserv{'passwd_mindex'} ne '' || die "Missing password file configuration"; } if ($wuser) { # Update Webmin user's password $ok = &acl::validate_password($in{'old'}, $wuser->{'pass'}); $ok || &pass_error($text{'password_euserpass'}); $perr = &acl::check_password_restrictions($in{'user'}, $in{'new1'}); $perr && &pass_error(&text('password_enewpass', $perr)); $wuser->{'pass'} = &acl::encrypt_password($in{'new1'}); $wuser->{'temppass'} = 0; &acl::modify_user($wuser->{'name'}, $wuser); &reload_miniserv(); } elsif ($gconfig{'passwd_cmd'}) { # Use some configured command $passwd_cmd = &has_command($gconfig{'passwd_cmd'}); $passwd_cmd || &pass_error("The password change command $gconfig{'passwd_cmd'} was not found"); &foreign_require("proc", "proc-lib.pl"); &clean_environment(); $ENV{'REMOTE_USER'} = $in{'user'}; # some programs need this $passwd_cmd .= " ".quotemeta($in{'user'}); ($fh, $fpid) = &proc::pty_process_exec($passwd_cmd, 0, 0); &reset_environment(); while(1) { local $rv = &wait_for($fh, '(new|re-enter).*:', '(old|current|login).*:', 'pick a password', 'too\s+many\s+failures', 'attributes\s+changed\s+on|successfully\s+changed', 'pick your passwords'); $out .= $wait_for_input; sleep(1); if ($rv == 0) { # Prompt for the new password syswrite($fh, $in{'new1'}."\n", length($in{'new1'})+1); } elsif ($rv == 1) { # Prompt for the old password syswrite($fh, $in{'old'}."\n", length($in{'old'})+1); } elsif ($rv == 2) { # Request for a menu option (SCO?) syswrite($fh, "1\n", 2); } elsif ($rv == 3) { # Failed too many times last; } elsif ($rv == 4) { # All done last; } elsif ($rv == 5) { # Request for a menu option (HP/UX) syswrite($fh, "p\n", 2); } else { last; } last if (++$count > 10); } $crv = close($fh); sleep(1); waitpid($fpid, 1); if ($? || $count > 10 || $out =~ /error|failed/i || $out =~ /bad\s+password/i) { &pass_error("".&html_escape($out).""); } } elsif ($in{'pam'}) { # Use PAM to make the change.. eval "use Authen::PAM;"; if ($@) { &pass_error(&text('password_emodpam', $@)); } # Check if the old password is correct $service = $miniserv{'pam'} ? $miniserv{'pam'} : "webmin"; $pamh = new Authen::PAM($service, $in{'user'}, \&pam_check_func); $rv = $pamh->pam_authenticate(); $rv == PAM_SUCCESS() || &pass_error($text{'password_euserpass'}); $pamh = undef; # Change the password with PAM, in a sub-process. This is needed because # the UID must be changed to properly signal to the PAM libraries that # the password change is not being done by the root user. $temp = &transname(); $pid = fork(); @uinfo = getpwnam($in{'user'}); if (!$pid) { ($>, $<) = (0, $uinfo[2]); $pamh = new Authen::PAM("passwd", $in{'user'}, \&pam_change_func); $rv = $pamh->pam_chauthtok(); open(TEMP, ">$temp"); print TEMP "$rv\n"; print TEMP ($messages || $pamh->pam_strerror($rv)),"\n"; close(TEMP); exit(0); } waitpid($pid, 0); open(TEMP, "<$temp"); chop($rv = ); chop($messages = ); close(TEMP); unlink($temp); $rv == PAM_SUCCESS || &pass_error(&text('password_epam', $messages)); $pamh = undef; } else { # Directly update password file # Read shadow file and find user &lock_file($miniserv{'passwd_file'}); $lref = &read_file_lines($miniserv{'passwd_file'}); for($i=0; $i<@$lref; $i++) { @line = split(/:/, $lref->[$i], -1); local $u = $line[$miniserv{'passwd_uindex'}]; if ($u eq $in{'user'}) { $idx = $i; last; } } defined($idx) || &pass_error($text{'password_euserpass'}); # Validate old password &unix_crypt($in{'old'}, $line[$miniserv{'passwd_pindex'}]) eq $line[$miniserv{'passwd_pindex'}] || &pass_error($text{'password_euserpass'}); # Make sure new password meets restrictions if (&foreign_check("changepass")) { &foreign_require("changepass", "changepass-lib.pl"); $err = &changepass::check_password($in{'new1'}, $in{'user'}); &pass_error($err) if ($err); } elsif (&foreign_check("useradmin")) { &foreign_require("useradmin", "user-lib.pl"); $err = &useradmin::check_password_restrictions( $in{'new1'}, $in{'user'}); &pass_error($err) if ($err); } # Set new password and save file $salt = chr(int(rand(26))+65) . chr(int(rand(26))+65); $line[$miniserv{'passwd_pindex'}] = &unix_crypt($in{'new1'}, $salt); $days = int(time()/(24*60*60)); $line[$miniserv{'passwd_cindex'}] = $days; $lref->[$idx] = join(":", @line); &flush_file_lines(); &unlock_file($miniserv{'passwd_file'}); } # Change password in Usermin too if (&get_product_name() eq 'usermin' && &foreign_check("changepass")) { &foreign_require("changepass", "changepass-lib.pl"); &changepass::change_mailbox_passwords( $in{'user'}, $in{'old'}, $in{'new1'}); &changepass::change_samba_password( $in{'user'}, $in{'old'}, $in{'new1'}); } # Show ok page &header(undef, undef, undef, undef, 1, 1); print &ui_alert_box(&text('password_done', "/"), "success"); &footer(); sub pass_error { &header(undef, undef, undef, undef, 1, 1, undef, undef); print &ui_alert_box("$text{'password_err'}: @_.", "danger"); &footer(); exit; } sub pam_check_func { my @res; while ( @_ ) { my $code = shift; my $msg = shift; my $ans = ""; $ans = $in{'user'} if ($code == PAM_PROMPT_ECHO_ON()); $ans = $in{'old'} if ($code == PAM_PROMPT_ECHO_OFF()); push @res, PAM_SUCCESS(); push @res, $ans; } push @res, PAM_SUCCESS(); return @res; } sub pam_change_func { my @res; while ( @_ ) { my $code = shift; my $msg = shift; my $ans = ""; $messages = $msg; if ($code == PAM_PROMPT_ECHO_ON()) { # Assume asking for username push @res, PAM_SUCCESS(); push @res, $in{'user'}; } elsif ($code == PAM_PROMPT_ECHO_OFF()) { # Assume asking for a password (old first, then new) push @res, PAM_SUCCESS(); if ($msg =~ /old|current|login/i) { push @res, $in{'old'}; } else { push @res, $in{'new1'}; } } else { # Some message .. ignore it push @res, PAM_SUCCESS(); push @res, undef; } } push @res, PAM_SUCCESS(); return @res; }