To: Peter Janett Subject: Re: Qmail IMAP AND Pop3 recomendations From: Scott Gifford Date: Tue, 25 Apr 2000 11:38:10 -0400 Cc: qmail@lists.cr.yp.to "Peter Janett" writes: > It's all working OK, but now I need to be able to access the accounts via > IMAP. I have been looking into Courier-IMAP, but if possible, I'd like the > IMAP server to use the same checkpasswd I'm using for POP3 access. I solved this problem with a hack. I wrote a script to run before checkpassword and clean up what imaplogin sends to it, then another program to clean up what checkpassword does and set up the environment how imapd expects it. I start up tcpserver like this. The interesting lines are the preimap.pl, checkpassword, and postimap.pl lines. I also use POP-style bulletins, which is the qmail-popbull line; you may not need it in your environment. ( nohup supervise /var/supervise/qmail/imap.143 \ tcpserver -R -c 100 -v \ -u 400 -g 400 \ 0 143 \ ${exec_prefix}/sbin/imaplogin \ /usr/tools/src/imaptest/preimap.pl \ /var/qmail/bin/checkpassword \ /usr/tools/src/imaptest/postimap.pl \ /var/qmail/bin/qmail-popbull /var/qmail/bulletins \ ${exec_prefix}/bin/imapd Maildir & ) preimap.pl and postimap.pl are as follows: ------preimap.pl--------- #!/usr/local/bin/perl use POSIX; open(AUTHIN,"<&=3"); @lines=; close(AUTHIN); ($fdR,$fdW) = POSIX::pipe() or die "Couldn't create pipe: $!\n"; defined($pid=fork()) or die "Couldn't fork: $!\n"; if (!$pid) { # Child POSIX::dup2(3,$fdR); POSIX::close($fdW); exec(@ARGV); die "Couldn't exec: $!\n"; } open(AUTHOUT,">&=$fdW") or die "Couldn't open fd #$fdW as AUTHOUT: $!\n"; # Ignore first two shift(@lines); shift(@lines); grep(s/\n/\0/,@lines); print AUTHOUT @lines, "Y123456\0"; close(AUTHOUT); #exit(0); ----- -----postimap.pl----- #!/usr/local/bin/perl delete $ENV{AUTHUSER}; $ENV{AUTHADDR}="test\@test"; $ENV{AUTHFULLNAME}=""; delete $ENV{AUTHEXPIRE}; $ENV{AUTHENTICATED}="yes"; exec(@ARGV) or print "exec failed!: $!\n"; -----