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