0
|
1 /* Distributed Checksum Clearinghouse |
|
2 * |
|
3 * external definitions for DCC interface daemon |
|
4 * |
|
5 * Copyright (c) 2008 by Rhyolite Software, LLC |
|
6 * |
|
7 * This agreement is not applicable to any entity which sells anti-spam |
|
8 * solutions to others or provides an anti-spam solution as part of a |
|
9 * security solution sold to other entities, or to a private network |
|
10 * which employs the DCC or uses data provided by operation of the DCC |
|
11 * but does not provide corresponding data to other users. |
|
12 * |
|
13 * Permission to use, copy, modify, and distribute this software without |
|
14 * changes for any purpose with or without fee is hereby granted, provided |
|
15 * that the above copyright notice and this permission notice appear in all |
|
16 * copies and any distributed versions or copies are either unchanged |
|
17 * or not called anything similar to "DCC" or "Distributed Checksum |
|
18 * Clearinghouse". |
|
19 * |
|
20 * Parties not eligible to receive a license under this agreement can |
|
21 * obtain a commercial license to use DCC by contacting Rhyolite Software |
|
22 * at sales@rhyolite.com. |
|
23 * |
|
24 * A commercial license would be for Distributed Checksum and Reputation |
|
25 * Clearinghouse software. That software includes additional features. This |
|
26 * free license for Distributed ChecksumClearinghouse Software does not in any |
|
27 * way grant permision to use Distributed Checksum and Reputation Clearinghouse |
|
28 * software |
|
29 * |
|
30 * THE SOFTWARE IS PROVIDED "AS IS" AND RHYOLITE SOFTWARE, LLC DISCLAIMS ALL |
|
31 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES |
|
32 * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL RHYOLITE SOFTWARE, LLC |
|
33 * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES |
|
34 * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, |
|
35 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, |
|
36 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS |
|
37 * SOFTWARE. |
|
38 * |
|
39 * Rhyolite Software DCC 1.3.103-1.26 $Revision$ |
|
40 */ |
|
41 |
|
42 #ifndef DCCIF_H |
|
43 #define DCCIF_H |
|
44 |
|
45 #include "dcc_defs.h" |
|
46 |
|
47 /* The DCC interface daemon is intended for use with programs that |
|
48 * need a more efficient DCC client than dccproc. The dccif daemon |
|
49 * receives messages containing SMTP messages including their envelopes, |
|
50 * checks the messages' checksums with a DCC server, and answers |
|
51 * with indications of what to do with the mail messages. |
|
52 * |
|
53 * The protocol used by dccif is simple and easily implemented even |
|
54 * in shell scripts. The protocol uses ASCII strings delimited by '\n' |
|
55 * despite their reduced efficiency, because strings are quicker and |
|
56 * easier to handle in scripts. There are Perl and C implementations of the |
|
57 * interface that are useful in common situations. |
|
58 * |
|
59 * The interface daemon is given |
|
60 * optional information including whether the message is spam: */ |
|
61 #define DCCIF_OPT_LOG "log" /* log the transaction */ |
|
62 #define DCCIF_OPT_SPAM "spam" /* message is known to be spam */ |
|
63 #define DCCIF_OPT_BODY "body" /* daemon should return the body */ |
|
64 #define DCCIF_OPT_HEADER "header" /* return only the header */ |
|
65 #define DCCIF_OPT_QUERY "query" /* `dccifd -Q` for this message */ |
|
66 #define DCCIF_OPT_GREY_QUERY "grey-query" /* `dccifd -Gquery` */ |
|
67 #define DCCIF_OPT_NO_REJECT "no-reject" /* ignore DCC result; greylist only */ |
|
68 #define DCCIF_OPT_RCVD_NXT "rcvd-nxt" /* parse next Received: header */ |
|
69 #define DCCIF_OPT_RCVD_NEXT "rcvd-next" /* confused duplicate */ |
|
70 /* |
|
71 * optional IP address as an ASCII string |
|
72 * optionally followed by '\r' and the name of the |
|
73 * SMTP client. The IP address must be present if the name is. |
|
74 * If neither is present, the IP address is sought in the first |
|
75 * Received header. |
|
76 * the HELO value without ESMTP options, |
|
77 * the complete sender without ESMTP options, |
|
78 * the complete recipient strings without ESMTP options but with |
|
79 * optional local user name for per-user logging. The local user |
|
80 * name follows a '\r' character after the SMTP Rcpt_To value, |
|
81 * Only something like an MTA can decide whether user@domain |
|
82 * example.com, user@example.com, and user@domain.com are the same |
|
83 * or different mailboxes and so should have one, two, or three |
|
84 * per-user logs. Without a local user name, dccifd can do no per-user |
|
85 * logging or whitelisting. |
|
86 * With no recipients, dccifd will assume a query is intended. |
|
87 * and the body of the message or text after the DATA command |
|
88 * up to but not including the period, with any escaping |
|
89 * of leading periods removed. */ |
|
90 |
|
91 /* The daemon responds with |
|
92 * a line that is the overall result: */ |
|
93 typedef enum { |
|
94 DCCIF_RESULT_OK = 'A', /* accept for all recipients */ |
|
95 DCCIF_RESULT_GREY = 'G', /* greylist temporary rejection */ |
|
96 DCCIF_RESULT_REJECT = 'R', /* reject the message */ |
|
97 DCCIF_RESULT_SOME = 'S', /* no longer used */ |
|
98 DCCIF_RESULT_TEMP = 'T' /* temporary failure by DCC system */ |
|
99 } DCCIF_RESULT_CHAR; |
|
100 /* |
|
101 * followed by a line of characters indicating which recipients should |
|
102 * receive the message */ |
|
103 #define DCCIF_RCPT_ACCEPT 'A' |
|
104 #define DCCIF_RCPT_REJECT 'R' |
|
105 #define DCCIF_RCPT_GREY 'G' |
|
106 /* |
|
107 * followed by the body, usually with an added X-DCC header and any |
|
108 * spurious copies of the X-DCC header removed. |
|
109 * MTAs that need a copy of the body must say so with the |
|
110 * DCCIF_OPT_BODY string among the options in the first line. |
|
111 */ |
|
112 |
|
113 |
|
114 |
|
115 /* sample C interface routine */ |
|
116 |
|
117 #define DCC_DCCIF_UDS "dccifd" /* name of UNIX domain socket */ |
|
118 |
|
119 /* Put parameters for the daemon into the dcc_conf file in home directory. */ |
|
120 #define DCC_START_DCCIFD "start-dccifd" /* script to (re)start daemon */ |
|
121 |
|
122 typedef struct dccif_rcpt { |
|
123 struct dccif_rcpt *next; |
|
124 const char *addr; /* SMTP Rcpt_To value */ |
|
125 const char *user; /* local user name */ |
|
126 u_char ok; /* 0=do not receive for this one */ |
|
127 } DCCIF_RCPT; /* chain of target addresses */ |
|
128 |
|
129 extern u_char dccif(DCC_EMSG, /* put error message here */ |
|
130 int, /* -1 or write body to here */ |
|
131 char **, /* 0 or pointer to resulting body */ |
|
132 const char *, /* string of options */ |
|
133 const DCC_SOCKU *, /* SMTP client IPv4 or IPv6 address */ |
|
134 const char *, /* optional client name */ |
|
135 const char *, /* HELO string */ |
|
136 const char *, /* envelope sender or Mail_from value */ |
|
137 DCCIF_RCPT *, /* envelope recipients */ |
|
138 int, /* -1 or read body from here */ |
|
139 const char *, /* incoming body */ |
|
140 const char *); /* home directory */ |
|
141 |
|
142 #endif /* DCCIF_H */ |