line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::TacacsPlus::Packet::AuthenReplyBody; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Net::TacacsPlus::Packet::AuthenReplyBody - Tacacs+ authentication replay body |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 DESCRIPTION |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
7. The authentication REPLY packet body |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
The TACACS+ daemon sends only one type of authentication packet (a |
12
|
|
|
|
|
|
|
REPLY packet) to the client. The REPLY packet body looks as follows: |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
+----------------+----------------+----------------+----------------+ |
17
|
|
|
|
|
|
|
| status | flags | server_msg len | |
18
|
|
|
|
|
|
|
+----------------+----------------+----------------+----------------+ |
19
|
|
|
|
|
|
|
| data len | server_msg ... |
20
|
|
|
|
|
|
|
+----------------+----------------+----------------+----------------+ |
21
|
|
|
|
|
|
|
| data ... |
22
|
|
|
|
|
|
|
+----------------+----------------+ |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=cut |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
our $VERSION = '1.10_01'; |
28
|
|
|
|
|
|
|
|
29
|
10
|
|
|
10
|
|
46
|
use strict; |
|
10
|
|
|
|
|
39
|
|
|
10
|
|
|
|
|
352
|
|
30
|
10
|
|
|
10
|
|
49
|
use warnings; |
|
10
|
|
|
|
|
11
|
|
|
10
|
|
|
|
|
253
|
|
31
|
|
|
|
|
|
|
|
32
|
10
|
|
|
10
|
|
251
|
use 5.006; |
|
10
|
|
|
|
|
25
|
|
|
10
|
|
|
|
|
375
|
|
33
|
10
|
|
|
10
|
|
46
|
use Net::TacacsPlus::Constants 1.03; |
|
10
|
|
|
|
|
168
|
|
|
10
|
|
|
|
|
57
|
|
34
|
10
|
|
|
10
|
|
55
|
use Carp::Clan; |
|
10
|
|
|
|
|
11
|
|
|
10
|
|
|
|
|
61
|
|
35
|
|
|
|
|
|
|
|
36
|
10
|
|
|
10
|
|
1406
|
use base qw{ Class::Accessor::Fast }; |
|
10
|
|
|
|
|
17
|
|
|
10
|
|
|
|
|
3527
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(qw{ |
39
|
|
|
|
|
|
|
status |
40
|
|
|
|
|
|
|
flags |
41
|
|
|
|
|
|
|
server_msg |
42
|
|
|
|
|
|
|
data |
43
|
|
|
|
|
|
|
}); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 METHODS |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=over 4 |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=item new( somekey => somevalue) |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Construct tacacs+ authentication packet body object |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Parameters: |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
'raw_body': raw body |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=cut |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub new { |
60
|
2
|
|
|
2
|
1
|
467
|
my $class = shift; |
61
|
2
|
|
|
|
|
7
|
my %params = @_; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
#let the class accessor contruct the object |
64
|
2
|
|
|
|
|
16
|
my $self = $class->SUPER::new(\%params); |
65
|
|
|
|
|
|
|
|
66
|
2
|
100
|
|
|
|
22
|
if ($params{'raw_body'}) { |
67
|
1
|
|
|
|
|
5
|
$self->decode($params{'raw_body'}); |
68
|
1
|
|
|
|
|
2
|
delete $self->{'raw_body'}; |
69
|
1
|
|
|
|
|
6
|
return $self; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
# set default values |
73
|
1
|
50
|
|
|
|
5
|
$self->server_msg('') if not defined $self->server_msg; |
74
|
1
|
50
|
|
|
|
16
|
$self->data('') if not defined $self->data; |
75
|
|
|
|
|
|
|
|
76
|
1
|
|
|
|
|
8
|
return $self; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=item decode($raw_data) |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Extract $server_msg and data from raw packet. |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=cut |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub decode { |
86
|
1
|
|
|
1
|
1
|
3
|
my ($self, $raw_data) = @_; |
87
|
|
|
|
|
|
|
|
88
|
1
|
|
|
|
|
1
|
my ($server_msg_len,$data_len,$payload); |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
( |
91
|
1
|
|
|
|
|
10
|
$self->{'status'}, |
92
|
|
|
|
|
|
|
$self->{'flags'}, |
93
|
|
|
|
|
|
|
$server_msg_len, |
94
|
|
|
|
|
|
|
$data_len, |
95
|
|
|
|
|
|
|
$payload, |
96
|
|
|
|
|
|
|
) = unpack("CCnna*", $raw_data); |
97
|
|
|
|
|
|
|
|
98
|
1
|
50
|
|
|
|
4
|
$payload = '' if not defined $payload; #payload can be empty |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
( |
101
|
1
|
|
|
|
|
6
|
$self->{'server_msg'}, |
102
|
|
|
|
|
|
|
$self->{'data'} |
103
|
|
|
|
|
|
|
) = unpack("a".$server_msg_len."a".$data_len,$payload); |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=item raw() |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Return binary data of packet body. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=cut |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
sub raw { |
114
|
1
|
|
|
1
|
1
|
1467
|
my $self = shift; |
115
|
|
|
|
|
|
|
|
116
|
1
|
|
|
|
|
12
|
my $body = pack("CCnna*a*", |
117
|
|
|
|
|
|
|
$self->{'status'}, |
118
|
|
|
|
|
|
|
$self->{'flags'}, |
119
|
|
|
|
|
|
|
length($self->{'server_msg'}), |
120
|
|
|
|
|
|
|
length($self->{'data'}), |
121
|
|
|
|
|
|
|
$self->{'server_msg'}, |
122
|
|
|
|
|
|
|
$self->{'data'}, |
123
|
|
|
|
|
|
|
); |
124
|
|
|
|
|
|
|
|
125
|
1
|
|
|
|
|
2
|
return $body; |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
1; |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=back |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=cut |
133
|
|
|
|
|
|
|
|