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;
6             $Authen::SASL::Perl::CRAM_MD5::VERSION = '2.1700'; # TRIAL
7 3     3   41 use strict;
  3         6  
  3         90  
8 3     3   14 use warnings;
  3         6  
  3         105  
9 3     3   16 use vars qw($VERSION @ISA);
  3         14  
  3         151  
10 3     3   971 use Digest::HMAC_MD5 qw(hmac_md5_hex);
  3         2850  
  3         758  
11              
12             $VERSION = "2.14";
13             @ISA = qw(Authen::SASL::Perl);
14              
15             my %secflags = (
16             noplaintext => 1,
17             noanonymous => 1,
18             );
19              
20 35     35   71 sub _order { 2 }
21             sub _secflags {
22 14     14   21 shift;
23 14         52 scalar grep { $secflags{$_} } @_;
  4         19  
24             }
25              
26 3     3 0 318 sub mechanism { 'CRAM-MD5' }
27              
28             sub client_start {
29 2     2 0 10 '';
30             }
31              
32             sub client_step {
33 3     3 0 11 my ($self, $string) = @_;
34             my ($user, $pass) = map {
35 3         7 my $v = $self->_call($_);
  6         21  
36 6 100       20 defined($v) ? $v : ''
37             } qw(user pass);
38              
39 3         13 $user . " " . hmac_md5_hex($string,$pass);
40             }
41              
42             1;
43              
44             __END__