Wenn Du das Howto richtig gelesen hast, dann wäre Dir dieser Link nicht entgangen:
Code:
#!/usr/bin/perl
use FindBin;
use lib "$FindBin::Bin/";
require 'ispcp_common_code.pl';
use strict;
use warnings;
use Sys::Syslog;
my $tempErr = 111;
my $Err = 1;
my $local_part_dir = "$main::cfg{'MTA_VIRTUAL_MAIL_DIR'}";
my $uid = $main::cfg{'MTA_MAILBOX_UID'};
my $gid = $main::cfg{'MTA_MAILBOX_GID'};
my $real_password = '';
my($size, $data) = (undef,undef);
my($username, $password, $timestamp, $rest) = (undef, undef, undef, undef);
my $ip = "unknown ip";
my $server = "unknown";
if (defined $ENV{'TCPREMOTEIP'}){
$ip = $ENV{'TCPREMOTEIP'};
}
if (defined $ENV{'SERVICE'}){
$server = $ENV{'SERVICE'};
}
openlog("dovecot","ndelay,perror","mail");
if( open (HANDLER, "<&=3")) {
$size = read(HANDLER, $data, 512);
close HANDLER;
} else {
syslog('err', 'No data read during login for %s from %s to %s server', $username, $ip, $server);
exit ($tempErr);
}
if ($size < 4) {
syslog('err', 'Invalid data read during login for %s from %s to %s server', $username, $ip, $server);
exit($tempErr);
}
($username, $password, $timestamp, $rest) = split(/\0/,$data);
if ($username =~ /^(([a-z0-9\-_]+\.?)+)@(([a-z0-9\-]+\.?)+)$/) {
$local_part_dir = "$local_part_dir/$3/$1";
} else {
syslog('info', 'Bad username "%s" from %s to %s server', $username, $ip, $server);
exit($Err);
}
my $sql = "SELECT mail_pass, mail_addr FROM mail_users WHERE mail_pass != '_no_' AND mail_addr='$username'";
my ($rs, $rows) = doSQL($sql);
if ($rs != 0){
syslog('err', 'Can`t execute sql %s during login for %s from %s to %s server', $sql, $username, $ip, $server);
exit($tempErr);
}
my $line = @$rows[0];
($rs,$real_password) = decrypt_db_password(@$line[0]);
if ($rs != 0){
syslog('err', 'Internal error while decrypting password for username %s from %s for %s server', $username, $ip, $server);
exit($tempErr);
}
if ($password ne $real_password) {
syslog('info', 'Bad password for username %s from %s for %s server', $username, $ip, $server);
exit($Err);
}
if (open (HANDLER, ">>&=4")) {
printf (HANDLER "userdb_user=%s\tuserdb_home=%s\tuserdb_uid=%s\tuserdb_gid=%s\tuserdb_mail=%s\t",
$username, $local_part_dir, $uid, $gid, "maildir:$local_part_dir");
close HANDLER;
} else {
syslog('err', 'Failed returning data during login for %s from %s to %s server', $username, $ip, $server);
exit($tempErr);
}
exit(0);