On 2009-02-26, at 0708, Robert Schulze wrote:
could it be, that vpopmail with qmail-ext compile option is the
enemy here? I looked at the code from vdelivermail.c and it seems
that qmail-ext disables processing of .qmail when there is a dash
in the recip-address, instead it searches for .qmail-ext and
falls back to .qmail-default.
the problem is this... assuming the email address is one-two-three-f...@domain.xyz
.
right now, vdelivermail scans the string from left to right, looking
for - characters. when it finds one, it splits the name and that's
the end of the process. so in this example, it treats one as the
mailbox name, and two-three-four as the extension.
what it SHOULD do is this: scan from right to left, and when it finds
one, check the portion to the left to see if it's a valid mailbox
name. if so, it's done, otherwise keep going. so in this example, it
should:
(1) check one-two-three-four to see if that's a valid mailbox. if
so, there is no extension.
(2) check one-two-three to see if that's a valid mailbox. if so,
four is the extension.
(3) check one-two to see if that's a valid mailbox. if so, three-
four is the extension.
(4) check one to see if that's a valid mailbox. if so, two-three-
four is the extension.
(5) fall back to the catchall directions.
i'm looking at vdelivermail.c from vpopmail-5.4.26d.tar.gz, the
comment on lines 219-222 basically say the same thing i've explained
above.
still looking at the code, i'm seeing a few things which... to be
diplomatic, let's just say i would have done them a little bit
differently. for example, the comment on line 64 isn't very clear- it
should probably say TheUser with '-' and extension (if any) removed,
and i probably would have named the variable TheMailbox instead of
TheUserExt. the name TheUserExt makes me think that's the version
WITH the extension, rather than the version WITHOUT it. however, this
is mostly a cosmetic issue for people who work with the code.
more importantly, i also don't think get_arguments() is the right
place to parse for - in the address to begin with... i think the
whole block from lines 218-237 could be removed, and the scanning done
in main(), using something like this as a replacement for the existing
block at line 139-156.
/* try to get the user from vpopmail database */
vpw = vauth_getpw ( TheUser , TheDomain ) ;
#ifdef QMAIL_EXT
/* scan for a possible extension */
if ( ! vpw )
{
/* start at the end of the string */
int i = 0 ;
while ( TheUser[i] ) { i++ ; }
/* work backwards */
while ( --i )
{
if ( '-' == TheUser[i] )
{
/* split here and check the left part */
TheUser[i] = 0 ;
vpw = vauth_getpw ( TheUser , TheDomain ) ;
/* if it IS a valid mailbox name... */
if ( vpw )
{
/* remember right side as TheExt */
strncpy ( TheExt , (TheUser[i+1]) , AUTH_SIZE ) ;
/* restore the original name */
TheUser[i] = '-' ;
/* store first i chars of original name in
TheUserExt */
strncpy ( TheUserExt , TheUser , i ) ;
TheUserExt[i] = 0 ;
/* stop scanning */
break ;
}
/* not a valid mailbox name, restore the original
value */
TheUser[i] = '-' ;
}
}
}
#endif
if ( vpw )
checkuser() ;
else
usernotfound() ;
i haven't compiled or tested this, but the basic idea seems sound...
and as long as this code runs before anything else tries to use
TheUserExt or TheExt (i haven't walked the entire program but i'm
pretty sure it does) the change shouldn't affect any other parts of
the code at all, other than accurately detecting where the mailbox
name ends and the extension begins.
i see tom is on this list as well- any comments? am i missing
something stupid? should we move this discussion to the vpopmail (or
vpopmail-devel) list?
| John M. Simpson--- KG4ZOW ---Programmer At Large |
| http://www.jms1.net/ j...@jms1.net |
| http://video.google.com/videoplay?docid=-1656880303867390173 |
PGP.sig
Description: This is a digitally signed message part
!DSPAM:49a86daa32688907320734!