[OpenAFS] perl afs change password
David Botsch
dwb7@ccmr.cornell.edu
Tue, 15 Apr 2003 15:12:11 -0400
Hi.
I have been trying to use the perl afs module to allow a user to change
his or her password.
However, it is failing with the following error when I look at
$AFS::CODE after attempting the ChangePassword call.
"ticket contained unknown key version number"
If I look at the kvno member of a KTC::TOKEN, it does indeed contain 0,
which, for the users I am testing is not correct (comparing against a
kas exa).
Code looks something like this:
#!/usr/local/bin/perl
# Change password
use strict;
use lib '/usr/local/lib/perl5/site_perl';
use AFS::Cell qw(localcell);
use AFS::KTC_PRINCIPAL;
use AFS::KTC_TOKEN;
use POSIX qw(setsid);
use AFS @AFS::MISC;
use AFS::KTC_EKEY;
use AFS::KAS;
<SNIP>
my $testtok;
my $testuser;
my $info;
# auth user
$ok = AFS::KTC_TOKEN->UserAuthenticateGeneral($princ, $oldpw,
60, &AFS::KA_USERAUTH_VERSION, -1, $info);
if ($ok == 0) {
print "Code: " . $AFS::CODE . "<br><br>";
}
($testtok, $testuser) = AFS::KTC_TOKEN->GetToken($service);
# debugging
print "<pre>";
print "Code: " . $AFS::CODE . "\n";
print "client: " . $testuser->principal . "\n";
print "kvno: " . $testtok->kvno . "\n"; # kvno is 0 ?!?!?
print "</pre>";
# connect to kas & chng pw
$kas = AFS::KAS->AuthServerConn($testtok,
&AFS::KA_MAINTENANCE_SERVICE, localcell);
$ok = $kas->ChangePassword($testuser->name,
$testuser->instance, $oldkey, $newkey);
if ($ok == 0) {
print "Chng pw failed: " . $AFS::CODE . "<br><br>";
}
Thanks for any insights you can provide!
--
********************************
David William Botsch
Consultant/Advisor II
CCMR Computing Facility
dwb7@ccmr.cornell.edu
********************************