Serge Vakulenko wrote:
> There is a big difference though.
> With my patch, the client host name and IP address are always known.
> No matter what variables to pass to clamav-milter are configured in
> sendmail.cf.
Some time ago I ask about add third type variable in template:
clamav-milter specific... :-) Patch in attach make avaliable
using template
===
The message $i$ sent from <${mail_addr}$> to
<${rcpt_addr}$>
contained a virus and has not been delivered.
%v found.
Scanning engine:
&full_version&
----- The original (infected) message headers were:
&localreceived&
&header&
===
Some variables in this patch can be removed (&v& and &header&), but
&localreceived& RFC-style addons for header... I think what this
patch will be include in Alt Linux Sisyphus in next update of
ClamAV package.
--
Regards,
Sergey
--- clamav-milter/clamav-milter.c.orig 2004-09-18 01:06:32 +0500
+++ clamav-milter/clamav-milter.c 2004-09-18 13:40:33 +0500
@@ -3517,6 +3517,64 @@
ptr = end;
break;
}
+ case '&': /* clamav-milter variables */ {
+ char *end = strchr(++ptr, '&');
+
+ if(end == NULL) {
+ syslog(LOG_ERR,
+ _("%s: Unterminated clamav-milter variable \"%s\"\n"),
+ filename, ptr);
+ continue;
+ }
+ *end = '\0';
+
+ /* begin variables definitions */
+ // Virus name, replacement for %v, may be not need
+ if ( strcmp(ptr, "v") == 0 ) {
+ fputs(virusname, sendmail);
+ } // end of v
+ // Header, , replacement for %h, may be not need
+ else if ( strcmp(ptr, "header") == 0) {
+ struct privdata *privdata = (struct privdata *)smfi_getpriv(ctx);
+ header_list_print(privdata->headers, sendmail);
+ } // end of header
+ // ClamAV/clamav-milter version
+ else if ( strcmp(ptr, "full_version") == 0) {
+ fputs(clamav_version, sendmail);
+ } // end of clamav_version
+ // Local Received aadons for header
+ else if ( strcmp(ptr, "localreceived") == 0) {
+ char *s_relay, *helo;
+ char timestring[128];
+ time_t systime;
+
+ s_relay = smfi_getsymval(ctx, "{_}");
+ if (!s_relay) s_relay = "";
+ helo = smfi_getsymval(ctx, "s");
+ if (!helo) {
+ helo = "NOHELO";
+ if(use_syslog)
+ syslog(LOG_WARNING, _("Variable \"s\" isn't defined in Milter.macros.eom\n"));
+ }
+
+ systime = time(NULL);
+ strftime(timestring, sizeof(timestring) -1, "%a, %d %b %Y %T %z (%Z)",
+ localtime(&systime));
+
+ fprintf(sendmail, "Received: from %s (%s)", helo, s_relay);
+ fprintf(sendmail, "\n\tby %s (clamav-milter %s) with id %s;",
+ smfi_getsymval(ctx, "j"), CM_VERSION, smfi_getsymval(ctx, "i"));
+ fprintf(sendmail, "\n\t%s", timestring);
+
+ } // localreceived
+ else {
+ fprintf(sendmail, "[unknown clamav-milter's variable: %s]", ptr);
+ if(use_syslog)
+ syslog(LOG_ERR, _("%s: Unknown clamav-milter's variable \"%s\"\n"),
+ filename, ptr);
+ } // end variables definitions
+ ptr = end;
+ } break;
case '\\':
if(*++ptr == '\0') {
--ptr;
_______________________________________________
http://lists.clamav.net/cgi-bin/mailman/listinfo/clamav-devel