File Coverage

blib/lib/Authen/SASL/Perl/CRAM_MD5.pm
Criterion Covered Total %
statement 23 23 100.0
branch 2 2 100.0
condition n/a
subroutine 9 9 100.0
pod 0 3 0.0
total 34 37 91.8


line stmt bran cond sub pod time code
1             # Copyright (c) 2002 Graham Barr . 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::CRAM_MD5 2.2000;
6              
7 3     3   33 use strict;
  3         4  
  3         105  
8 3     3   12 use warnings;
  3         4  
  3         155  
9 3     3   15 use vars qw(@ISA);
  3         4  
  3         179  
10 3     3   984 use Digest::HMAC_MD5 qw(hmac_md5_hex);
  3         3210  
  3         740  
11              
12             warnings::warnif(
13             'deprecated',
14             'The CRAM-MD5 SASL mechanism is effectively deprecated by RFC8314 and should no longer be used'
15             );
16              
17             @ISA = qw(Authen::SASL::Perl);
18              
19             my %secflags = (
20             noplaintext => 1,
21             noanonymous => 1,
22             );
23              
24 33     33   71 sub _order { 2 }
25             sub _secflags {
26 14     14   24 shift;
27 14         51 scalar grep { $secflags{$_} } @_;
  4         14  
28             }
29              
30 3     3 0 344 sub mechanism { 'CRAM-MD5' }
31              
32             sub client_start {
33 2     2 0 8 '';
34             }
35              
36             sub client_step {
37 3     3 0 9 my ($self, $string) = @_;
38             my ($user, $pass) = map {
39 3         6 my $v = $self->_call($_);
  6         25  
40 6 100       18 defined($v) ? $v : ''
41             } qw(user pass);
42              
43 3         9 $user . " " . hmac_md5_hex($string,$pass);
44             }
45              
46             1;
47              
48             __END__