File: Authenticate

package info (click to toggle)
libafs-perl 2.6.2-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 2,244 kB
  • ctags: 268
  • sloc: perl: 5,159; ansic: 135; sh: 36; makefile: 7
file content (23 lines) | stat: -rwxr-xr-x 768 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/local/bin/perl -w

use blib;
use Time::localtime;
use AFS::KAS;
use AFS::KTC_PRINCIPAL;
use AFS::KTC_TOKEN;
use AFS::KTC_EKEY;
use AFS qw(checkafs);

die "Usage: user\n" if ($#ARGV != 0);

my $user       = AFS::KTC_PRINCIPAL->new(shift);
checkafs('principal new');
my $key        = AFS::KTC_EKEY->ReadPassword($user->name."'s Password:");
checkafs('read passwd');
my $kas        = AFS::KAS->AuthServerConn(AFS::KTC_TOKEN->nulltoken, &AFS::KA_AUTHENTICATION_SERVICE);
checkafs('server conn');
my $token = $kas->Authenticate($user->name, $user->instance, &AFS::KA_TICKET_GRANTING_SERVICE, $key, time, time+600);
checkafs('authenticate');

print " Token  startTime = ", &ctime($token->startTime), "\n";
print "          endTime = ", &ctime($token->endTime), "\n";