From: dibo <di...@us...> - 2002-07-03 12:30:36
|
Hello all, I make some improvements and bugfixes in amavis-milter.c from amavisd-new 20020517 and backport it into amavisd 20020531 ( not tested ). Amavisd patch is against patched version ( with patch from amavis-user mailing list http://marc.theaimsgroup.com/?l=amavis-user&m=102364605104887&w=2). You can download patches at http://www.kar.elf.stuba.sk/~dibo/amavis Dibo Changelog: Both AMaViSd and AMaViSd-new - rewriten unlinking of socket at startup of milter in main(). For now socket is unlinked only if -p parameter contains unix:, local: or none prefixes ( if you use inet or inet6 socket you have nothing to delete) - added -x and -X command line parameters -x allow to change x_header_tag and -X change x_header_line, that means we can completly change header line adde when mail was virus free. Example: if you start milter with # amavis-milter -p socket -D -x "X-Virus-Scanned by" -X "AMaViSd-new" milter add this line: X-Virus-Scanned by: AMaViSd-new - milter now store and sent to amavisd name of connected server (from {if_name} sendmail macro), sendmail msgid ( i macro ), client address ( adres of client attached to sendmail from mlfi_connect() callback). I must change clearpriv() function for make this work. I send this additional parameters to amavisd as LDA and LDAARGS because this minimalize changes done in amavisd.in which is different in amavisd and amavisd-new. - changed clearpriv() function to make previous to work. Last startegy was clear whole privilege at end of each message but this was wrong when multiple messages was checked within one connection, because informations stored into privilege was lost after first message. - rewrite of sending parameters in mlfi_eom() callback. I create new function static int sendamavisd(int sock, const char *data, int r ,const char *name) which is universal funkction to send parameter to amavisd and receive OK from amavisd. function return received value or error. I must changed format of retval to EOT to one char (send chr($exit_code) instead of $exit_code) in amavisd and _LDA and _EOT (in amavis-milter.c) to string which cause to only one type of data sended (string) and received (char). Because of protocol change I also change EOT return value handling in amavis-client.c (both amvisd and amavisd-new) and amavis-qmail-client.c (amavisd-new only). This version is better readable I think. Example: Old version - send of one parameter if (r>0) { set variable test variable length send parameter test return code from send } if (r>0){ receive reply } New version - send one parameter set variable sendamavisd(parameters... test return code (optional) AMaViSd-new specific - added %M and %I macros in log lines and notifications. %M represent Server name - this mean name of server which is connected to milter. %I macro represent Client IP - IP of client Connected to SMTP server. - changed get_msg_id subroutine in amavisd.in - if is defined message id from sendmail milter function return this id instead of other (from message headers or amavis message id) - amavisd (only in amavisd-new) now log also virus free messages with first word 'scanned' instead of 'infected' if virus is found. This log line contain sender and recipients adresses, message id, Client IP address and server name. Log line can be changed in amavisd.conf. |