*** auth_flat_file	2010-02-18 23:01:28.000000000 +0100
--- ../../../original/qpsmtpd-0.83/plugins/auth/auth_flat_file	2009-04-03 07:48:33.000000000 +0200
***************
*** 1,30 ****
  #!/usr/bin/perl -w
  
  =head1 NAME
  
! auth_flat_file - simple CRAM-MD5 and PLAIN auth plugin using a flat password file
  
  =head1 SYNOPSIS
  
  in config/plugins:
  
!   auth/auth_flat_file [plain] [cram-md5]
  
  in config/flat_auth_pw
  
    username1:password1
    username2:password2
    ...
  
  =head1 DESCRIPTION
  
  This plugin implements a very simple authentication plugin using a flat password
! file containing username and password separated by colons. 
! 
! You can choose whether to support PLAIN and/or CRAM-MD5 authentication 
! mechanisms. Default (no options) is to only support CRAM-MD5.
  
  Note that this plugin enforces the use of a full email address (including
  @domain) as the username. There's no particular reason for this so feel free
  to modify the code to suit your setup.
  
--- 1,27 ----
  #!/usr/bin/perl -w
  
  =head1 NAME
  
! auth_flat_file - simple CRAM MD5 auth plugin using a flat password file
  
  =head1 SYNOPSIS
  
  in config/plugins:
  
!   auth/auth_flat_file
  
  in config/flat_auth_pw
  
    username1:password1
    username2:password2
    ...
  
  =head1 DESCRIPTION
  
  This plugin implements a very simple authentication plugin using a flat password
! file containing username and password separated by colons.
  
  Note that this plugin enforces the use of a full email address (including
  @domain) as the username. There's no particular reason for this so feel free
  to modify the code to suit your setup.
  
***************
*** 32,60 ****
  algorithm so no password is transfered in the clear.
  
  =cut
  
  use Digest::HMAC_MD5 qw(hmac_md5_hex);
- use MIME::Base64;
- 
  
  sub register {
!     my ( $self, $qp, @args) = @_;
!   
!     if (@args > 0) {
!       foreach (@args) {
!         if (($_ eq "cram-md5") or ($_ eq "md5")) {
!           $self->register_hook("auth-cram-md5", "authsql");
!         }
!         if ($_ eq "plain") {
!           $self->register_hook("auth-plain", "authsql");
!         }
!       }
!     }
!     else { # default is just cram-md5
!       $self->register_hook("auth-cram-md5", "authsql");
!     }
  }
  
  sub authsql {
      my ( $self, $transaction, $method, $user, $passClear, $passHash, $ticket ) =
        @_;
--- 29,43 ----
  algorithm so no password is transfered in the clear.
  
  =cut
  
  use Digest::HMAC_MD5 qw(hmac_md5_hex);
  
  sub register {
!     my ( $self, $qp ) = @_;
! 
!     $self->register_hook("auth-cram-md5", "authsql");
  }
  
  sub authsql {
      my ( $self, $transaction, $method, $user, $passClear, $passHash, $ticket ) =
        @_;
***************
*** 70,82 ****
      my ($auth_line) = grep {/^$pw_name\@$pw_domain:/} $self->qp->config('flat_auth_pw');
      
      unless (defined $auth_line) {
          return DECLINED;
      }
! 
      my ($auth_user, $auth_pass) = split(/:/, $auth_line, 2);
! 
      # at this point we can assume the user name matched
      if (
          ( defined $passClear
              and $auth_pass eq $passClear ) or
          ( defined $passHash
--- 53,65 ----
      my ($auth_line) = grep {/^$pw_name\@$pw_domain:/} $self->qp->config('flat_auth_pw');
      
      unless (defined $auth_line) {
          return DECLINED;
      }
!     
      my ($auth_user, $auth_pass) = split(/:/, $auth_line, 2);
!     
      # at this point we can assume the user name matched
      if (
          ( defined $passClear
              and $auth_pass eq $passClear ) or
          ( defined $passHash
