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'; |
28
|
|
|
|
|
|
|
|
29
|
10
|
|
|
10
|
|
57
|
use strict; |
|
10
|
|
|
|
|
21
|
|
|
10
|
|
|
|
|
419
|
|
30
|
10
|
|
|
10
|
|
58
|
use warnings; |
|
10
|
|
|
|
|
365
|
|
|
10
|
|
|
|
|
381
|
|
31
|
|
|
|
|
|
|
|
32
|
10
|
|
|
10
|
|
265
|
use 5.006; |
|
10
|
|
|
|
|
35
|
|
|
10
|
|
|
|
|
453
|
|
33
|
10
|
|
|
10
|
|
55
|
use Net::TacacsPlus::Constants 1.03; |
|
10
|
|
|
|
|
211
|
|
|
10
|
|
|
|
|
74
|
|
34
|
10
|
|
|
10
|
|
66
|
use Carp::Clan; |
|
10
|
|
|
|
|
17
|
|
|
10
|
|
|
|
|
86
|
|
35
|
|
|
|
|
|
|
|
36
|
10
|
|
|
10
|
|
2129
|
use base qw{ Class::Accessor::Fast }; |
|
10
|
|
|
|
|
22
|
|
|
10
|
|
|
|
|
5207
|
|
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
|
469
|
my $class = shift; |
61
|
2
|
|
|
|
|
12
|
my %params = @_; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
#let the class accessor contruct the object |
64
|
2
|
|
|
|
|
20
|
my $self = $class->SUPER::new(\%params); |
65
|
|
|
|
|
|
|
|
66
|
2
|
100
|
|
|
|
28
|
if ($params{'raw_body'}) { |
67
|
1
|
|
|
|
|
4
|
$self->decode($params{'raw_body'}); |
68
|
1
|
|
|
|
|
3
|
delete $self->{'raw_body'}; |
69
|
1
|
|
|
|
|
4
|
return $self; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
# set default values |
73
|
1
|
50
|
|
|
|
7
|
$self->server_msg('') if not defined $self->server_msg; |
74
|
1
|
50
|
|
|
|
21
|
$self->data('') if not defined $self->data; |
75
|
|
|
|
|
|
|
|
76
|
1
|
|
|
|
|
12
|
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
|
|
|
|
|
2
|
my ($server_msg_len,$data_len,$payload); |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
( |
91
|
1
|
|
|
|
|
11
|
$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
|
|
|
|
|
8
|
$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
|
1238
|
my $self = shift; |
115
|
|
|
|
|
|
|
|
116
|
1
|
|
|
|
|
13
|
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
|
|
|
|
|
3
|
return $body; |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
1; |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=back |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=cut |
133
|
|
|
|
|
|
|
|