Authen::Krb5::KDB::V2 - objects for Kerberos V5 database V2 principals


Authen-Krb5-KDB documentation Contained in the Authen-Krb5-KDB distribution.

Index


Code Index:

NAME

Top

Authen::Krb5::KDB::V2 - objects for Kerberos V5 database V2 principals

SYNOPSIS

Top

Generally you won't load this library or call it's new methods directly. See Authen::Krb5::KDB for more information.

    use Authen::Krb5::KDB::V2;

    $p = Authen::Krb5::KDB::V2->new( data => "..." );

    [XXX]

DESCRIPTION

Top

new( data => "..." )

Parses version 2 principal entries and returns the data via an object. Calls new_princ to do the work.

Arguments are:

data => <string>

Data to be parsed. This argument is required.

checks => <level>

Data checking level. Level 0 means no checks; level 1 (the default) does basic checks like checking that the lengths in the records are correct; level 2 does much further consistency checks on the data.

lineno => <N>

Line number of the data file where this data came from (for error messages).

Principals

new_princ( data => "..." )

Parses version 2 principal entries and returns the data via an object.

Arguments are:

data => <string>

Data to be parsed. This argument is required.

checks => <level>

Data checking level. Level 0 means no checks; level 1 (the default) does basic checks like checking that the lengths in the records are correct; level 2 does much further consistency checks on the data.

lineno => <N>

Line number of the data file where this data came from (for error messages).

Methods to retrieve and set data fields are:

    [These methods are not implemented yet for V2.]




AUTHOR

Top

Dave Steiner, <steiner@bakerst.rutgers.edu>

COPYRIGHT

Top

SEE ALSO

Top

perl(1), kerberos(1), Authen::Krb5::KDB, Authen::Krb5::KDB_H.


Authen-Krb5-KDB documentation Contained in the Authen-Krb5-KDB distribution.

package Authen::Krb5::KDB::V2;

# $Id: V2.pm,v 1.8 2002/10/09 20:42:10 steiner Exp $

use Carp;
use POSIX qw(strftime);
use strict;
use vars qw($VERSION);

$VERSION = do{my@r=q$Revision: 1.8 $=~/\d+/g;sprintf '%d.'.'%02d'x$#r,@r};

sub new {
    my $proto = shift;
    my $class = ref($proto) || $proto;
    my %args = @_;
        # checks => level
        # data => "string"

    $args{'raw_data'} = $args{'data'};

    my $p = $class->new_princ ( %args );
    return $p;
}

sub new_princ {
    my $proto = shift;
    my $class = ref($proto) || $proto;
    my %args = @_;
        # checks => level
        # data => "string"
    my $self = {};
    my @data;

    if (defined($args{'data'})) {
	if ($args{'data'} =~ /;$/) { 
	    chop($args{'data'});
	} else {
	    croak "princ record missing final ';' at line $args{'lineno'}";
	}
	@data = split(/\t/, $args{'data'});
	$self->{'raw_data'} = defined($args{'raw_data'}) ? $args{'raw_data'} : $args{'data'};
    } else {
	croak "data for new principal not defined at line $args{'lineno'}";
    }

    $self->{'type'} = 'princ';

croak "V2 not yet implemented."; # XXX

    if (@data) {
	carp "Still data left: @data";
    }
    bless($self, $class);
    return $self;
}

sub _strdate {
    my $when = shift;
    return "[never]"  if (not $when);
    my @tm = localtime($when);
    return strftime("%a %b %d %H:%M:%S %Z %Y", @tm);
}

1;
__END__