);
close(TEMP);
unlink($temp);
$rv == PAM_SUCCESS || &error(&text('change_epam2', $messages));
}
# Run any post-change command. This must be done before the calls to the
# MySQL and mailboxes module, while we are still root.
if ($config{'post_command'}) {
$ENV{'CHANGEPASS_USER'} = $remote_user;
$ENV{'CHANGEPASS_PASS'} = $in{'new1'};
system("($config{'post_command'}) >/dev/null 2>&1 ",&text('change_oka', "$remote_user"),"\n";
if ($smbout =~ /changed/) {
print "
",&text('change_samba'),"
\n";
}
elsif ($smbout) {
print "
",&text('change_samba2', "
$smbout
"),"\n";
}
if ($mysql_ok) {
print "
",&text('change_mysql'),"
\n";
}
elsif ($mysql_error) {
print "
",&text('change_mysql2', $mysql_error),"
\n";
}
foreach $pc (@pc) {
print "$pc
\n";
}
print "
\n" if (@pc);
&ui_print_footer("", $text{'index_return'});
sub pam_check_func
{
my @res;
while ( @_ ) {
my $code = shift;
my $msg = shift;
my $ans = "";
$ans = $remote_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, $remote_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;
}