using Authen::pam of perl module
I have an perl programme that change password but not interactively..
the programme run and ends with this message
"Authentication token manipulation error"
$service = "passwd";
$username = "vivek";
$oldpassword = "altctrl";
$newpassword = "redhat";
while ( @_ )
my $code = shift;
my $msg = shift;
my $ans = "";
$ans = $username if ($code == PAM_PROMPT_ECHO_ON() );
if($code == PAM_PROMPT_ECHO_OFF() )
$ans = $oldpassword if ($state == 0);
$ans = $newpassword if ($state == 1);
$ans = $newpassword if ($state == 2);
push @res, (PAM_SUCCESS(),$ans);
push @res, PAM_SUCCESS();
ref($pamh = new Authen::PAM($service, $username, \&my_conv_func)) ||die "Error code $pamh during PAM init!";
$state = 0;
$res = $pamh->pam_chauthtok;
print $pamh->pam_strerror($res),"\n" unless $res == PAM_SUCCESS();
THE BIG QUESTION:
What's going on?
Any help would be greatly appreciated as I'm not really sure what's going on with this!
i am login as root and OS is fedora 7
Thanks much in advance.