#!/usr/local/bin/perl
use blib;
use strict;
use AFS::Utils qw(setpag);
die "Usage: $0 user\n" if ($#ARGV != 0);
my $princ = shift;
setpag;
system "tokens";
my $user = AFS::KTC_PRINCIPAL->new($princ);
my $password = AFS::KTC_EKEY->UserReadPassword("Password:");
my $pw;
my $reason = '';
my $ok = AFS::KTC_TOKEN->UserAuthenticateGeneral($user, $password, 300,
&AFS::KA_USERAUTH_VERSION | &AFS::KA_USERAUTH_DOSETPAG,
$pw, $reason);
print "AFS::CODE = $AFS::CODE\n";
print "pwexpires = $pw\n";
print "reason = $reason\n";
system "tokens";