Postfix3.3.1
smtputf8.c
[詳解]
1 /*++
2 /* NAME
3 /* smtputf8 3
4 /* SUMMARY
5 /* SMTPUTF8 support
6 /* SYNOPSIS
7 /* #include <smtputf8.h>
8 /*
9 /* int smtputf8_autodetect(class)
10 /* int class;
11 /* DESCRIPTION
12 /* smtputf8_autodetect() determines whether the cleanup server
13 /* should perform SMTPUTF8 detection, depending on the declared
14 /* source class and the setting of the smtputf8_autodetect_classes
15 /* configuration parameter.
16 /*
17 /* Specify one of the following:
18 /* .IP MAIL_SRC_MASK_SENDMAIL
19 /* Submission with the Postfix sendmail(1) command.
20 /* .IP MAIL_SRC_MASK_SMTPD
21 /* Mail received with the smtpd(8) daemon.
22 /* .IP MAIL_SRC_MASK_QMQPD
23 /* Mail received with the qmqpd(8) daemon.
24 /* .IP MAIL_SRC_MASK_FORWARD
25 /* Local forwarding or aliasing.
26 /* .IP MAIL_SRC_MASK_BOUNCE
27 /* Submission by the bounce(8) daemon.
28 /* .IP MAIL_SRC_MASK_NOTIFY
29 /* Postmaster notification from the smtp(8) or smtpd(8) daemon.
30 /* .IP MAIL_SRC_MASK_VERIFY
31 /* Address verification probe.
32 /* DIAGNOSTICS
33 /* Panic: no valid class argument.
34 /*
35 /* Specify one of the following:
36 /* Warning: the smtputf8_autodetect_classes parameter specifies
37 /* an invalid source category name.
38 /* LICENSE
39 /* .ad
40 /* .fi
41 /* The Secure Mailer license must be distributed with this software.
42 /* AUTHOR(S)
43 /* Wietse Venema
44 /* IBM T.J. Watson Research
45 /* P.O. Box 704
46 /* Yorktown Heights, NY 10598, USA
47 /*--*/
48 
49 /* System library. */
50 
51 #include <sys_defs.h>
52 
53 /* Utility library. */
54 
55 #include <name_mask.h>
56 #include <msg.h>
57 
58 /* Global library. */
59 
60 #include <mail_params.h>
61 #include <cleanup_user.h>
62 #include <mail_proto.h>
63 #include <smtputf8.h>
64 
65 /* smtputf8_autodetect - enable SMTPUTF8 autodetection */
66 
67 int smtputf8_autodetect(int class)
68 {
69  static const char myname[] = "smtputf8_autodetect";
70  static const NAME_MASK table[] = {
79  0,
80  };
81  int autodetect_classes = 0;
82 
83  if (class == 0 || (class & ~MAIL_SRC_MASK_ALL) != 0)
84  msg_panic("%s: bad source class: %d", myname, class);
86  autodetect_classes =
88  if (autodetect_classes == 0)
89  msg_warn("%s: bad input: %s", VAR_SMTPUTF8_AUTOCLASS,
91  if (autodetect_classes & class)
92  return (CLEANUP_FLAG_AUTOUTF8);
93  }
94  return (0);
95 }
#define MAIL_SRC_MASK_SENDMAIL
Definition: mail_proto.h:77
#define MAIL_SRC_MASK_ALL
Definition: mail_proto.h:85
int smtputf8_autodetect(int class)
Definition: smtputf8.c:67
#define MAIL_SRC_NAME_VERIFY
Definition: mail_proto.h:74
NORETURN msg_panic(const char *fmt,...)
Definition: msg.c:295
#define MAIL_SRC_MASK_QMQPD
Definition: mail_proto.h:79
#define MAIL_SRC_NAME_NOTIFY
Definition: mail_proto.h:73
#define MAIL_SRC_MASK_NOTIFY
Definition: mail_proto.h:82
#define MAIL_SRC_NAME_SENDMAIL
Definition: mail_proto.h:68
#define MAIL_SRC_NAME_FORWARD
Definition: mail_proto.h:71
#define MAIL_SRC_NAME_BOUNCE
Definition: mail_proto.h:72
#define MAIL_SRC_MASK_BOUNCE
Definition: mail_proto.h:81
void msg_warn(const char *fmt,...)
Definition: msg.c:215
#define CLEANUP_FLAG_AUTOUTF8
Definition: cleanup_user.h:27
#define MAIL_SRC_MASK_VERIFY
Definition: mail_proto.h:83
#define name_mask(tag, table, str)
Definition: name_mask.h:49
#define MAIL_SRC_NAME_ALL
Definition: mail_proto.h:75
#define VAR_SMTPUTF8_AUTOCLASS
Definition: mail_params.h:4047
#define MAIL_SRC_NAME_QMQPD
Definition: mail_proto.h:70
#define MAIL_SRC_MASK_FORWARD
Definition: mail_proto.h:80
char * var_smtputf8_autoclass
Definition: mail_params.c:345
#define MAIL_SRC_NAME_SMTPD
Definition: mail_proto.h:69
#define MAIL_SRC_MASK_SMTPD
Definition: mail_proto.h:78