Re: [exim] embedded perl script in Exim.

Pàgina inicial
Delete this message
Reply to this message
Autor: sam wun
Data:  
CC: exim-users
Assumpte: Re: [exim] embedded perl script in Exim.
Hi,

I included perl script in the Main Config section of the exim/configure
file,and now it start to catch the authentication from Outlook 2000.
However, the following authenticator still failed to smtp auth the
authentcation data from Outlook 2000:

login:
    driver              = plaintext
    public_name         = LOGIN
    server_prompts      = Username : Password
    #server_prompts     = <| Username: | Password:
    server_condition    = ${perl {getPw} {$1} {mail} }
    server_set_id       = $1


With different setting of server_promts, the error is the same:
2004-11-07 22:40:55 login authenticator failed for (winserver)
[192.168.9.1]: 535 Incorrect authentication data

The relevant perl script in the Main Config section is:
EXIM_PERL=perl.o

perl_at_start
perl_startup    = \
       use BerkeleyDB ; \
       my $autoTransition      = 0 ; \
       my $defaultRealm        = Exim::expand_string('$primary_hostname'); \
       my %sdb ; \
       my $Sdb = tie %sdb, "BerkeleyDB::Hash", \
               -Filename => "/usr/local/etc/sasldb2", \
               -Flags    => DB_RDONLY \
           or die "Could not tie to /usr/local/etc/sasldb2: $!\n" ; \
                sub makeKey ($$;$) { \
         my ($usr, $key, $realm) = @_ ; \
           $realm = $defaultRealm      unless $realm ; \
           return "${usr}\000${realm}\000${key}" ; \
       } \
       sub getPw   ($;$) { \
           return $sdb{makeKey(shift, 'userPassword', shift)} ; \
       } \
       sub checkPw ($$;$) { \
           use Digest::MD5 ; $m = Digest::MD5->new ; \
           my ($usr, $val, $realm) = @_ ; \
           my $u = makeKey($usr, 'userPassword', $realm) ; \
           system "echo Great > /tmp/eximlog";\
           return ($sdb{$u} eq $val) if  exists $sdb{$u} ; \
           my $p = makeKey($usr, 'cmusaslsecretPLAIN', $realm) ; \
           my $V = $sdb{$p} ; return undef unless $V ; \
           my ($s,$h)=unpack('a16 x a16', $V) ; \
           my $ret = $h eq  $m->add($s, 'sasldb', $val)->digest ; \
           return $ret ; \
       }


I m not a perl expert, how can I debug this per script?

Thanks
Sam