| 1 | # Copyright (c) 2002 Graham Barr <gbarr@pobox.com>. All rights reserved. | ||||||||||||||||||||||||||||||||||||||
| 2 | # This program is free software; you can redistribute it and/or | ||||||||||||||||||||||||||||||||||||||
| 3 | # modify it under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||
| 5 | package Authen::SASL::Perl::PLAIN 2.2100; | ||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||
| 7 | 5 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 8 | 5 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 9 | 5 | ▶ | use vars qw(@ISA); | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||
| 11 | 5 | @ISA = qw(Authen::SASL::Perl); | |||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||
| 13 | 5 | my %secflags = ( | |||||||||||||||||||||||||||||||||||||
| 14 | noanonymous => 1, | ||||||||||||||||||||||||||||||||||||||
| 15 | ); | ||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||
| 17 | 5 | my @tokens = qw(authname user pass); | |||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||
| 19 | 51 | ▶ | sub _order { 1 } | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_order: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 20 | 19 | ▶ | sub _secflags { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_secflags: called CC=1 SCAR=0.4
| |||||||||||||||||||||||||||||||||||||||
| 21 | 19 | shift; | |||||||||||||||||||||||||||||||||||||
| 22 | 0 | grep { $secflags{$_} } @_; | |||||||||||||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||
| 25 | 7 | ▶ | sub mechanism { 'PLAIN' } | ||||||||||||||||||||||||||||||||||||
|
Subroutine
mechanism: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||
| 27 | 5 | ▶ | sub client_start { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
client_start: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 28 | 5 | my $self = shift; | |||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||
| 30 | 5 | $self->{error} = undef; | |||||||||||||||||||||||||||||||||||||
| 31 | 5 | $self->{need_step} = 0; | |||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||
| 33 | my @parts = map { | ||||||||||||||||||||||||||||||||||||||
| 34 | 5 | my $v = $self->_call($_); | |||||||||||||||||||||||||||||||||||||
| 35 | 15 | ▶ | defined($v) ? $v : '' | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 36 | } @tokens; | ||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||
| 38 | 5 | join("\0", @parts); | |||||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||
| 41 | 24 | ▶ | sub server_start { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
server_start: called CC=6 SCAR=18.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 42 | 24 | my $self = shift; | |||||||||||||||||||||||||||||||||||||
| 43 | 24 | my $response = shift; | |||||||||||||||||||||||||||||||||||||
| 44 | 24 | ▶ | my $user_cb = shift || sub {}; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.2
Condition66%2/3
shift() || sub {
}
MC/DC0%0/2
shift() || sub {
}
shift()
sub {
}
Truth table66%2/3
A || B
A= shift()B= sub {
}
| |||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||
| 46 | 24 | $self->{error} = undef; | |||||||||||||||||||||||||||||||||||||
| 47 | 24 | ▶ | return $self->set_error("No response: Credentials don't match") | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 48 | unless defined $response; | ||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||
| 50 | 24 | my %parts; | |||||||||||||||||||||||||||||||||||||
| 51 | 24 | @parts{@tokens} = split "\0", $response, scalar @tokens; | |||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||
| 54 | # I'm not entirely sure of what I am doing | ||||||||||||||||||||||||||||||||||||||
| 55 | 24 | $self->{answer}{$_} = $parts{$_} for qw/authname user/; | |||||||||||||||||||||||||||||||||||||
| 56 | 24 | my $error = "Credentials don't match"; | |||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||
| 58 | ## checkpass | ||||||||||||||||||||||||||||||||||||||
| 59 | 24 | ▶ | if (my $checkpass = $self->callback('checkpass')) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||
| 60 | 22 | ▶ | my $cb = sub { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||
| 61 | 22 | my $result = shift; | |||||||||||||||||||||||||||||||||||||
| 62 | 22 | ▶ | unless ($result) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 63 | 19 | $self->set_error($error); | |||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||
| 65 | else { | ||||||||||||||||||||||||||||||||||||||
| 66 | 3 | $self->set_success; | |||||||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||||||||
| 68 | 22 | $user_cb->(); | |||||||||||||||||||||||||||||||||||||
| 69 | 22 | }; | |||||||||||||||||||||||||||||||||||||
| 70 | 22 | $checkpass->($self => { %parts } => $cb ); | |||||||||||||||||||||||||||||||||||||
| 71 | 22 | return; | |||||||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||
| 74 | ## getsecret | ||||||||||||||||||||||||||||||||||||||
| 75 | elsif (my $getsecret = $self->callback('getsecret')) { | ||||||||||||||||||||||||||||||||||||||
| 76 | 2 | ▶ | my $cb = sub { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=14.0
| |||||||||||||||||||||||||||||||||||||||
| 77 | 2 | my $good_pass = shift; | |||||||||||||||||||||||||||||||||||||
| 78 | 2 | ▶ | if ($good_pass && $good_pass eq ($parts{pass} || "")) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition60%3/5
$good_pass and $good_pass eq ($parts{"pass"} || "")
$parts{'pass'} || ''
MC/DC50%1/2
$good_pass and $good_pass eq ($parts{"pass"} || "")
$good_pass
$good_pass eq ($parts{"pass"} || "")
MC/DC0%0/1
$parts{'pass'} || ''
$parts{'pass'}
Truth table66%2/3
A and B
A= $good_passB= $good_pass eq ($parts{"pass"} || "")
Truth table50%1/2
A
A= $parts{'pass'}
| |||||||||||||||||||||||||||||||||||||||
| 79 | 1 | $self->set_success; | |||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||
| 81 | else { | ||||||||||||||||||||||||||||||||||||||
| 82 | 1 | $self->set_error($error); | |||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||
| 84 | 2 | $user_cb->(); | |||||||||||||||||||||||||||||||||||||
| 85 | 2 | }; | |||||||||||||||||||||||||||||||||||||
| 86 | 2 | $getsecret->( $self, { map { $_ => $parts{$_ } } qw/user authname/ }, $cb ); | |||||||||||||||||||||||||||||||||||||
| 87 | 2 | return; | |||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||
| 90 | ## error by default | ||||||||||||||||||||||||||||||||||||||
| 91 | else { | ||||||||||||||||||||||||||||||||||||||
| 92 | 0 | $self->set_error($error); | |||||||||||||||||||||||||||||||||||||
| 93 | 0 | $user_cb->(); | |||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||
| 97 | 5 | 1; | |||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||
| 99 | __END__ | ||||||||||||||||||||||||||||||||||||||