Rspamd: add $authenticated_id as User to scan command
[exim.git] / src / src / spam.c
CommitLineData
8523533c
TK
1/*************************************************
2* Exim - an Internet mail transport agent *
3*************************************************/
4
5/* Copyright (c) Tom Kistner <tom@duncanthrax.net> 2003-???? */
6/* License: GPL */
7
8/* Code for calling spamassassin's spamd. Called from acl.c. */
9
10#include "exim.h"
11#ifdef WITH_CONTENT_SCAN
12#include "spam.h"
13
14uschar spam_score_buffer[16];
15uschar spam_score_int_buffer[16];
16uschar spam_bar_buffer[128];
c5f280e2 17uschar spam_action_buffer[32];
8523533c
TK
18uschar spam_report_buffer[32600];
19uschar prev_user_name[128] = "";
20int spam_ok = 0;
21int spam_rc = 0;
f7274286 22uschar *prev_spamd_address_work = NULL;
8523533c 23
fd4d8871 24static const uschar * loglabel = US"spam acl condition:";
8523533c 25
23763898 26
fd4d8871
R
27static int
28spamd_param_init(spamd_address_container *spamd)
29{
30/* default spamd server weight, time and backup value */
fd4d8871
R
31spamd->is_failed = FALSE;
32spamd->is_backup = FALSE;
8a512ed5
JH
33spamd->weight = SPAMD_WEIGHT;
34spamd->timeout = SPAMD_TIMEOUT;
35spamd->retry = 0;
fd4d8871
R
36return 0;
37}
8523533c 38
8523533c 39
fd4d8871
R
40static int
41spamd_param(const uschar *param, spamd_address_container *spamd)
42{
43static int timesinceday = -1;
23763898 44const uschar * s;
8a512ed5 45const uschar * name;
fd4d8871
R
46
47/* check backup parameter */
48if (Ustrcmp(param, "backup") == 0)
49 {
50 spamd->is_backup = TRUE;
51 return 0; /* OK */
52 }
53
54/*XXX more clever parsing could discard embedded spaces? */
55
56/* check weight parameter */
57if (sscanf(param, "weight=%u", &spamd->weight))
58 {
59 if (spamd->weight == 0) /* this server disabled: skip it */
60 return 1;
61 return 0; /* OK */
62 }
63
64/* check time parameter */
23763898 65if (Ustrncmp(param, "time=", 5) == 0)
fd4d8871
R
66 {
67 unsigned int start_h = 0, start_m = 0, start_s = 0;
68 unsigned int end_h = 24, end_m = 0, end_s = 0;
69 unsigned int time_start, time_end;
23763898 70 const uschar * end_string;
fd4d8871 71
8a512ed5 72 name = US"time";
23763898
JH
73 s = param+5;
74 if ((end_string = Ustrchr(s, '-')))
ddcf2b5f 75 {
23763898
JH
76 end_string++;
77 if ( sscanf(CS end_string, "%u.%u.%u", &end_h, &end_m, &end_s) == 0
78 || sscanf(CS s, "%u.%u.%u", &start_h, &start_m, &start_s) == 0
79 )
8a512ed5 80 goto badval;
f7274286 81 }
f7274286 82 else
8a512ed5 83 goto badval;
8523533c 84
fd4d8871 85 if (timesinceday < 0)
ddcf2b5f 86 {
fd4d8871
R
87 time_t now = time(NULL);
88 struct tm *tmp = localtime(&now);
89 timesinceday = tmp->tm_hour*3600 + tmp->tm_min*60 + tmp->tm_sec;
90 }
8e669ac1 91
fd4d8871
R
92 time_start = start_h*3600 + start_m*60 + start_s;
93 time_end = end_h*3600 + end_m*60 + end_s;
8e669ac1 94
fd4d8871
R
95 if (timesinceday < time_start || timesinceday >= time_end)
96 return 1; /* skip spamd server */
c5f280e2 97
fd4d8871
R
98 return 0; /* OK */
99 }
8e669ac1 100
fd4d8871
R
101if (Ustrcmp(param, "variant=rspamd") == 0)
102 {
103 spamd->is_rspamd = TRUE;
104 return 0;
105 }
8e669ac1 106
23763898
JH
107if (Ustrncmp(param, "tmo=", 4) == 0)
108 {
109 int sec = readconf_readtime((s = param+4), '\0', FALSE);
8a512ed5 110 name = US"timeout";
23763898 111 if (sec < 0)
8a512ed5
JH
112 goto badval;
113 spamd->timeout = sec;
114 return 0;
115 }
116
117if (Ustrncmp(param, "retry=", 6) == 0)
118 {
119 int sec = readconf_readtime((s = param+6), '\0', FALSE);
120 name = US"retry";
121 if (sec < 0)
122 goto badval;
123 spamd->retry = sec;
23763898
JH
124 return 0;
125 }
126
fd4d8871
R
127log_write(0, LOG_MAIN, "%s warning - invalid spamd parameter: '%s'",
128 loglabel, param);
129return -1; /* syntax error */
8a512ed5
JH
130
131badval:
132 log_write(0, LOG_MAIN,
133 "%s warning - invalid spamd %s value: '%s'", loglabel, name, s);
134 return -1; /* syntax error */
fd4d8871 135}
8523533c 136
8523533c 137
fd4d8871
R
138static int
139spamd_get_server(spamd_address_container **spamds, int num_servers)
140{
141unsigned int i;
142long rnd, weights = 0;
143static BOOL srandomed = 0;
144BOOL usebackup = FALSE;
145
146for (;;)
147 {
148 /* seedup, if we have only 1 server */
149 if (num_servers == 1)
150 return (spamds[0]->is_failed ? -1 : 0);
151
152 /* init ranmod */
153 if (!srandomed)
154 {
155 struct timeval tv;
156 gettimeofday(&tv, NULL);
157 srandom((unsigned int)(tv.tv_usec/1000));
158 srandomed = TRUE;
159 }
8e669ac1 160
fd4d8871
R
161 /* get sum of all weights */
162 for (i = 0; i < num_servers; i++)
163 if (!spamds[i]->is_failed && spamds[i]->is_backup == usebackup)
164 weights += spamds[i]->weight;
8e669ac1 165
fd4d8871
R
166 if (weights != 0)
167 break;
168 if (usebackup) /* all servers failed (backups too) */
169 return -1;
170 usebackup = TRUE;
171 }
8e669ac1 172
fd4d8871 173rnd = random() % weights;
8e669ac1 174
fd4d8871
R
175for (i = 0; i < num_servers; i++)
176 if (!spamds[i]->is_failed && spamds[i]->is_backup == usebackup)
177 if ((rnd -= spamds[i]->weight) < 0)
178 return i;
29cfeb94 179
fd4d8871
R
180log_write(0, LOG_MAIN|LOG_PANIC,
181 "%s unknown error (memory/cpu corruption?)", loglabel);
182return -1;
183}
29cfeb94 184
29cfeb94 185
fd4d8871 186int
55414b25 187spam(const uschar **listptr)
fd4d8871
R
188{
189int sep = 0;
55414b25 190const uschar *list = *listptr;
fd4d8871
R
191uschar *user_name;
192uschar user_name_buffer[128];
193unsigned long mbox_size;
194FILE *mbox_file;
195int spamd_sock = -1;
196uschar spamd_buffer[32600];
197int i, j, offset, result;
fd4d8871
R
198uschar spamd_version[8];
199uschar spamd_short_result[8];
200uschar spamd_score_char;
201double spamd_threshold, spamd_score, spamd_reject_score;
202int spamd_report_offset;
203uschar *p,*q;
204int override = 0;
205time_t start;
206size_t read, wrote;
207struct sockaddr_un server;
208#ifndef NO_POLL_H
209struct pollfd pollfd;
210#else /* Patch posted by Erik ? for OS X */
211struct timeval select_tv; /* and applied by PH */
212fd_set select_fd;
213#endif
214uschar *spamd_address_work;
8a512ed5 215spamd_address_container * sd;
fd4d8871
R
216
217/* stop compiler warning */
218result = 0;
219
220/* find the username from the option list */
221if ((user_name = string_nextinlist(&list, &sep,
222 user_name_buffer,
223 sizeof(user_name_buffer))) == NULL)
224 {
225 /* no username given, this means no scanning should be done */
226 return FAIL;
227 }
228
229/* if username is "0" or "false", do not scan */
230if ( (Ustrcmp(user_name,"0") == 0) ||
231 (strcmpic(user_name,US"false") == 0) )
232 return FAIL;
233
234/* if there is an additional option, check if it is "true" */
235if (strcmpic(list,US"true") == 0)
236 /* in that case, always return true later */
237 override = 1;
238
239/* expand spamd_address if needed */
240if (*spamd_address == '$')
241 {
242 spamd_address_work = expand_string(spamd_address);
243 if (spamd_address_work == NULL)
244 {
245 log_write(0, LOG_MAIN|LOG_PANIC,
246 "%s spamd_address starts with $, but expansion failed: %s",
247 loglabel, expand_string_message);
248 return DEFER;
29cfeb94 249 }
fd4d8871
R
250 }
251else
252 spamd_address_work = spamd_address;
253
254HDEBUG(D_acl) debug_printf("spamd: addrlist '%s'\n", spamd_address_work);
255
256/* check if previous spamd_address was expanded and has changed. dump cached results if so */
257if ( spam_ok
258 && prev_spamd_address_work != NULL
259 && Ustrcmp(prev_spamd_address_work, spamd_address_work) != 0
260 )
261 spam_ok = 0;
262
263/* if we scanned for this username last time, just return */
264if (spam_ok && Ustrcmp(prev_user_name, user_name) == 0)
265 return override ? OK : spam_rc;
266
267/* make sure the eml mbox file is spooled up */
268mbox_file = spool_mbox(&mbox_size, NULL);
269
270if (mbox_file == NULL)
271 {
272 /* error while spooling */
273 log_write(0, LOG_MAIN|LOG_PANIC,
274 "%s error while creating mbox spool file", loglabel);
275 return DEFER;
276 }
277
278start = time(NULL);
279
280 {
281 int num_servers = 0;
282 int current_server;
283 uschar *address;
55414b25 284 const uschar *spamd_address_list_ptr = spamd_address_work;
fd4d8871 285 spamd_address_container * spamd_address_vector[32];
fd4d8871
R
286
287 /* Check how many spamd servers we have
288 and register their addresses */
289 while ((address = string_nextinlist(&spamd_address_list_ptr, &sep,
290 NULL, 0)) != NULL)
ddcf2b5f 291 {
55414b25 292 const uschar * sublist;
fd4d8871
R
293 int sublist_sep = -(int)' '; /* default space-sep */
294 unsigned args;
295 uschar * s;
fd4d8871
R
296
297 HDEBUG(D_acl) debug_printf("spamd: addr entry '%s'\n", address);
2aad5761 298 sd = (spamd_address_container *)store_get(sizeof(spamd_address_container));
fd4d8871 299
2aad5761 300 for (sublist = address, args = 0, spamd_param_init(sd);
fd4d8871
R
301 s = string_nextinlist(&sublist, &sublist_sep, NULL, 0);
302 args++
303 )
ddcf2b5f 304 {
8a512ed5 305 HDEBUG(D_acl) debug_printf("spamd: addr parm '%s'\n", s);
fd4d8871
R
306 switch (args)
307 {
2aad5761 308 case 0: sd->hostspec = s;
fd4d8871
R
309 if (*s == '/') args++; /* local; no port */
310 break;
2aad5761
JH
311 case 1: sd->hostspec = string_sprintf("%s %s", sd->hostspec, s);
312 break;
313 default: spamd_param(s, sd);
314 break;
fd4d8871 315 }
ddcf2b5f 316 }
fd4d8871 317 if (args < 2)
c5f280e2 318 {
fd4d8871
R
319 log_write(0, LOG_MAIN,
320 "%s warning - invalid spamd address: '%s'", loglabel, address);
321 continue;
c5f280e2 322 }
8523533c 323
2aad5761 324 spamd_address_vector[num_servers] = sd;
fd4d8871
R
325 if (++num_servers > 31)
326 break;
8523533c
TK
327 }
328
fd4d8871
R
329 /* check if we have at least one server */
330 if (!num_servers)
ddcf2b5f 331 {
0f501486 332 log_write(0, LOG_MAIN|LOG_PANIC,
fd4d8871
R
333 "%s no useable spamd server addresses in spamd_address configuration option.",
334 loglabel);
8acbb134 335 goto defer;
ddcf2b5f 336 }
0f501486 337
8a512ed5
JH
338 current_server = spamd_get_server(spamd_address_vector, num_servers);
339 sd = spamd_address_vector[current_server];
340 for(;;)
ddcf2b5f 341 {
2aad5761 342 uschar * errstr;
8523533c 343
2aad5761 344 debug_printf("trying server %s\n", sd->hostspec);
fd4d8871 345
8a512ed5
JH
346 for (;;)
347 {
348 if ( (spamd_sock = ip_streamsocket(sd->hostspec, &errstr, 5)) >= 0
349 || sd->retry <= 0
350 )
351 break;
352 debug_printf("server %s: retry conn\n", sd->hostspec);
353 while (sd->retry > 0) sd->retry = sleep(sd->retry);
354 }
355 if (spamd_sock >= 0)
2aad5761 356 break;
25257489 357
2aad5761
JH
358 log_write(0, LOG_MAIN, "%s spamd: %s", loglabel, errstr);
359 sd->is_failed = TRUE;
25257489 360
2aad5761
JH
361 current_server = spamd_get_server(spamd_address_vector, num_servers);
362 if (current_server < 0)
fd4d8871 363 {
8a512ed5 364 log_write(0, LOG_MAIN|LOG_PANIC, "%s all spamd servers failed", loglabel);
2aad5761 365 goto defer;
fd4d8871 366 }
8a512ed5 367 sd = spamd_address_vector[current_server];
ddcf2b5f 368 }
fd4d8871 369 }
8523533c 370
fd4d8871
R
371if (spamd_sock == -1)
372 {
373 log_write(0, LOG_MAIN|LOG_PANIC,
374 "programming fault, spamd_sock unexpectedly unset");
8acbb134 375 goto defer;
fd4d8871
R
376 }
377
378(void)fcntl(spamd_sock, F_SETFL, O_NONBLOCK);
379/* now we are connected to spamd on spamd_sock */
8a512ed5 380if (sd->is_rspamd)
fd4d8871
R
381 { /* rspamd variant */
382 uschar *req_str;
6c54be64
AL
383 const uschar * helo;
384 const uschar * fcrdns;
385 const uschar * authid;
fd4d8871
R
386
387 req_str = string_sprintf("CHECK RSPAMC/1.3\r\nContent-length: %lu\r\n"
388 "Queue-Id: %s\r\nFrom: <%s>\r\nRecipient-Number: %d\r\n", mbox_size,
389 message_id, sender_address, recipients_count);
390 for (i = 0; i < recipients_count; i ++)
391 req_str = string_sprintf("%sRcpt: <%s>\r\n", req_str, recipients_list[i].address);
392 if ((helo = expand_string(US"$sender_helo_name")) != NULL && *helo != '\0')
393 req_str = string_sprintf("%sHelo: %s\r\n", req_str, helo);
394 if ((fcrdns = expand_string(US"$sender_host_name")) != NULL && *fcrdns != '\0')
395 req_str = string_sprintf("%sHostname: %s\r\n", req_str, fcrdns);
396 if (sender_host_address != NULL)
397 req_str = string_sprintf("%sIP: %s\r\n", req_str, sender_host_address);
6c54be64
AL
398 if ((authid = expand_string(US"$authenticated_id")) != NULL && *authid != '\0')
399 req_str = string_sprintf("%sUser: %s\r\n", req_str, authid);
fd4d8871
R
400 req_str = string_sprintf("%s\r\n", req_str);
401 wrote = send(spamd_sock, req_str, Ustrlen(req_str), 0);
402 }
6c54be64 403else
fd4d8871
R
404 { /* spamassassin variant */
405 (void)string_format(spamd_buffer,
406 sizeof(spamd_buffer),
407 "REPORT SPAMC/1.2\r\nUser: %s\r\nContent-length: %ld\r\n\r\n",
408 user_name,
409 mbox_size);
410 /* send our request */
411 wrote = send(spamd_sock, spamd_buffer, Ustrlen(spamd_buffer), 0);
412 }
6c54be64 413
fd4d8871
R
414if (wrote == -1)
415 {
416 (void)close(spamd_sock);
417 log_write(0, LOG_MAIN|LOG_PANIC,
418 "%s spamd send failed: %s", loglabel, strerror(errno));
8acbb134 419 goto defer;
fd4d8871
R
420 }
421
422/* now send the file */
423/* spamd sometimes accepts conections but doesn't read data off
424 * the connection. We make the file descriptor non-blocking so
425 * that the write will only write sufficient data without blocking
426 * and we poll the desciptor to make sure that we can write without
427 * blocking. Short writes are gracefully handled and if the whole
428 * trasaction takes too long it is aborted.
429 * Note: poll() is not supported in OSX 10.2 and is reported to be
430 * broken in more recent versions (up to 10.4).
431 */
432#ifndef NO_POLL_H
433pollfd.fd = spamd_sock;
434pollfd.events = POLLOUT;
435#endif
436(void)fcntl(spamd_sock, F_SETFL, O_NONBLOCK);
437do
438 {
439 read = fread(spamd_buffer,1,sizeof(spamd_buffer),mbox_file);
440 if (read > 0)
ddcf2b5f 441 {
fd4d8871
R
442 offset = 0;
443again:
444#ifndef NO_POLL_H
445 result = poll(&pollfd, 1, 1000);
8523533c 446
fd4d8871
R
447/* Patch posted by Erik ? for OS X and applied by PH */
448#else
449 select_tv.tv_sec = 1;
450 select_tv.tv_usec = 0;
451 FD_ZERO(&select_fd);
452 FD_SET(spamd_sock, &select_fd);
453 result = select(spamd_sock+1, NULL, &select_fd, NULL, &select_tv);
454#endif
455/* End Erik's patch */
8523533c 456
fd4d8871
R
457 if (result == -1 && errno == EINTR)
458 goto again;
459 else if (result < 1)
c5f280e2 460 {
fd4d8871
R
461 if (result == -1)
462 log_write(0, LOG_MAIN|LOG_PANIC,
463 "%s %s on spamd socket", loglabel, strerror(errno));
464 else
465 {
8a512ed5 466 if (time(NULL) - start < sd->timeout)
fd4d8871
R
467 goto again;
468 log_write(0, LOG_MAIN|LOG_PANIC,
469 "%s timed out writing spamd socket", loglabel);
470 }
471 (void)close(spamd_sock);
8acbb134 472 goto defer;
c5f280e2 473 }
8e669ac1 474
fd4d8871
R
475 wrote = send(spamd_sock,spamd_buffer + offset,read - offset,0);
476 if (wrote == -1)
c5f280e2 477 {
fd4d8871
R
478 log_write(0, LOG_MAIN|LOG_PANIC,
479 "%s %s on spamd socket", loglabel, strerror(errno));
480 (void)close(spamd_sock);
8acbb134 481 goto defer;
c5f280e2 482 }
fd4d8871 483 if (offset + wrote != read)
ddcf2b5f 484 {
fd4d8871
R
485 offset += wrote;
486 goto again;
ddcf2b5f
JH
487 }
488 }
fd4d8871
R
489 }
490while (!feof(mbox_file) && !ferror(mbox_file));
8523533c 491
fd4d8871
R
492if (ferror(mbox_file))
493 {
494 log_write(0, LOG_MAIN|LOG_PANIC,
495 "%s error reading spool file: %s", loglabel, strerror(errno));
496 (void)close(spamd_sock);
8acbb134 497 goto defer;
fd4d8871
R
498 }
499
500(void)fclose(mbox_file);
501
502/* we're done sending, close socket for writing */
503shutdown(spamd_sock,SHUT_WR);
504
505/* read spamd response using what's left of the timeout. */
506memset(spamd_buffer, 0, sizeof(spamd_buffer));
507offset = 0;
508while ((i = ip_recv(spamd_sock,
509 spamd_buffer + offset,
510 sizeof(spamd_buffer) - offset - 1,
8a512ed5 511 sd->timeout - time(NULL) + start)) > 0 )
fd4d8871
R
512 offset += i;
513
514/* error handling */
515if (i <= 0 && errno != 0)
516 {
517 log_write(0, LOG_MAIN|LOG_PANIC,
518 "%s error reading from spamd socket: %s", loglabel, strerror(errno));
519 (void)close(spamd_sock);
520 return DEFER;
521 }
522
523/* reading done */
524(void)close(spamd_sock);
525
8a512ed5 526if (sd->is_rspamd)
fd4d8871
R
527 { /* rspamd variant of reply */
528 int r;
529 if ((r = sscanf(CS spamd_buffer,
530 "RSPAMD/%7s 0 EX_OK\r\nMetric: default; %7s %lf / %lf / %lf\r\n%n",
531 spamd_version, spamd_short_result, &spamd_score, &spamd_threshold,
532 &spamd_reject_score, &spamd_report_offset)) != 5)
533 {
6c54be64
AL
534 log_write(0, LOG_MAIN|LOG_PANIC,
535 "%s cannot parse spamd output: %d", loglabel, r);
536 return DEFER;
fd4d8871
R
537 }
538 /* now parse action */
8523533c 539 p = &spamd_buffer[spamd_report_offset];
fd4d8871
R
540
541 if (Ustrncmp(p, "Action: ", sizeof("Action: ") - 1) == 0)
ddcf2b5f 542 {
fd4d8871
R
543 p += sizeof("Action: ") - 1;
544 q = &spam_action_buffer[0];
545 while (*p && *p != '\r' && (q - spam_action_buffer) < sizeof(spam_action_buffer) - 1)
546 *q++ = *p++;
547 *q = '\0';
ddcf2b5f 548 }
fd4d8871
R
549 }
550else
551 { /* spamassassin */
552 /* dig in the spamd output and put the report in a multiline header,
553 if requested */
554 if (sscanf(CS spamd_buffer,
555 "SPAMD/%7s 0 EX_OK\r\nContent-length: %*u\r\n\r\n%lf/%lf\r\n%n",
556 spamd_version,&spamd_score,&spamd_threshold,&spamd_report_offset) != 3)
ddcf2b5f 557 {
fd4d8871
R
558 /* try to fall back to pre-2.50 spamd output */
559 if (sscanf(CS spamd_buffer,
560 "SPAMD/%7s 0 EX_OK\r\nSpam: %*s ; %lf / %lf\r\n\r\n%n",
561 spamd_version,&spamd_score,&spamd_threshold,&spamd_report_offset) != 3)
562 {
563 log_write(0, LOG_MAIN|LOG_PANIC,
564 "%s cannot parse spamd output", loglabel);
565 return DEFER;
566 }
ddcf2b5f 567 }
fd4d8871
R
568
569 Ustrcpy(spam_action_buffer,
570 spamd_score >= spamd_threshold ? "reject" : "no action");
571 }
572
573/* Create report. Since this is a multiline string,
574we must hack it into shape first */
575p = &spamd_buffer[spamd_report_offset];
576q = spam_report_buffer;
577while (*p != '\0')
578 {
579 /* skip \r */
580 if (*p == '\r')
581 {
582 p++;
583 continue;
584 }
585 *q++ = *p;
586 if (*p++ == '\n')
587 {
588 /* add an extra space after the newline to ensure
589 that it is treated as a header continuation line */
590 *q++ = ' ';
591 }
592 }
593/* NULL-terminate */
594*q-- = '\0';
595/* cut off trailing leftovers */
596while (*q <= ' ')
597 *q-- = '\0';
598
599spam_report = spam_report_buffer;
600spam_action = spam_action_buffer;
601
602/* create spam bar */
603spamd_score_char = spamd_score > 0 ? '+' : '-';
604j = abs((int)(spamd_score));
605i = 0;
606if (j != 0)
607 while ((i < j) && (i <= MAX_SPAM_BAR_CHARS))
608 spam_bar_buffer[i++] = spamd_score_char;
609else
610 {
611 spam_bar_buffer[0] = '/';
612 i = 1;
613 }
614spam_bar_buffer[i] = '\0';
615spam_bar = spam_bar_buffer;
616
617/* create "float" spam score */
618(void)string_format(spam_score_buffer, sizeof(spam_score_buffer),
619 "%.1f", spamd_score);
620spam_score = spam_score_buffer;
621
622/* create "int" spam score */
623j = (int)((spamd_score + 0.001)*10);
624(void)string_format(spam_score_int_buffer, sizeof(spam_score_int_buffer),
625 "%d", j);
626spam_score_int = spam_score_int_buffer;
627
628/* compare threshold against score */
629spam_rc = spamd_score >= spamd_threshold
630 ? OK /* spam as determined by user's threshold */
631 : FAIL; /* not spam */
632
633/* remember expanded spamd_address if needed */
634if (spamd_address_work != spamd_address)
635 prev_spamd_address_work = string_copy(spamd_address_work);
636
637/* remember user name and "been here" for it */
638Ustrcpy(prev_user_name, user_name);
639spam_ok = 1;
640
641return override
642 ? OK /* always return OK, no matter what the score */
643 : spam_rc;
8acbb134
JH
644
645defer:
646 (void)fclose(mbox_file);
647 return DEFER;
8523533c
TK
648}
649
650#endif
2aad5761
JH
651/* vi: aw ai sw=2
652*/