Subject: pkg/34264: mailfront imap authentication fails
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <dl@xiqit.de>
List: pkgsrc-bugs
Date: 08/23/2006 08:20:01
>Number:         34264
>Category:       pkg
>Synopsis:       mailfront imap authentication fails
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Aug 23 08:20:01 +0000 2006
>Originator:     Damian Lubosch
>Release:        NetBSD release 3.0.1 XEN2 domU
>Organization:
Xiqit GmbH
>Environment:
NetBSD domU1 3.0.1 NetBSD 3.0.1 (XENU_pci) #0: Fri Aug 11 15:28:43 CEST 2006  root@:/usr/src/sys/arch/i386/compile/XENU_pci i386
>Description:
I want to set up qmail with pkgsrc/security/cvm (src: untroubled.org) and /pkgsrc/mail/mailfront to have email over pop3 and imap for (virtual)users in virtual domains. 
Authetication over POP3 for cvm-vmailmgrd and mailfront works fine. But if I try to authenticate over IMAP (with courier-imap) it breaks because of a bug in mailfront. The reason for this is bad parsing of the @-character.

Connecting my mail server over POP3 works, but over IMAP it fails because of an authentication error. I think mailfront tries to login with user@mail.domain.com@hostname instead if user@mail.domain.com only.

I attached a possible patch for mailfront which I found on the mailing lists below.

Bye,
Damian.

>How-To-Repeat:

>Fix:
I found following patches in the bgware-Mailinglist which worked for me.
I must admin that I had to exchange the pkgsrc-mailfront.tar.gz by my patched one and ignore the chksum errors...

# diff /usr/local/new/mailfront-0.98.1/imapfront-auth.c /usr/local/new/mailfront-0.98.1-patched/imapfront-auth.c
259c259,264
<     if ((cr = cvm_authenticate_password(cvm, argv[0].s, domain,
---
>       char *vdomain = 0;
>       if ( (vdomain = strchr(argv[0].s, '@')) != '\0' )
>               ++vdomain;
>       else
>               vdomain = domain;
>     if ((cr = cvm_authenticate_password(cvm, argv[0].s, vdomain,


and 


# diff /usr/local/new/mailfront-0.98.1/pop3front-auth.c /usr/local/new/mailfront-0.98.1-patched/pop3front-auth.c
29a30
> #include <string.h>
46c47
<   if (!cvm_setugid() || !cvm_setenv())
---
>   if (!cvm_setugid() || !cvm_setenv() || (setenv("MAILDIR", cvm_fact_mailbox, 1) == -1) )
79c80,85
<     if ((cr = cvm_authenticate_password(cvm, user.s, domain, s->s, 1)) == 0)
---
>       char *vdomain = 0;
>       if ( (vdomain = strchr(user.s, '@')) != '\0' )
>               ++vdomain;
>       else
>               vdomain = domain;
>     if ((cr = cvm_authenticate_password(cvm, user.s, vdomain, s->s, 1)) == 0)