Re: [vchkpw] dot-qmail ordering

2006-05-15 Thread John Simpson

On 2006-05-13, at 1344, Michael Krieger wrote:


I've been browsing the qmailadmin/vpopmail code and see that  
there's no effort to enforce order in dot-qmail files.  Adding  
lines to a dot-qmail file is just an append to the end of the file  
it seems with valias_insert and so on [at least in vpalias it is  
for the files/cdb backend].


I'm looking to add some additional features that depend on order.
...

It's the ability to add in a proper order that I'm curious about.


this has been a known shortcoming of vpopmail for several years- and  
in fact it's worse than you describe. if you're using .qmail-* files,  
the lines in the file are ordered in the same sequence in which they  
were added. however, if you're storing alias information in a sql  
database (which a lot of people seem to want to do) there is NO way  
to force any specific order, since there is no field in the alias  
table to hold a sequence.


Anyone already tried it?  Should I give the code a good hacking?   
See anything else I could affect in doing this? I think it's a  
really valuable feature, and should be easy enough to implement.


this is actually on my list of things to do. it's a non-trivial change:

- the mysql and pgsql table schemas will have to be changed to  
include the new field


- the valias_insert() functions in vpalias.c, vmysql.c, and vpgsql.c  
will have to be changed to include a sequence parameter (i.e. 0  
means insert at the beginning of the file, 1 means to copy one line  
of what's already there before adding the new line, etc... with any  
number greater than the number of lines currently in the file meaning  
to append to the file) and the appropriate code to handle that parameter


- the valias_select*() functions in vpalias.c, vmysql.c, and vpgsql.c  
will have to be changed so that they return the alias lines in the  
proper order- probably no change for vpalias.c, but for the sql-based  
methods, it means adding an ORDER BY clause to the query.


- the valias program will need a command line parameter to specify  
the sequence number when adding an alias.


- we will need a reasonable process to convert people who are  
already using the sql valias table, so that it contains the  
sequence field. i can see is a script which looks through all alias  
lines which have NULL sequences, any aliases which have only one  
line, set that sequence to 0... otherwise (if it has more than one  
item) print the email address, which gives an administrator a list of  
which aliases need to be handled manually (since there is no  
guaranteed existing order.)


- i'm probably forgetting something- anyone?

if you have the time and expertise to write the code, that would be  
awesome... join the vpopmail-devel mailing list and let them know you  
are going to do this. this list (the normal vpopmail list) is geared  
more towards people USING vpopmail instead of people who are WORKING  
ON vpopmail itself, although if you need help testing your patches on  
different types of machines, this list does have a few people who are  
willing to help. (my own systems are centos 3 and centos 4, if that  
helps.)


As a side note, in qmailadmin's autorespond.c, shouldn't these be  
in the opposite order to prevent any temporary failures after  
closing the .qmail file without the message file existing yet?


   * Make the autoresponder .qmail file
   * Make the autoresponder message file


makes sense to me. i don't know if there's a dedicated list for  
qmailadmin developers, i *think* the vpopmail-devel list is used for  
that as well (since the list of developers on both products is almost  
identical.)


--
| John M. Simpson - KG4ZOW - Programmer At Large |
| http://www.jms1.net/   [EMAIL PROTECTED] |
--
| Mac OS X proves that it's easier to make UNIX  |
| pretty than it is to make Windows secure.  |
--




PGP.sig
Description: This is a digitally signed message part


Re: [vchkpw] dot-qmail ordering

2006-05-15 Thread Charlie Garrison
Good morning,

On 15/5/06 at 3:03 PM -0400, John Simpson [EMAIL PROTECTED] wrote:

makes sense to me. i don't know if there's a dedicated list for  
qmailadmin developers, i *think* the vpopmail-devel list is used for  
that as well (since the list of developers on both products is almost  
identical.)

mailto:[EMAIL PROTECTED]


Charlie

-- 
   Charlie Garrison  [EMAIL PROTECTED]
   PO Box 141, Windsor, NSW 2756, Australia


Re: [vchkpw] dot-qmail ordering

2006-05-15 Thread Rick Widmer

Charlie Garrison wrote:


Good morning,

On 15/5/06 at 3:03 PM -0400, John Simpson [EMAIL PROTECTED] wrote:


makes sense to me. i don't know if there's a dedicated list for  
qmailadmin developers, i *think* the vpopmail-devel list is used for  
that as well (since the list of developers on both products is almost  
identical.)



mailto:[EMAIL PROTECTED]


Actually that is for qmailadm users.  Developers should use 
qmailadmin-devel at:


http://sourceforge.net/mail/?group_id=6691

You should probably also watch vpopmail-devel as the two projects are 
very tightly coupled.




Re: [vchkpw] dot-qmail ordering

2006-05-15 Thread Tom Collins

On May 13, 2006, at 10:44 AM, Michael Krieger wrote:
As a side note, in qmailadmin's autorespond.c, shouldn't these be in 
the opposite order to prevent any temporary failures after closing the 
.qmail file without the message file existing yet?


   * Make the autoresponder .qmail  file
   * Make the autoresponder message file


Good point -- I've put it in my todo queue for the next QmailAdmin 
release.


--
Tom Collins  -  [EMAIL PROTECTED]
QmailAdmin: http://qmailadmin.sf.net/  Vpopmail: http://vpopmail.sf.net/



[vchkpw] dot-qmail ordering

2006-05-13 Thread Michael Krieger
Hi Folks,I've been browsing the qmailadmin/vpopmail code and see that there's no effort to enforce order in dot-qmail files. Adding lines to a dot-qmail file is just an append to the end of the file it seems with valias_insert and so on [at least in vpalias it is for the files/cdb backend].I'm looking to add some additional features that depend on order. The main one is a script I've written that checks for existing Spam headers, and should they not exist, checks the mail through SpamAssassin's spamc and exits 99 to stop processing the dot-qmail file or exits cleanly.The reasoning for this is that I want Maildir delivery's first, delivering properly to the user in question. I then want to run my |ifnotspam command. If it exits 99 (yes it's definately Spam), I don't want to forward the mail, and don't want to autorespond to it. Yes I realize this isn't perfect and may have the occasional bit of real mail not
 forwarded. Even more important is the autoresponding, as I find users who set vacation messages can often have hundreds of e-mails per day, many of which are Spam.Some users have spam scanning with Simscan, but others don't and don't want it. At the same time, I don't want to forward or autorespond (with the mail attached) to mail that if SA thinks will be Spam, so will other major providers.Now the reasoning isn't too bad, but it depends on the following:1. vpopmail sorting .qmail and .qmail-* files after it writes them -OR- vpopmail inserting lines in the right place as opposed to appending2. qmailadmin having a 'add before remote' option that will, if autorespond/forward is set, add a customized line to the dot-qmail file in the right place [using the abilities above] of properly ordering dot-qmail files.Obviously both would need to take into account extra
 things like keeping maildrop and any custom commands above the |ifnotspam command.Now the second part I don't see as too difficult, as it could check using the valias_* functions to see if the command already exists, and if not add it [as well as remove it in the case of removing a forward/autoresponder, just to clean up]. This would just be adding an extra valias_insert call with a fixed define.It's the ability to add in a proper order that I'm curious about. Anyone already tried it? Should I give the code a good hacking? See anything else I could affect in doing this?I think it's a really valuable feature, and should be easy enough to implement.-=-=-=-=-As a side note, in qmailadmin's autorespond.c, shouldn't these be in the opposite order to prevent any temporary failures after closing the .qmail file without the message file existing yet? * Make the autoresponder .qmail
 file * Make the autoresponder message file-M