Deleted Added
full compact
milter.c (120256) milter.c (125820)
1/*
2 * Copyright (c) 1999-2003 Sendmail, Inc. and its suppliers.
3 * All rights reserved.
4 *
5 * By using this file, you agree to the terms and conditions set
6 * forth in the LICENSE file which can be found at the top level of
7 * the sendmail distribution.
8 *
9 */
10
11#include <sendmail.h>
12
1/*
2 * Copyright (c) 1999-2003 Sendmail, Inc. and its suppliers.
3 * All rights reserved.
4 *
5 * By using this file, you agree to the terms and conditions set
6 * forth in the LICENSE file which can be found at the top level of
7 * the sendmail distribution.
8 *
9 */
10
11#include <sendmail.h>
12
13SM_RCSID("@(#)$Id: milter.c,v 8.197.2.9 2003/09/07 00:18:29 ca Exp $")
13SM_RCSID("@(#)$Id: milter.c,v 8.197.2.10 2003/12/01 23:57:44 msk Exp $")
14
15#if MILTER
16# include <libmilter/mfapi.h>
17# include <libmilter/mfdef.h>
18
19# include <errno.h>
20# include <sys/time.h>
21

--- 7 unchanged lines hidden (view full) ---

29static void milter_error __P((struct milter *, ENVELOPE *));
30static int milter_open __P((struct milter *, bool, ENVELOPE *));
31static void milter_parse_timeouts __P((char *, struct milter *));
32
33static char *MilterConnectMacros[MAXFILTERMACROS + 1];
34static char *MilterHeloMacros[MAXFILTERMACROS + 1];
35static char *MilterEnvFromMacros[MAXFILTERMACROS + 1];
36static char *MilterEnvRcptMacros[MAXFILTERMACROS + 1];
14
15#if MILTER
16# include <libmilter/mfapi.h>
17# include <libmilter/mfdef.h>
18
19# include <errno.h>
20# include <sys/time.h>
21

--- 7 unchanged lines hidden (view full) ---

29static void milter_error __P((struct milter *, ENVELOPE *));
30static int milter_open __P((struct milter *, bool, ENVELOPE *));
31static void milter_parse_timeouts __P((char *, struct milter *));
32
33static char *MilterConnectMacros[MAXFILTERMACROS + 1];
34static char *MilterHeloMacros[MAXFILTERMACROS + 1];
35static char *MilterEnvFromMacros[MAXFILTERMACROS + 1];
36static char *MilterEnvRcptMacros[MAXFILTERMACROS + 1];
37#if _FFR_MILTER_MACROS_EOM
38static char *MilterEOMMacros[MAXFILTERMACROS + 1];
39#endif /* _FFR_MILTER_MACROS_EOM */
37
38# define MILTER_CHECK_DONE_MSG() \
39 if (*state == SMFIR_REPLYCODE || \
40 *state == SMFIR_REJECT || \
41 *state == SMFIR_DISCARD || \
42 *state == SMFIR_TEMPFAIL) \
43 { \
44 /* Abort the filters to let them know we are done with msg */ \

--- 1365 unchanged lines hidden (view full) ---

1410# define MO_MACROS_HELO 0x02
1411 { "macros.helo", MO_MACROS_HELO },
1412# define MO_MACROS_ENVFROM 0x03
1413 { "macros.envfrom", MO_MACROS_ENVFROM },
1414# define MO_MACROS_ENVRCPT 0x04
1415 { "macros.envrcpt", MO_MACROS_ENVRCPT },
1416# define MO_LOGLEVEL 0x05
1417 { "loglevel", MO_LOGLEVEL },
40
41# define MILTER_CHECK_DONE_MSG() \
42 if (*state == SMFIR_REPLYCODE || \
43 *state == SMFIR_REJECT || \
44 *state == SMFIR_DISCARD || \
45 *state == SMFIR_TEMPFAIL) \
46 { \
47 /* Abort the filters to let them know we are done with msg */ \

--- 1365 unchanged lines hidden (view full) ---

1413# define MO_MACROS_HELO 0x02
1414 { "macros.helo", MO_MACROS_HELO },
1415# define MO_MACROS_ENVFROM 0x03
1416 { "macros.envfrom", MO_MACROS_ENVFROM },
1417# define MO_MACROS_ENVRCPT 0x04
1418 { "macros.envrcpt", MO_MACROS_ENVRCPT },
1419# define MO_LOGLEVEL 0x05
1420 { "loglevel", MO_LOGLEVEL },
1421#if _FFR_MILTER_MACROS_EOM
1422# define MO_MACROS_EOM 0x06
1423 { "macros.eom", MO_MACROS_EOM },
1424#endif /* _FFR_MILTER_MACROS_EOM */
1418 { NULL, 0 },
1419};
1420
1421void
1422milter_set_option(name, val, sticky)
1423 char *name;
1424 char *val;
1425 bool sticky;

--- 57 unchanged lines hidden (view full) ---

1483 case MO_MACROS_ENVFROM:
1484 if (macros == NULL)
1485 macros = MilterEnvFromMacros;
1486 /* FALLTHROUGH */
1487
1488 case MO_MACROS_ENVRCPT:
1489 if (macros == NULL)
1490 macros = MilterEnvRcptMacros;
1425 { NULL, 0 },
1426};
1427
1428void
1429milter_set_option(name, val, sticky)
1430 char *name;
1431 char *val;
1432 bool sticky;

--- 57 unchanged lines hidden (view full) ---

1490 case MO_MACROS_ENVFROM:
1491 if (macros == NULL)
1492 macros = MilterEnvFromMacros;
1493 /* FALLTHROUGH */
1494
1495 case MO_MACROS_ENVRCPT:
1496 if (macros == NULL)
1497 macros = MilterEnvRcptMacros;
1498#if _FFR_MILTER_MACROS_EOM
1499 /* FALLTHROUGH */
1491
1500
1501 case MO_MACROS_EOM:
1502 if (macros == NULL)
1503 macros = MilterEOMMacros;
1504#endif /* _FFR_MILTER_MACROS_EOM */
1505
1492 p = newstr(val);
1493 while (*p != '\0')
1494 {
1495 char *macro;
1496
1497 /* Skip leading commas, spaces */
1498 while (*p != '\0' &&
1499 (*p == ',' || (isascii(*p) && isspace(*p))))

--- 2089 unchanged lines hidden (view full) ---

3589 if (!bitset(SMFIP_NOBODY, m->mf_pflags) &&
3590 e->e_dfp != NULL)
3591 {
3592 rewind = true;
3593 response = milter_body(m, e, state);
3594 MILTER_CHECK_RESULTS();
3595 }
3596
1506 p = newstr(val);
1507 while (*p != '\0')
1508 {
1509 char *macro;
1510
1511 /* Skip leading commas, spaces */
1512 while (*p != '\0' &&
1513 (*p == ',' || (isascii(*p) && isspace(*p))))

--- 2089 unchanged lines hidden (view full) ---

3603 if (!bitset(SMFIP_NOBODY, m->mf_pflags) &&
3604 e->e_dfp != NULL)
3605 {
3606 rewind = true;
3607 response = milter_body(m, e, state);
3608 MILTER_CHECK_RESULTS();
3609 }
3610
3611#if _FFR_MILTER_MACROS_EOM
3612 if (MilterEOMMacros[0] != NULL)
3613 milter_send_macros(m, MilterEOMMacros, SMFIC_BODYEOB, e);
3614#endif /* _FFR_MILTER_MACROS_EOM */
3615
3597 /* send the final body chunk */
3598 (void) milter_write(m, SMFIC_BODYEOB, NULL, 0,
3599 m->mf_timeout[SMFTO_WRITE], e);
3600
3601 /* Get time EOM sent for timeout */
3602 eomsent = curtime();
3603
3604 /* deal with the possibility of multiple responses */

--- 310 unchanged lines hidden ---
3616 /* send the final body chunk */
3617 (void) milter_write(m, SMFIC_BODYEOB, NULL, 0,
3618 m->mf_timeout[SMFTO_WRITE], e);
3619
3620 /* Get time EOM sent for timeout */
3621 eomsent = curtime();
3622
3623 /* deal with the possibility of multiple responses */

--- 310 unchanged lines hidden ---