Re: [qmailadmin] problem with copy+forward

2009-03-01 Thread Tom Collins

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Feb 27, 2009, at 2:47 PM, John Simpson wrote:
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?




I made a lot of changes to vdelivermail somewhere in the 5.4 branch,  
but I avoided making changes to the code you referenced.  It was hard  
to follow, and I wasn't even sure how I would go about testing it.


We should move the discussion over to the vpopmail-devel list.   
vpopmail has a new maintainer now, so it shouldn't be hard to get  
your proposed changes into the next release.  Reading through your  
email, I'd say your logic makes sense -- scanning should happen from  
the end of the name, not the start.


- -Tom



-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (Darwin)

iD8DBQFJqtdHve7eT9VwhJURAsXGAJ9kmD6DpDetLlnALB6HG7/k3OcItwCfW70s
7i11c/u8Bb6nW3zoMJhOd1c=
=0zCM
-END PGP SIGNATURE-

!DSPAM:49aad77232681552610396!



Re: [qmailadmin] problem with copy+forward

2009-02-27 Thread John Simpson

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!

Re: [qmailadmin] problem with copy+forward

2009-02-26 Thread Robert Schulze

Hi,

thanks for this comprehensive answer!

There is one thing I wonder about: When using vpopmail+mysql, all 
aliases are stored in the valias-table. If qmailadmin adds a 
forward/alias, then all changes have to be done in the RDBMS, not in the 
filesystem via .qmail-files. These should be done via the same functions 
valias.c uses.


Is qmailadmin not fully vpopmail-API compatible or is there a special 
compile option which we did accidentially not set?


with kind regards,
Robert Schulze

!DSPAM:49a675b332681645874909!



Re: [qmailadmin] problem with copy+forward

2009-02-26 Thread Robert Schulze

Hi once again,

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.


We had a mailserver-update short time before, problems with aliases 
started from then...


Sorry, that I ask this vpopmail question here in ML for qmailadmin...

Robert Schulze

!DSPAM:49a6862632687848621355!



Re: [qmailadmin] problem with copy+forward

2009-02-25 Thread Matt Brookings
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Robert Schulze wrote:
 Is this a bug with qmailadmin? Could this generally be fixed by always
 using .qmail-user files in the domain directory?

This is not related to qmailadmin.  qmailadmin is simply configuring a forward 
for you.
The problem lies somewhere in your qmail/vpopmail installation.
- --
/*
Matt Brookings m...@inter7.com   GnuPG Key D9414F70
Software developer Systems technician
Inter7 Internet Technologies, Inc. (815)776-9465
*/
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkmlXuAACgkQ6QgvSNlBT3D1MQCglTDXlBdCVSymNxS6+EdOtQ2v
4bYAnAjPP778D/nN9wb+0Z8KqU+Zgx6w
=YAev
-END PGP SIGNATURE-