1 /*++
2 /* NAME
3 /* int_filt 3
4 /* SUMMARY
5 /* internal mail filter control
6 /* SYNOPSIS
7 /* #include <int_filt.h>
8 /*
9 /* int int_filt_flags(class)
10 /* int class;
11 /* DESCRIPTION
12 /* int_filt_flags() determines the appropriate mail filtering
13 /* flags for the cleanup server, depending on the setting of
14 /* the internal_mail_filter_classes configuration parameter.
15 /*
16 /* Specify one of the following:
17 /* .IP MAIL_SRC_MASK_NOTIFY
18 /* Postmaster notifications from the smtpd(8) and smtp(8)
19 /* protocol adapters.
20 /* .IP MAIL_SRC_MASK_BOUNCE
21 /* Delivery status notifications from the bounce(8) server.
22 /* .PP
23 /* Other MAIL_SRC_MASK_XXX arguments are permited but will
24 /* have no effect.
25 /* DIAGNOSTICS
26 /* Fatal: invalid mail category name.
27 /* LICENSE
28 /* .ad
29 /* .fi
30 /* The Secure Mailer license must be distributed with this software.
31 /* AUTHOR(S)
32 /* Wietse Venema
33 /* IBM T.J. Watson Research
34 /* P.O. Box 704
35 /* Yorktown Heights, NY 10598, USA
36 /*--*/
37
38 /* System library. */
39
40 #include <sys_defs.h>
41
42 /* Utility library. */
43
44 #include <name_mask.h>
45 #include <msg.h>
46
47 /* Global library. */
48
49 #include <mail_params.h>
50 #include <cleanup_user.h>
51 #include <mail_proto.h>
52 #include <int_filt.h>
53
54 /* int_filt_flags - map mail class to submission flags */
55
int_filt_flags(int class)56 int int_filt_flags(int class)
57 {
58 static const NAME_MASK table[] = {
59 MAIL_SRC_NAME_NOTIFY, MAIL_SRC_MASK_NOTIFY,
60 MAIL_SRC_NAME_BOUNCE, MAIL_SRC_MASK_BOUNCE,
61 MAIL_SRC_NAME_SENDMAIL, 0,
62 MAIL_SRC_NAME_SMTPD, 0,
63 MAIL_SRC_NAME_QMQPD, 0,
64 MAIL_SRC_NAME_FORWARD, 0,
65 MAIL_SRC_NAME_VERIFY, 0,
66 0,
67 };
68 int filtered_classes = 0;
69
70 if (class && *var_int_filt_classes) {
71 filtered_classes =
72 name_mask(VAR_INT_FILT_CLASSES, table, var_int_filt_classes);
73 if (filtered_classes == 0)
74 msg_warn("%s: bad input: %s", VAR_INT_FILT_CLASSES,
75 var_int_filt_classes);
76 if (filtered_classes & class)
77 return (CLEANUP_FLAG_FILTER | CLEANUP_FLAG_MILTER);
78 }
79 return (0);
80 }
81