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.      |
--------------------------------------------------


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

Reply via email to