76
76
unsigned int bufsz;
77
77
unsigned int all_whitelisted;
78
78
unsigned int gotbody;
79
unsigned int scanned_count;
80
unsigned int status_count;
82
static void add_x_header(SMFICTX *ctx, char *st) {
83
smfi_chgheader(ctx, (char *)"X-Virus-Scanned", 1, xvirushdr);
84
smfi_chgheader(ctx, (char *)"X-Virus-Status", 1, st);
84
static void add_x_header(SMFICTX *ctx, char *st, unsigned int scanned, unsigned int status) {
85
if(addxvirus == 1) { /* Replace/Yes */
87
if(smfi_chgheader(ctx, (char *)"X-Virus-Scanned", scanned--, NULL) != MI_SUCCESS)
88
logg("^Failed to remove existing X-Virus-Scanned header\n");
90
if(smfi_chgheader(ctx, (char *)"X-Virus-Status", status--, NULL) != MI_SUCCESS)
91
logg("^Failed to remove existing X-Virus-Status header\n");
92
if(smfi_addheader(ctx, (char *)"X-Virus-Scanned", xvirushdr) != MI_SUCCESS)
93
logg("^Failed to add X-Virus-Scanned header\n");
94
if(smfi_addheader(ctx, (char *)"X-Virus-Status", st) != MI_SUCCESS)
95
logg("^Failed to add X-Virus-Status header\n");
97
if(smfi_insheader(ctx, 1, (char *)"X-Virus-Scanned", xvirushdr) != MI_SUCCESS)
98
logg("^Failed to insert X-Virus-Scanned header\n");
99
if(smfi_insheader(ctx, 1, (char *)"X-Virus-Status", st) != MI_SUCCESS)
100
logg("^Failed to insert X-Virus-Status header\n");
201
218
cf->msg_id = strdup(headerv ? headerv : "");
222
if(!strcasecmp(headerf, "X-Virus-Scanned")) cf->scanned_count++;
223
if(!strcasecmp(headerf, "X-Virus-Status")) cf->status_count++;
204
226
if((ret = sendchunk(cf, (unsigned char *)headerf, strlen(headerf), ctx)) != SMFIS_CONTINUE)
206
228
if((ret = sendchunk(cf, (unsigned char *)": ", 2, ctx)) != SMFIS_CONTINUE)
291
313
len = strlen(reply);
292
314
if(len>5 && !strcmp(reply + len - 5, ": OK\n")) {
293
if(addxvirus) add_x_header(ctx, "Clean");
315
if(addxvirus) add_x_header(ctx, "Clean", cf->scanned_count, cf->status_count);
294
316
ret = CleanAction(ctx);
295
317
} else if (len>7 && !strcmp(reply + len - 7, " FOUND\n")) {
296
318
cf->virusname = NULL;
310
332
snprintf(msg, sizeof(msg), "Infected (%s)", vir);
311
333
msg[sizeof(msg)-1] = '\0';
312
add_x_header(ctx, msg);
334
add_x_header(ctx, msg, cf->scanned_count, cf->status_count);
315
337
if(loginfected) {