Hi,
I have an perl programme that change password but not interactively..
the programme run and ends with this message
"Authentication token manipulation error"



__________________________________________________________________________
#!/usr/bin/perl -w

use Authen::PAM;

$service = "passwd";
$username = "vivek";
$oldpassword = "altctrl";
$newpassword = "redhat";

sub my_conv_func
{
my @res;
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);
$state++;
}
push @res, (PAM_SUCCESS(),$ans);
}
push @res, PAM_SUCCESS();
return @res;
}
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.
Regards,
sandip


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to