My travels have finally brought me to the MySQL database module... I am working on improving the error messages returned by vconvert, as part of the process of testing the MySQL back end.
The first thing I've noticed is that a number of errors call fprintf(stderr) directly from the extension. I would like to make them record the error in a string, set errori and return the error code where it is apropriate. Then I have to look at the places it is called and update the error handling there. I would prefer to leave the formatting of error messages up to the end user program: ~vpopmail/bin/*, qmailadmin, etc.
At first glance, it appers that vpalias.c, vmysql.c and vpgsql.c share
common functions. It seems to me that if the code is in vmysql.c and
vpgsql.c it should also appear in vcdb.c and vpalias.c should not exist.
It looks like there is some ifdef magic going on to hide the code in
this file. It seems to me it would be better to add vpalias.c to vcdb.c
and add empty function definitions in the other auth back-ends. Ifdefs would remain so you can still switch valias on or off with a ./configure option.
Should I move it to cdb.c?
Next, there are two programs vconvert and dotqmail2valias that both
translate data from file to database, or from database to file. Should I merge the programs into one. Future conversions would then be one step. If the users or aliases have already been converted, you just get duplicate warnings.