| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Protocol::XMPP::Element::Challenge; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
300051
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
48
|
|
|
4
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
108
|
|
|
5
|
1
|
|
|
1
|
|
9
|
use parent qw(Protocol::XMPP::ElementBase); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.007'; ## VERSION |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Protocol::XMPP::Challenge - deal with the XMPP challenge |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Generate a response to an XMPP challenge using the L object we set up earlier. |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 METHODS |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=cut |
|
22
|
|
|
|
|
|
|
|
|
23
|
1
|
|
|
1
|
|
673
|
use MIME::Base64; |
|
|
1
|
|
|
|
|
916
|
|
|
|
1
|
|
|
|
|
308
|
|
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 C |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
On completion of the element, queue a write for the answering token as provided by L. Token |
|
28
|
|
|
|
|
|
|
value is opaque binary data, and must be Base64 encoded (using L). |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=cut |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub end_element { |
|
33
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
34
|
0
|
|
|
|
|
|
$self->debug("Data was: " . $self->{data}); |
|
35
|
0
|
|
|
|
|
|
my $data = MIME::Base64::decode_base64($self->{data}); |
|
36
|
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
my ($token) = $self->stream->{features}->{sasl_client}->client_step($data); |
|
38
|
0
|
|
0
|
|
|
|
$self->debug("Token was [" . ($token || 'undefined') . "]"); |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# Return either base64 token value, or '=' (which decodes to empty value but we need to be explicit about |
|
41
|
|
|
|
|
|
|
# this for some recipients) if we didn't have one. |
|
42
|
0
|
0
|
|
|
|
|
my $response = MIME::Base64::encode_base64(defined $token ? $token : '', ''); |
|
43
|
0
|
0
|
0
|
|
|
|
$token = '=' unless defined $response && length $response; |
|
44
|
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
$self->write_xml([ |
|
46
|
|
|
|
|
|
|
'response', |
|
47
|
|
|
|
|
|
|
_ns => 'xmpp-sasl', |
|
48
|
|
|
|
|
|
|
_content => $response |
|
49
|
|
|
|
|
|
|
]); |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
__END__ |