Commit | Line | Data |
---|---|---|
aeb2545d | 1 | /* |
792e6158 | 2 | * Copyright (c) 1983, 1995 Eric P. Allman |
24634489 KB |
3 | * Copyright (c) 1988, 1993 |
4 | * The Regents of the University of California. All rights reserved. | |
bee79b64 | 5 | * |
417f7a11 | 6 | * %sccs.include.redist.c% |
bee79b64 | 7 | * |
a40faef5 | 8 | * @(#)sendmail.h 8.141 (Berkeley) %G% |
bee79b64 | 9 | */ |
aeb2545d | 10 | |
b3cbe40f | 11 | /* |
96faada8 | 12 | ** SENDMAIL.H -- Global definitions for sendmail. |
b3cbe40f EA |
13 | */ |
14 | ||
327272f5 EA |
15 | # ifdef _DEFINE |
16 | # define EXTERN | |
4e5e456f | 17 | # ifndef lint |
a40faef5 | 18 | static char SmailSccsId[] = "@(#)sendmail.h 8.141 %G%"; |
6353954f | 19 | # endif |
f3d8f6d6 | 20 | # else /* _DEFINE */ |
327272f5 | 21 | # define EXTERN extern |
f3d8f6d6 | 22 | # endif /* _DEFINE */ |
b3cbe40f | 23 | |
9dfbef75 | 24 | # include <unistd.h> |
f3d8f6d6 EA |
25 | # include <stddef.h> |
26 | # include <stdlib.h> | |
aeb209da EA |
27 | # include <stdio.h> |
28 | # include <ctype.h> | |
37eaaadb | 29 | # include <setjmp.h> |
f3d8f6d6 EA |
30 | # include <string.h> |
31 | # include <time.h> | |
32 | # include <errno.h> | |
3f7592f7 | 33 | # ifdef EX_OK |
ff73b4e5 | 34 | # undef EX_OK /* for SVr4.2 SMP */ |
3f7592f7 EA |
35 | # endif |
36 | # include <sysexits.h> | |
f3d8f6d6 | 37 | |
b5fd168f | 38 | # include "conf.h" |
6bf17095 | 39 | # include "conf.h" |
cb590f52 EA |
40 | # include "useful.h" |
41 | ||
9678c96d | 42 | # ifdef LOG |
5031c0bb | 43 | # include <syslog.h> |
f3d8f6d6 | 44 | # endif /* LOG */ |
6e8a8adf | 45 | |
2e3062fe | 46 | # ifdef DAEMON |
2e3062fe | 47 | # include <sys/socket.h> |
3356c77c | 48 | # endif |
a40faef5 | 49 | # if NETUNIX |
3a4fbef8 EA |
50 | # include <sys/un.h> |
51 | # endif | |
a40faef5 | 52 | # if NETINET |
2e3062fe | 53 | # include <netinet/in.h> |
3356c77c | 54 | # endif |
a40faef5 | 55 | # if NETISO |
3356c77c EA |
56 | # include <netiso/iso.h> |
57 | # endif | |
a40faef5 | 58 | # if NETNS |
88e65f7c EA |
59 | # include <netns/ns.h> |
60 | # endif | |
a40faef5 | 61 | # if NETX25 |
88e65f7c EA |
62 | # include <netccitt/x25.h> |
63 | # endif | |
2e3062fe | 64 | |
6e8a8adf | 65 | |
a584db60 | 66 | |
179d940c EA |
67 | /* forward references for prototypes */ |
68 | typedef struct envelope ENVELOPE; | |
69 | typedef struct mailer MAILER; | |
70 | ||
a584db60 | 71 | |
6e8a8adf EA |
72 | /* |
73 | ** Data structure for bit maps. | |
74 | ** | |
75 | ** Each bit in this map can be referenced by an ascii character. | |
5d9e8d9a | 76 | ** This is 256 possible bits, or 32 8-bit bytes. |
6e8a8adf EA |
77 | */ |
78 | ||
5d9e8d9a | 79 | #define BITMAPBYTES 32 /* number of bytes in a bit map */ |
6e8a8adf EA |
80 | #define BYTEBITS 8 /* number of bits in a byte */ |
81 | ||
82 | /* internal macros */ | |
022362dd EA |
83 | #define _BITWORD(bit) ((bit) / (BYTEBITS * sizeof (int))) |
84 | #define _BITBIT(bit) (1 << ((bit) % (BYTEBITS * sizeof (int)))) | |
6e8a8adf EA |
85 | |
86 | typedef int BITMAP[BITMAPBYTES / sizeof (int)]; | |
87 | ||
88 | /* test bit number N */ | |
89 | #define bitnset(bit, map) ((map)[_BITWORD(bit)] & _BITBIT(bit)) | |
90 | ||
91 | /* set bit number N */ | |
92 | #define setbitn(bit, map) (map)[_BITWORD(bit)] |= _BITBIT(bit) | |
93 | ||
94 | /* clear bit number N */ | |
95 | #define clrbitn(bit, map) (map)[_BITWORD(bit)] &= ~_BITBIT(bit) | |
96 | ||
97 | /* clear an entire bit map */ | |
cca7676f | 98 | #define clrbitmap(map) bzero((char *) map, BITMAPBYTES) |
281f3387 | 99 | \f/* |
9e3c0a28 EA |
100 | ** Address structure. |
101 | ** Addresses are stored internally in this structure. | |
abae7b2d EA |
102 | ** |
103 | ** Each address is on two chains and in one tree. | |
104 | ** The q_next chain is used to link together addresses | |
105 | ** for one mailer (and is rooted in a mailer). | |
106 | ** The q_chain chain is used to maintain a list of | |
107 | ** addresses originating from one call to sendto, and | |
108 | ** is used primarily for printing messages. | |
109 | ** The q_alias, q_sibling, and q_child tree maintains | |
110 | ** a complete tree of the aliases. q_alias points to | |
111 | ** the parent -- obviously, there can be several, and | |
112 | ** so this points to "one" of them. Ditto for q_sibling. | |
9e3c0a28 EA |
113 | */ |
114 | ||
115 | struct address | |
116 | { | |
117 | char *q_paddr; /* the printname for the address */ | |
118 | char *q_user; /* user name */ | |
3fbc69d6 | 119 | char *q_ruser; /* real user name, or NULL if q_user */ |
9e3c0a28 | 120 | char *q_host; /* host name */ |
179c1218 | 121 | struct mailer *q_mailer; /* mailer to use */ |
68d9129a | 122 | u_long q_flags; /* status flags, see below */ |
0c9a26a7 EA |
123 | uid_t q_uid; /* user-id of receiver (if known) */ |
124 | gid_t q_gid; /* group-id of receiver (if known) */ | |
4bb4503e | 125 | char *q_home; /* home dir (local mailer only) */ |
f77d50ee | 126 | char *q_fullname; /* full name if known */ |
abae7b2d | 127 | char *q_fullname; /* full name of this person */ |
abae7b2d EA |
128 | struct address *q_next; /* chain */ |
129 | struct address *q_alias; /* parent in alias tree */ | |
130 | struct address *q_sibling; /* sibling in alias tree */ | |
131 | struct address *q_child; /* child in alias tree */ | |
9e3c0a28 EA |
132 | }; |
133 | ||
134 | typedef struct address ADDRESS; | |
135 | ||
68d9129a EA |
136 | # define QDONTSEND 0x00000001 /* don't send to this address */ |
137 | # define QBADADDR 0x00000002 /* this address is verified bad */ | |
138 | # define QGOODUID 0x00000004 /* the q_uid q_gid fields are good */ | |
66d16835 | 139 | # define QPRIMARY 0x00000008 /* set from RCPT or argv */ |
68d9129a EA |
140 | # define QQUEUEUP 0x00000010 /* queue for later transmission */ |
141 | # define QSENT 0x00000020 /* has been successfully delivered */ | |
142 | # define QNOTREMOTE 0x00000040 /* address not for remote forwarding */ | |
143 | # define QSELFREF 0x00000080 /* this address references itself */ | |
144 | # define QVERIFIED 0x00000100 /* verified, but not expanded */ | |
68d9129a EA |
145 | # define QBOGUSSHELL 0x00000400 /* user has no valid shell listed */ |
146 | # define QUNSAFEADDR 0x00000800 /* address aquired via unsafe path */ | |
147 | # define QPINGONSUCCESS 0x00001000 /* give return on successful delivery */ | |
148 | # define QPINGONFAILURE 0x00002000 /* give return on failure */ | |
149 | # define QPINGONDELAY 0x00004000 /* give return on message delay */ | |
e1f691b3 | 150 | # define QHASNOTIFY 0x00008000 /* propogate notify parameter */ |
126c1099 EA |
151 | # define QRELAYED 0x00010000 /* DSN: relayed to non-DSN aware sys */ |
152 | # define QEXPANDED 0x00020000 /* DSN: undergone list expansion */ | |
153 | # define QDELIVERED 0x00040000 /* DSN: successful final delivery */ | |
154 | # define QDELAYED 0x00080000 /* DSN: message delayed */ | |
66d16835 | 155 | # define QTHISPASS 0x80000000 /* temp: address set this pass */ |
28f94061 EA |
156 | |
157 | # define NULLADDR ((ADDRESS *) NULL) | |
179d940c EA |
158 | |
159 | /* functions */ | |
160 | extern ADDRESS *parseaddr __P((char *, ADDRESS *, int, int, char **, ENVELOPE *)); | |
161 | extern ADDRESS *recipient __P((ADDRESS *, ADDRESS **, int, ENVELOPE *)); | |
162 | extern char **prescan __P((char *, int, char[], int, char **, u_char *)); | |
163 | extern int rewrite __P((char **, int, int, ENVELOPE *)); | |
164 | extern char *remotename __P((char *, MAILER *, int, int *, ENVELOPE *)); | |
165 | extern ADDRESS *getctladdr __P((ADDRESS *)); | |
166 | extern bool sameaddr __P((ADDRESS *, ADDRESS *)); | |
167 | extern bool emptyaddr __P((ADDRESS *)); | |
168 | extern void printaddr __P((ADDRESS *, bool)); | |
169 | extern void cataddr __P((char **, char **, char *, int, int)); | |
170 | extern int sendtolist __P((char *, ADDRESS *, ADDRESS **, int, ENVELOPE *)); | |
abae7b2d | 171 | # define QPSEUDO 000040 /* only on the list for verification */ |
2654b031 | 172 | \f/* |
b3cbe40f EA |
173 | ** Mailer definition structure. |
174 | ** Every mailer known to the system is declared in this | |
175 | ** structure. It defines the pathname of the mailer, some | |
176 | ** flags associated with it, and the argument vector to | |
cb590f52 | 177 | ** pass to it. The flags are defined in conf.c |
b3cbe40f | 178 | ** |
b8944683 EA |
179 | ** The argument vector is expanded before actual use. All |
180 | ** words except the first are passed through the macro | |
181 | ** processor. | |
b3cbe40f EA |
182 | */ |
183 | ||
184 | struct mailer | |
185 | { | |
d6a28dd8 | 186 | char *m_name; /* symbolic name of this mailer */ |
9e3c0a28 | 187 | char *m_mailer; /* pathname of the mailer to use */ |
51d448e5 EA |
188 | char *m_mtatype; /* type of this MTA */ |
189 | char *m_addrtype; /* type for addresses */ | |
190 | char *m_diagtype; /* type for diagnostics */ | |
6e8a8adf | 191 | BITMAP m_flags; /* status flags, see below */ |
b14547d5 | 192 | short m_mno; /* mailer number internally */ |
246d7c84 | 193 | short m_nice; /* niceness to run at (mostly for prog) */ |
6708a5e3 | 194 | char **m_argv; /* template argument vector */ |
5f2e67fb EA |
195 | short m_sh_rwset; /* rewrite set: sender header addresses */ |
196 | short m_se_rwset; /* rewrite set: sender envelope addresses */ | |
197 | short m_rh_rwset; /* rewrite set: recipient header addresses */ | |
198 | short m_re_rwset; /* rewrite set: recipient envelope addresses */ | |
b3ef02a2 | 199 | char *m_eol; /* end of line string */ |
6e8a8adf | 200 | long m_maxsize; /* size limit on message to this mailer */ |
8657d05f | 201 | int m_linelimit; /* max # characters per line */ |
a9d54f84 | 202 | char *m_execdir; /* directory to chdir to before execv */ |
18ec81ef EA |
203 | uid_t m_uid; /* UID to run as */ |
204 | gid_t m_gid; /* GID to run as */ | |
3caf3b1f | 205 | char *m_defcharset; /* default character set */ |
b3cbe40f EA |
206 | }; |
207 | ||
5fbf3fea | 208 | /* bits for m_flags */ |
4f163ea3 | 209 | # define M_ESMTP 'a' /* run Extended SMTP protocol */ |
2bade550 | 210 | # define M_ALIASABLE 'A' /* user can be LHS of an alias */ |
e9d9eee0 | 211 | # define M_BLANKEND 'b' /* ensure blank line at end of message */ |
e0b72c68 | 212 | # define M_NOCOMMENT 'c' /* don't include comment part of address */ |
55c35014 | 213 | # define M_CANONICAL 'C' /* make addresses canonical "u@dom" */ |
09ce8c09 | 214 | # define M_NOBRACKET 'd' /* never angle bracket envelope route-addrs */ |
e0b72c68 | 215 | /* 'D' /* CF: include Date: */ |
55c35014 EA |
216 | # define M_EXPENSIVE 'e' /* it costs to use this mailer.... */ |
217 | # define M_ESCFROM 'E' /* escape From lines to >From */ | |
6e8a8adf | 218 | # define M_FOPT 'f' /* mailer takes picky -f flag */ |
e0b72c68 | 219 | /* 'F' /* CF: include From: or Resent-From: */ |
aa7457b1 | 220 | # define M_NO_NULL_FROM 'g' /* sender of errors should be $g */ |
55c35014 | 221 | # define M_HST_UPPER 'h' /* preserve host case distinction */ |
68e180c7 | 222 | # define M_PREHEAD 'H' /* MAIL11V3: preview headers */ |
b927c301 | 223 | # define M_UDBENVELOPE 'i' /* do udbsender rewriting on envelope */ |
55c35014 | 224 | # define M_INTERNAL 'I' /* SMTP to another sendmail site */ |
bfdaf8cb | 225 | # define M_UDBRECIPIENT 'j' /* do udbsender rewriting on recipient lines */ |
2bade550 | 226 | # define M_NOLOOPCHECK 'k' /* don't check for loops in HELO command */ |
09ce8c09 | 227 | # define M_LOCALMAILER 'l' /* delivery is to this host */ |
55c35014 | 228 | # define M_LIMITS 'L' /* must enforce SMTP line limits */ |
6e8a8adf | 229 | # define M_MUSER 'm' /* can handle multiple users at once */ |
e0b72c68 | 230 | /* 'M' /* CF: include Message-Id: */ |
55c35014 | 231 | # define M_NHDR 'n' /* don't insert From line */ |
68e180c7 | 232 | # define M_MANYSTATUS 'N' /* MAIL11V3: DATA returns multi-status */ |
2bade550 | 233 | # define M_RUNASRCPT 'o' /* always run mailer as recipient */ |
55c35014 | 234 | # define M_FROMPATH 'p' /* use reverse-path in MAIL FROM: */ |
e0b72c68 | 235 | /* 'P' /* CF: include Return-Path: */ |
55c35014 | 236 | # define M_ROPT 'r' /* mailer takes picky -r flag */ |
a4f165f5 | 237 | # define M_SECURE_PORT 'R' /* try to send on a reserved TCP port */ |
55c35014 | 238 | # define M_STRIPQ 's' /* strip quote chars from user/host */ |
c1760914 | 239 | # define M_SPECIFIC_UID 'S' /* run as specific uid/gid */ |
6e8a8adf | 240 | # define M_USR_UPPER 'u' /* preserve user case distinction */ |
6e8a8adf | 241 | # define M_UGLYUUCP 'U' /* this wants an ugly UUCP from line */ |
2604d017 | 242 | # define M_CONTENT_LEN 'v' /* add Content-Length: header (SVr4) */ |
e0b72c68 | 243 | /* 'V' /* UIUC: !-relativize all addresses */ |
2bade550 | 244 | # define M_HASPWENT 'w' /* check for /etc/passwd entry */ |
4f163ea3 | 245 | /* 'x' /* CF: include Full-Name: */ |
6e8a8adf | 246 | # define M_XDOT 'X' /* use hidden-dot algorithm */ |
c806bc6b | 247 | # define M_EBCDIC '3' /* extend Q-P encoding for EBCDIC */ |
2bade550 | 248 | # define M_TRYRULESET5 '5' /* use ruleset 5 after local aliasing */ |
8657d05f | 249 | # define M_7BITS '7' /* use 7-bit path */ |
38f52787 | 250 | # define M_8BITS '8' /* force "just send 8" behaviour */ |
7e3998c7 | 251 | # define M_MAKE8BIT '9' /* convert 7 -> 8 bit if appropriate */ |
2bade550 EA |
252 | # define M_CHECKINCLUDE ':' /* check for :include: files */ |
253 | # define M_CHECKPROG '|' /* check for |program addresses */ | |
254 | # define M_CHECKFILE '/' /* check for /file addresses */ | |
255 | # define M_CHECKUDB '@' /* user can be user database key */ | |
1a12c7d6 | 256 | |
179c1218 | 257 | EXTERN MAILER *Mailer[MAXMAILERS+1]; |
4bb4503e | 258 | |
179c1218 EA |
259 | EXTERN MAILER *LocalMailer; /* ptr to local mailer */ |
260 | EXTERN MAILER *ProgMailer; /* ptr to program mailer */ | |
38817acb EA |
261 | EXTERN MAILER *FileMailer; /* ptr to *file* mailer */ |
262 | EXTERN MAILER *InclMailer; /* ptr to *include* mailer */ | |
2654b031 | 263 | \f/* |
1a12c7d6 EA |
264 | ** Header structure. |
265 | ** This structure is used internally to store header items. | |
266 | */ | |
267 | ||
268 | struct header | |
269 | { | |
270 | char *h_field; /* the name of the field */ | |
271 | char *h_value; /* the value of that field */ | |
272 | struct header *h_link; /* the next header */ | |
b2e9d033 | 273 | u_short h_flags; /* status bits, see below */ |
6e8a8adf | 274 | BITMAP h_mflags; /* m_flags bits needed */ |
1a12c7d6 EA |
275 | }; |
276 | ||
277 | typedef struct header HDR; | |
278 | ||
1a12c7d6 EA |
279 | /* |
280 | ** Header information structure. | |
281 | ** Defined in conf.c, this struct declares the header fields | |
282 | ** that have some magic meaning. | |
283 | */ | |
284 | ||
285 | struct hdrinfo | |
286 | { | |
287 | char *hi_field; /* the name of the field */ | |
b2e9d033 | 288 | u_short hi_flags; /* status bits, see below */ |
1a12c7d6 EA |
289 | }; |
290 | ||
291 | extern struct hdrinfo HdrInfo[]; | |
292 | ||
293 | /* bits for h_flags and hi_flags */ | |
b5cdafa3 EA |
294 | # define H_EOH 0x0001 /* this field terminates header */ |
295 | # define H_RCPT 0x0002 /* contains recipient addresses */ | |
296 | # define H_DEFAULT 0x0004 /* if another value is found, drop this */ | |
297 | # define H_RESENT 0x0008 /* this address is a "Resent-..." address */ | |
298 | # define H_CHECK 0x0010 /* check h_mflags against m_flags */ | |
299 | # define H_ACHECK 0x0020 /* ditto, but always (not just default) */ | |
300 | # define H_FORCE 0x0040 /* force this field, even if default */ | |
301 | # define H_TRACE 0x0080 /* this field contains trace information */ | |
302 | # define H_FROM 0x0100 /* this is a from-type field */ | |
303 | # define H_VALID 0x0200 /* this field has a validated value */ | |
304 | # define H_RECEIPTTO 0x0400 /* this field has return receipt info */ | |
305 | # define H_ERRORSTO 0x0800 /* this field has error address info */ | |
306 | # define H_CTE 0x1000 /* this field is a content-transfer-encoding */ | |
a579cea5 | 307 | # define H_CTYPE 0x2000 /* this is a content-type field */ |
5dc3d2c7 | 308 | # define H_STRIPVAL 0x4000 /* strip value from header (Bcc:) */ |
2654b031 | 309 | \f/* |
23fafb99 EA |
310 | ** Information about currently open connections to mailers, or to |
311 | ** hosts that we have looked up recently. | |
312 | */ | |
313 | ||
314 | # define MCI struct mailer_con_info | |
315 | ||
316 | MCI | |
317 | { | |
318 | short mci_flags; /* flag bits, see below */ | |
319 | short mci_errno; /* error number on last connection */ | |
320 | short mci_herrno; /* h_errno from last DNS lookup */ | |
321 | short mci_exitstat; /* exit status from last connection */ | |
322 | short mci_state; /* SMTP state */ | |
323 | long mci_maxsize; /* max size this server will accept */ | |
324 | FILE *mci_in; /* input side of connection */ | |
325 | FILE *mci_out; /* output side of connection */ | |
326 | int mci_pid; /* process id of subordinate proc */ | |
327 | char *mci_phase; /* SMTP phase string */ | |
328 | struct mailer *mci_mailer; /* ptr to the mailer for this conn */ | |
329 | char *mci_host; /* host name */ | |
a542cc51 | 330 | char *mci_status; /* DSN status to be copied to addrs */ |
23fafb99 EA |
331 | time_t mci_lastuse; /* last usage time */ |
332 | }; | |
333 | ||
334 | ||
335 | /* flag bits */ | |
b5cdafa3 EA |
336 | #define MCIF_VALID 0x0001 /* this entry is valid */ |
337 | #define MCIF_TEMP 0x0002 /* don't cache this connection */ | |
338 | #define MCIF_CACHED 0x0004 /* currently in open cache */ | |
339 | #define MCIF_ESMTP 0x0008 /* this host speaks ESMTP */ | |
340 | #define MCIF_EXPN 0x0010 /* EXPN command supported */ | |
341 | #define MCIF_SIZE 0x0020 /* SIZE option supported */ | |
342 | #define MCIF_8BITMIME 0x0040 /* BODY=8BITMIME supported */ | |
343 | #define MCIF_7BIT 0x0080 /* strip this message to 7 bits */ | |
344 | #define MCIF_MULTSTAT 0x0100 /* MAIL11V3: handles MULT status */ | |
345 | #define MCIF_INHEADER 0x0200 /* currently outputing header */ | |
346 | #define MCIF_CVT8TO7 0x0400 /* convert from 8 to 7 bits */ | |
68d9129a | 347 | #define MCIF_DSN 0x0800 /* DSN extension supported */ |
c7a0eaaf | 348 | #define MCIF_8BITOK 0x1000 /* OK to send 8 bit characters */ |
7e3998c7 | 349 | #define MCIF_CVT7TO8 0x2000 /* convert from 7 to 8 bits */ |
d8daa013 | 350 | #define MCIF_INMIME 0x4000 /* currently reading MIME header */ |
23fafb99 EA |
351 | |
352 | /* states */ | |
353 | #define MCIS_CLOSED 0 /* no traffic on this connection */ | |
354 | #define MCIS_OPENING 1 /* sending initial protocol */ | |
355 | #define MCIS_OPEN 2 /* open, initial protocol sent */ | |
356 | #define MCIS_ACTIVE 3 /* message being sent */ | |
357 | #define MCIS_QUITING 4 /* running quit protocol */ | |
358 | #define MCIS_SSD 5 /* service shutting down */ | |
359 | #define MCIS_ERROR 6 /* I/O error on connection */ | |
179d940c EA |
360 | |
361 | /* functions */ | |
362 | extern MCI *mci_get __P((char *, MAILER *)); | |
363 | extern void mci_cache __P((MCI *)); | |
364 | extern void mci_flush __P((bool, MCI *)); | |
23fafb99 | 365 | \f/* |
2654b031 EA |
366 | ** Envelope structure. |
367 | ** This structure defines the message itself. There is usually | |
368 | ** only one of these -- for the message that we originally read | |
369 | ** and which is our primary interest -- but other envelopes can | |
370 | ** be generated during processing. For example, error messages | |
371 | ** will have their own envelope. | |
372 | */ | |
1a12c7d6 | 373 | |
179d940c | 374 | struct envelope |
2654b031 | 375 | { |
dd1fe05b EA |
376 | HDR *e_header; /* head of header list */ |
377 | long e_msgpriority; /* adjusted priority of this message */ | |
96476cab | 378 | time_t e_ctime; /* time message appeared in the queue */ |
dd1fe05b | 379 | char *e_to; /* the target person */ |
17232873 | 380 | char *e_receiptto; /* return receipt address */ |
dd1fe05b | 381 | ADDRESS e_from; /* the person it is from */ |
547f2e0e | 382 | char *e_sender; /* e_from.q_paddr w comments stripped */ |
857afefe | 383 | char **e_fromdomain; /* the domain part of the sender */ |
1bcdf0a2 | 384 | ADDRESS *e_returnto; /* place to return the message to */ |
dd1fe05b | 385 | ADDRESS *e_sendqueue; /* list of message recipients */ |
3c7fe765 | 386 | ADDRESS *e_errorqueue; /* the queue for error responses */ |
dd1fe05b | 387 | long e_msgsize; /* size of the message in bytes */ |
b75b15f6 | 388 | long e_flags; /* flags, see below */ |
2e3062fe | 389 | int e_nrcpts; /* number of recipients */ |
dd1fe05b | 390 | short e_class; /* msg class (priority, junk, etc.) */ |
7338e3d4 | 391 | short e_hopcount; /* number of times processed */ |
9f27c6a8 | 392 | short e_nsent; /* number of sends since checkpoint */ |
8c8e8e94 EA |
393 | short e_sendmode; /* message send mode */ |
394 | short e_errormode; /* error return mode */ | |
3b2e4211 | 395 | short e_timeoutclass; /* message timeout class */ |
179d940c | 396 | void (*e_puthdr)__P((MCI *, HDR *, ENVELOPE *)); |
b543d6fa | 397 | /* function to put header of message */ |
179d940c | 398 | void (*e_putbody)__P((MCI *, ENVELOPE *, char *)); |
b543d6fa | 399 | /* function to put body of message */ |
dd1fe05b | 400 | struct envelope *e_parent; /* the message this one encloses */ |
e6f08ab1 | 401 | struct envelope *e_sibling; /* the next envelope of interest */ |
60eebb0d | 402 | char *e_bodytype; /* type of message body */ |
912acb74 | 403 | FILE *e_dfp; /* temporary file */ |
2cce0c26 | 404 | char *e_id; /* code for this entry in queue */ |
912acb74 | 405 | FILE *e_xfp; /* transcript file */ |
3620ad97 | 406 | FILE *e_lockfp; /* the lock file for this message */ |
553e463f | 407 | FILE *e_qfp; /* queue control file */ |
1369934e | 408 | char *e_message; /* error message */ |
86575ebf | 409 | char *e_statmsg; /* stat msg (changes per delivery) */ |
9e2d8df2 | 410 | char *e_msgboundary; /* MIME-style message part boundary */ |
e4a5cf08 | 411 | char *e_origrcpt; /* original recipient (one only) */ |
68d9129a | 412 | char *e_envid; /* envelope id from MAIL FROM: line */ |
55f9fc92 | 413 | char *e_status; /* DSN status for this message */ |
9be5c0a5 EA |
414 | time_t e_dtime; /* time of last delivery attempt */ |
415 | int e_ntries; /* number of delivery attempts */ | |
1dc7b0e0 | 416 | dev_t e_dfdev; /* df file's device, for crash recov */ |
9be5c0a5 | 417 | ino_t e_dfino; /* df file's ino, for crash recovery */ |
1be6e8d1 | 418 | char *e_macro[256]; /* macro definitions */ |
2654b031 | 419 | }; |
1a12c7d6 | 420 | |
e6f08ab1 | 421 | /* values for e_flags */ |
b75b15f6 EA |
422 | #define EF_OLDSTYLE 0x0000001 /* use spaces (not commas) in hdrs */ |
423 | #define EF_INQUEUE 0x0000002 /* this message is fully queued */ | |
c7a0eaaf | 424 | #define EF_NO_BODY_RETN 0x0000004 /* omit message body on error */ |
b75b15f6 EA |
425 | #define EF_CLRQUEUE 0x0000008 /* disk copy is no longer needed */ |
426 | #define EF_SENDRECEIPT 0x0000010 /* send a return receipt */ | |
427 | #define EF_FATALERRS 0x0000020 /* fatal errors occured */ | |
428 | #define EF_KEEPQUEUE 0x0000040 /* keep queue files always */ | |
429 | #define EF_RESPONSE 0x0000080 /* this is an error or return receipt */ | |
430 | #define EF_RESENT 0x0000100 /* this message is being forwarded */ | |
431 | #define EF_VRFYONLY 0x0000200 /* verify only (don't expand aliases) */ | |
432 | #define EF_WARNING 0x0000400 /* warning message has been sent */ | |
433 | #define EF_QUEUERUN 0x0000800 /* this envelope is from queue */ | |
434 | #define EF_GLOBALERRS 0x0001000 /* treat errors as global */ | |
435 | #define EF_PM_NOTIFY 0x0002000 /* send return mail to postmaster */ | |
436 | #define EF_METOO 0x0004000 /* send to me too */ | |
437 | #define EF_LOGSENDER 0x0008000 /* need to log the sender */ | |
cb61ef4b | 438 | #define EF_NORECEIPT 0x0010000 /* suppress all return-receipts */ |
c23930c0 | 439 | #define EF_HAS8BIT 0x0020000 /* at least one 8-bit char in body */ |
68a0f832 EA |
440 | #define EF_NL_NOT_EOL 0x0040000 /* don't accept raw NL as EOLine */ |
441 | #define EF_CRLF_NOT_EOL 0x0080000 /* don't accept CR-LF as EOLine */ | |
c7a0eaaf | 442 | #define EF_RET_PARAM 0x0100000 /* RCPT command had RET argument */ |
18a81ac0 | 443 | #define EF_HAS_DF 0x0200000 /* set when df file is instantiated */ |
15f70a93 | 444 | #define EF_IS_MIME 0x0400000 /* really is a MIME message */ |
e6f08ab1 | 445 | |
2654b031 | 446 | EXTERN ENVELOPE *CurEnv; /* envelope currently being processed */ |
179d940c EA |
447 | |
448 | /* functions */ | |
449 | extern ENVELOPE *newenvelope __P((ENVELOPE *, ENVELOPE *)); | |
450 | extern void dropenvelope __P((ENVELOPE *)); | |
451 | extern void clearenvelope __P((ENVELOPE *, bool)); | |
452 | ||
453 | extern void putheader __P((MCI *, HDR *, ENVELOPE *)); | |
454 | extern void putbody __P((MCI *, ENVELOPE *, char *)); | |
2654b031 | 455 | \f/* |
505aaba0 | 456 | ** Message priority classes. |
9ccf54c4 | 457 | ** |
505aaba0 EA |
458 | ** The message class is read directly from the Priority: header |
459 | ** field in the message. | |
df74deb0 | 460 | ** |
505aaba0 EA |
461 | ** CurEnv->e_msgpriority is the number of bytes in the message plus |
462 | ** the creation time (so that jobs ``tend'' to be ordered correctly), | |
463 | ** adjusted by the message class, the number of recipients, and the | |
464 | ** amount of time the message has been sitting around. This number | |
465 | ** is used to order the queue. Higher values mean LOWER priority. | |
466 | ** | |
467 | ** Each priority class point is worth WkClassFact priority points; | |
468 | ** each recipient is worth WkRecipFact priority points. Each time | |
469 | ** we reprocess a message the priority is adjusted by WkTimeFact. | |
470 | ** WkTimeFact should normally decrease the priority so that jobs | |
471 | ** that have historically failed will be run later; thanks go to | |
472 | ** Jay Lepreau at Utah for pointing out the error in my thinking. | |
ee32daaf | 473 | ** |
df74deb0 EA |
474 | ** The "class" is this number, unadjusted by the age or size of |
475 | ** this message. Classes with negative representations will have | |
476 | ** error messages thrown away if they are not local. | |
ed45aae1 EA |
477 | */ |
478 | ||
a444c81b EA |
479 | struct priority |
480 | { | |
481 | char *pri_name; /* external name of priority */ | |
482 | int pri_val; /* internal value for same */ | |
483 | }; | |
484 | ||
485 | EXTERN struct priority Priorities[MAXPRIORITIES]; | |
486 | EXTERN int NumPriorities; /* pointer into Priorities */ | |
2654b031 | 487 | \f/* |
d6a28dd8 EA |
488 | ** Rewrite rules. |
489 | */ | |
490 | ||
491 | struct rewrite | |
492 | { | |
493 | char **r_lhs; /* pattern match */ | |
494 | char **r_rhs; /* substitution value */ | |
495 | struct rewrite *r_next;/* next in chain */ | |
496 | }; | |
497 | ||
792a6b53 | 498 | EXTERN struct rewrite *RewriteRules[MAXRWSETS]; |
d6a28dd8 | 499 | |
792a6b53 EA |
500 | /* |
501 | ** Special characters in rewriting rules. | |
502 | ** These are used internally only. | |
503 | ** The COND* rules are actually used in macros rather than in | |
504 | ** rewriting rules, but are given here because they | |
505 | ** cannot conflict. | |
506 | */ | |
507 | ||
508 | /* left hand side items */ | |
32549112 EA |
509 | # define MATCHZANY ((u_char)0220) /* match zero or more tokens */ |
510 | # define MATCHANY ((u_char)0221) /* match one or more tokens */ | |
511 | # define MATCHONE ((u_char)0222) /* match exactly one token */ | |
512 | # define MATCHCLASS ((u_char)0223) /* match one token in a class */ | |
513 | # define MATCHNCLASS ((u_char)0224) /* match anything not in class */ | |
514 | # define MATCHREPL ((u_char)0225) /* replacement on RHS for above */ | |
41173b8f EA |
515 | # define MATCHLOOKUP '\035' /* look up and replace a sequence */ |
516 | # define MATCHELOOKUP '\036' /* end of the sequence */ | |
d6a28dd8 | 517 | |
792a6b53 | 518 | /* right hand side items */ |
32549112 EA |
519 | # define CANONNET ((u_char)0226) /* canonical net, next token */ |
520 | # define CANONHOST ((u_char)0227) /* canonical host, next token */ | |
521 | # define CANONUSER ((u_char)0230) /* canonical user, next N tokens */ | |
522 | # define CALLSUBR ((u_char)0231) /* call another rewriting set */ | |
d6a28dd8 | 523 | |
792a6b53 | 524 | /* conditionals in macros */ |
32549112 EA |
525 | # define CONDIF ((u_char)0232) /* conditional if-then */ |
526 | # define CONDELSE ((u_char)0233) /* conditional else */ | |
527 | # define CONDFI ((u_char)0234) /* conditional fi */ | |
a73ae8ac | 528 | |
58862a24 | 529 | /* bracket characters for host name lookup */ |
32549112 EA |
530 | # define HOSTBEGIN ((u_char)0235) /* hostname lookup begin */ |
531 | # define HOSTEND ((u_char)0236) /* hostname lookup end */ | |
58862a24 | 532 | |
42fa5d67 | 533 | /* bracket characters for generalized lookup */ |
32549112 EA |
534 | # define LOOKUPBEGIN ((u_char)0205) /* generalized lookup begin */ |
535 | # define LOOKUPEND ((u_char)0206) /* generalized lookup end */ | |
42fa5d67 | 536 | |
2bee003d | 537 | /* macro substitution character */ |
32549112 EA |
538 | # define MACROEXPAND ((u_char)0201) /* macro expansion */ |
539 | # define MACRODEXPAND ((u_char)0202) /* deferred macro expansion */ | |
e45dcea5 | 540 | |
7703d47a EA |
541 | /* to make the code clearer */ |
542 | # define MATCHZERO CANONHOST | |
543 | ||
e45dcea5 EA |
544 | /* external <==> internal mapping table */ |
545 | struct metamac | |
546 | { | |
547 | char metaname; /* external code (after $) */ | |
81a5ffcc | 548 | u_char metaval; /* internal code (as above) */ |
e45dcea5 | 549 | }; |
179d940c EA |
550 | |
551 | /* functions */ | |
552 | extern void expand __P((char *, char *, size_t, ENVELOPE *)); | |
553 | extern void define __P((int, char *, ENVELOPE *)); | |
554 | extern char *macvalue __P((int, ENVELOPE *)); | |
555 | extern char *macname __P((int)); | |
556 | extern int macid __P((char *, char **)); | |
2654b031 | 557 | \f/* |
c96073f7 EA |
558 | ** Name canonification short circuit. |
559 | ** | |
560 | ** If the name server for a host is down, the process of trying to | |
561 | ** canonify the name can hang. This is similar to (but alas, not | |
562 | ** identical to) looking up the name for delivery. This stab type | |
563 | ** caches the result of the name server lookup so we don't hang | |
564 | ** multiple times. | |
565 | */ | |
566 | ||
567 | #define NAMECANON struct _namecanon | |
568 | ||
569 | NAMECANON | |
570 | { | |
571 | short nc_errno; /* cached errno */ | |
572 | short nc_herrno; /* cached h_errno */ | |
573 | short nc_stat; /* cached exit status code */ | |
67283ab0 | 574 | short nc_flags; /* flag bits */ |
c96073f7 EA |
575 | char *nc_cname; /* the canonical name */ |
576 | }; | |
67283ab0 EA |
577 | |
578 | /* values for nc_flags */ | |
579 | #define NCF_VALID 0x0001 /* entry valid */ | |
c96073f7 | 580 | \f/* |
42fa5d67 EA |
581 | ** Mapping functions |
582 | ** | |
583 | ** These allow arbitrary mappings in the config file. The idea | |
584 | ** (albeit not the implementation) comes from IDA sendmail. | |
585 | */ | |
586 | ||
42fa5d67 | 587 | # define MAPCLASS struct _mapclass |
b543d6fa | 588 | # define MAP struct _map |
58979c07 | 589 | # define MAXMAPACTIONS 3 /* size of map_actions array */ |
42fa5d67 EA |
590 | |
591 | ||
592 | /* | |
593 | ** An actual map. | |
594 | */ | |
595 | ||
42fa5d67 EA |
596 | MAP |
597 | { | |
598 | MAPCLASS *map_class; /* the class of this map */ | |
713c523f | 599 | char *map_mname; /* name of this map */ |
32549112 | 600 | long map_mflags; /* flags, see below */ |
42fa5d67 | 601 | char *map_file; /* the (nominal) filename */ |
0639fd0c EA |
602 | ARBPTR_T map_db1; /* the open database ptr */ |
603 | ARBPTR_T map_db2; /* an "extra" database pointer */ | |
3b2e4211 EA |
604 | char *map_keycolnm; /* key column name */ |
605 | char *map_valcolnm; /* value column name */ | |
606 | u_char map_keycolno; /* key column number */ | |
607 | u_char map_valcolno; /* value column number */ | |
608 | char map_coldelim; /* column delimiter */ | |
32fd13db | 609 | char *map_app; /* to append to successful matches */ |
33844dcf | 610 | char *map_domain; /* the (nominal) NIS domain */ |
9d3eed3f | 611 | char *map_rebuild; /* program to run to do auto-rebuild */ |
28f94061 | 612 | time_t map_mtime; /* last database modification time */ |
66d16835 | 613 | short map_specificity; /* specificity of alaases */ |
58979c07 EA |
614 | MAP *map_stack[MAXMAPSTACK]; /* list for stacked maps */ |
615 | short map_return[MAXMAPACTIONS]; /* return bitmaps for stacked maps */ | |
42fa5d67 EA |
616 | }; |
617 | ||
95739e1a | 618 | /* bit values for map_mflags */ |
32549112 EA |
619 | # define MF_VALID 0x00000001 /* this entry is valid */ |
620 | # define MF_INCLNULL 0x00000002 /* include null byte in key */ | |
621 | # define MF_OPTIONAL 0x00000004 /* don't complain if map not found */ | |
622 | # define MF_NOFOLDCASE 0x00000008 /* don't fold case in keys */ | |
623 | # define MF_MATCHONLY 0x00000010 /* don't use the map value */ | |
624 | # define MF_OPEN 0x00000020 /* this entry is open */ | |
625 | # define MF_WRITABLE 0x00000040 /* open for writing */ | |
626 | # define MF_ALIAS 0x00000080 /* this is an alias file */ | |
627 | # define MF_TRY0NULL 0x00000100 /* try with no null byte */ | |
628 | # define MF_TRY1NULL 0x00000200 /* try with the null byte */ | |
629 | # define MF_LOCKED 0x00000400 /* this map is currently locked */ | |
630 | # define MF_ALIASWAIT 0x00000800 /* alias map in aliaswait state */ | |
631 | # define MF_IMPL_HASH 0x00001000 /* implicit: underlying hash database */ | |
632 | # define MF_IMPL_NDBM 0x00002000 /* implicit: underlying NDBM database */ | |
633 | # define MF_UNSAFEDB 0x00004000 /* this map is world writable */ | |
634 | # define MF_APPEND 0x00008000 /* append new entry on rebuiled */ | |
31118725 | 635 | # define MF_KEEPQUOTES 0x00010000 /* don't dequote key before lookup */ |
b543d6fa | 636 | |
3b2e4211 EA |
637 | /* indices for map_actions */ |
638 | # define MA_NOTFOUND 0 /* member map returned "not found" */ | |
639 | # define MA_UNAVAIL 1 /* member map is not available */ | |
640 | # define MA_TRYAGAIN 2 /* member map returns temp failure */ | |
b543d6fa EA |
641 | |
642 | /* | |
643 | ** The class of a map -- essentially the functions to call | |
644 | */ | |
645 | ||
646 | MAPCLASS | |
647 | { | |
713c523f EA |
648 | char *map_cname; /* name of this map class */ |
649 | char *map_ext; /* extension for database file */ | |
31f1ab13 | 650 | short map_cflags; /* flag bits, see below */ |
713c523f EA |
651 | bool (*map_parse)__P((MAP *, char *)); |
652 | /* argument parsing function */ | |
653 | char *(*map_lookup)__P((MAP *, char *, char **, int *)); | |
b543d6fa | 654 | /* lookup function */ |
713c523f EA |
655 | void (*map_store)__P((MAP *, char *, char *)); |
656 | /* store function */ | |
713c523f EA |
657 | bool (*map_open)__P((MAP *, int)); |
658 | /* open function */ | |
659 | void (*map_close)__P((MAP *)); | |
660 | /* close function */ | |
b543d6fa | 661 | }; |
31f1ab13 EA |
662 | |
663 | /* bit values for map_cflags */ | |
664 | #define MCF_ALIASOK 0x0001 /* can be used for aliases */ | |
665 | #define MCF_ALIASONLY 0x0002 /* usable only for aliases */ | |
666 | #define MCF_REBUILDABLE 0x0004 /* can rebuild alias files */ | |
db5bc5c7 | 667 | #define MCF_OPTFILE 0x0008 /* file name is optional */ |
179d940c EA |
668 | |
669 | /* functions */ | |
670 | extern char *map_rewrite __P((MAP *, char *, int, char **)); | |
62f1213f | 671 | extern MAP *makemapentry __P((char *)); |
42fa5d67 | 672 | \f/* |
4d3a97d9 EA |
673 | ** Symbol table definitions |
674 | */ | |
675 | ||
676 | struct symtab | |
677 | { | |
678 | char *s_name; /* name to be entered */ | |
cdb17311 | 679 | char s_type; /* general type (see below) */ |
4d3a97d9 | 680 | struct symtab *s_next; /* pointer to next in chain */ |
cdb17311 EA |
681 | union |
682 | { | |
2e3062fe EA |
683 | BITMAP sv_class; /* bit-map of word classes */ |
684 | ADDRESS *sv_addr; /* pointer to address header */ | |
685 | MAILER *sv_mailer; /* pointer to mailer */ | |
686 | char *sv_alias; /* alias */ | |
31f1ab13 | 687 | MAPCLASS sv_mapclass; /* mapping function class */ |
42fa5d67 | 688 | MAP sv_map; /* mapping function */ |
ae21f7bc | 689 | char *sv_hostsig; /* host signature */ |
f2e44ded | 690 | MCI sv_mci; /* mailer connection info */ |
c96073f7 | 691 | NAMECANON sv_namecanon; /* canonical name cache */ |
1be6e8d1 | 692 | int sv_macro; /* macro name => id mapping */ |
ebec3e1f | 693 | int sv_ruleset; /* ruleset index */ |
cdb17311 | 694 | } s_value; |
4d3a97d9 EA |
695 | }; |
696 | ||
697 | typedef struct symtab STAB; | |
698 | ||
cdb17311 EA |
699 | /* symbol types */ |
700 | # define ST_UNDEF 0 /* undefined type */ | |
701 | # define ST_CLASS 1 /* class map */ | |
702 | # define ST_ADDRESS 2 /* an address in parsed format */ | |
703 | # define ST_MAILER 3 /* a mailer header */ | |
704 | # define ST_ALIAS 4 /* an alias */ | |
e62e1144 EA |
705 | # define ST_MAPCLASS 5 /* mapping function class */ |
706 | # define ST_MAP 6 /* mapping function */ | |
ae21f7bc | 707 | # define ST_HOSTSIG 7 /* host signature */ |
c96073f7 | 708 | # define ST_NAMECANON 8 /* cached canonical name */ |
1be6e8d1 | 709 | # define ST_MACRO 9 /* macro name to id mapping */ |
ebec3e1f | 710 | # define ST_RULESET 10 /* ruleset index */ |
f2e44ded | 711 | # define ST_MCI 16 /* mailer connection info (offset) */ |
cdb17311 EA |
712 | |
713 | # define s_class s_value.sv_class | |
14a39063 | 714 | # define s_address s_value.sv_addr |
cdb17311 EA |
715 | # define s_mailer s_value.sv_mailer |
716 | # define s_alias s_value.sv_alias | |
2ae0e0ed | 717 | # define s_mci s_value.sv_mci |
cdb17311 | 718 | |
5a972da1 | 719 | extern STAB *stab __P((char *, int, int)); |
46d8f512 | 720 | extern void stabapply __P((void (*)(STAB *, int), int)); |
4d3a97d9 EA |
721 | |
722 | /* opcodes to stab */ | |
723 | # define ST_FIND 0 /* find entry */ | |
724 | # define ST_ENTER 1 /* enter if not there */ | |
2654b031 | 725 | \f/* |
2439b900 EA |
726 | ** STRUCT EVENT -- event queue. |
727 | ** | |
728 | ** Maintained in sorted order. | |
f5d25d7b EA |
729 | ** |
730 | ** We store the pid of the process that set this event to insure | |
731 | ** that when we fork we will not take events intended for the parent. | |
2439b900 EA |
732 | */ |
733 | ||
734 | struct event | |
735 | { | |
736 | time_t ev_time; /* time of the function call */ | |
ea07b2d2 | 737 | void (*ev_func)__P((int)); |
b543d6fa | 738 | /* function to call */ |
2439b900 | 739 | int ev_arg; /* argument to ev_func */ |
f5d25d7b | 740 | int ev_pid; /* pid that set this event */ |
2439b900 EA |
741 | struct event *ev_link; /* link to next item */ |
742 | }; | |
743 | ||
744 | typedef struct event EVENT; | |
745 | ||
746 | EXTERN EVENT *EventQueue; /* head of event queue */ | |
179d940c EA |
747 | |
748 | /* functions */ | |
749 | extern EVENT *setevent __P((time_t, void(*)(), int)); | |
750 | extern void clrevent __P((EVENT *)); | |
2439b900 | 751 | \f/* |
c23930c0 | 752 | ** Operation, send, error, and MIME modes |
75f95954 EA |
753 | ** |
754 | ** The operation mode describes the basic operation of sendmail. | |
755 | ** This can be set from the command line, and is "send mail" by | |
756 | ** default. | |
757 | ** | |
758 | ** The send mode tells how to send mail. It can be set in the | |
759 | ** configuration file. It's setting determines how quickly the | |
760 | ** mail will be delivered versus the load on your system. If the | |
761 | ** -v (verbose) flag is given, it will be forced to SM_DELIVER | |
762 | ** mode. | |
763 | ** | |
7338e3d4 | 764 | ** The error mode tells how to return errors. |
d0bd03ce EA |
765 | */ |
766 | ||
75f95954 | 767 | EXTERN char OpMode; /* operation mode, see below */ |
d0bd03ce | 768 | |
75f95954 | 769 | #define MD_DELIVER 'm' /* be a mail sender */ |
75f95954 | 770 | #define MD_SMTP 's' /* run SMTP on standard input */ |
dd06c909 | 771 | #define MD_ARPAFTP 'a' /* obsolete ARPANET mode (Grey Book) */ |
d0bd03ce EA |
772 | #define MD_DAEMON 'd' /* run as a daemon */ |
773 | #define MD_VERIFY 'v' /* verify: don't collect or deliver */ | |
44cb7eee | 774 | #define MD_TEST 't' /* test mode: resolve addrs only */ |
6bf17095 EA |
775 | #define MD_INITALIAS 'i' /* initialize alias database */ |
776 | #define MD_PRINT 'p' /* print the queue */ | |
777 | #define MD_FREEZE 'z' /* freeze the configuration file */ | |
d0bd03ce | 778 | |
75f95954 | 779 | |
8c8e8e94 | 780 | /* values for e_sendmode -- send modes */ |
75f95954 | 781 | #define SM_DELIVER 'i' /* interactive delivery */ |
75f95954 EA |
782 | #define SM_FORK 'b' /* deliver in background */ |
783 | #define SM_QUEUE 'q' /* queue, don't deliver */ | |
784 | #define SM_VERIFY 'v' /* verify only (used internally) */ | |
7338e3d4 | 785 | |
eefcf91f EA |
786 | /* used only as a parameter to sendall */ |
787 | #define SM_DEFAULT '\0' /* unspecified, use SendMode */ | |
788 | ||
7338e3d4 | 789 | |
8c8e8e94 | 790 | /* values for e_errormode -- error handling modes */ |
7338e3d4 EA |
791 | #define EM_PRINT 'p' /* print errors */ |
792 | #define EM_MAIL 'm' /* mail back errors */ | |
793 | #define EM_WRITE 'w' /* write back errors */ | |
794 | #define EM_BERKNET 'e' /* special berknet processing */ | |
795 | #define EM_QUIET 'q' /* don't print messages (stat only) */ | |
c23930c0 EA |
796 | |
797 | ||
798 | /* MIME processing mode */ | |
799 | EXTERN int MimeMode; | |
800 | ||
801 | /* bit values for MimeMode */ | |
802 | #define MM_CVTMIME 0x0001 /* convert 8 to 7 bit MIME */ | |
803 | #define MM_PASS8BIT 0x0002 /* just send 8 bit data blind */ | |
804 | #define MM_MIME8BIT 0x0004 /* convert 8-bit data to MIME */ | |
92830179 EA |
805 | |
806 | /* queue sorting order algorithm */ | |
807 | EXTERN int QueueSortOrder; | |
808 | ||
809 | #define QS_BYPRIORITY 0 /* sort by message priority */ | |
810 | #define QS_BYHOST 1 /* sort by first host name */ | |
5dc3d2c7 EA |
811 | |
812 | ||
813 | /* how to handle messages without any recipient addresses */ | |
814 | EXTERN int NoRecipientAction; | |
815 | ||
816 | #define NRA_NO_ACTION 0 /* just leave it as is */ | |
817 | #define NRA_ADD_TO 1 /* add To: header */ | |
818 | #define NRA_ADD_APPARENTLY_TO 2 /* add Apparently-To: header */ | |
819 | #define NRA_ADD_BCC 3 /* add empty Bcc: header */ | |
820 | #define NRA_ADD_TO_UNDISCLOSED 4 /* add To: undisclosed:; header */ | |
568b126e EA |
821 | |
822 | ||
823 | /* flags to putxline */ | |
824 | #define PXLF_NOTHINGSPECIAL 0 /* no special mapping */ | |
825 | #define PXLF_MAPFROM 0x0001 /* map From_ to >From_ */ | |
826 | #define PXLF_STRIP8BIT 0x0002 /* strip 8th bit *e | |
e3ecd56f EA |
827 | \f/* |
828 | ** Additional definitions | |
829 | */ | |
830 | ||
20951c3f | 831 | |
e3ecd56f EA |
832 | /* |
833 | ** Privacy flags | |
834 | ** These are bit values for the PrivacyFlags word. | |
835 | */ | |
836 | ||
1c7897ef | 837 | #define PRIV_PUBLIC 0 /* what have I got to hide? */ |
b5cdafa3 EA |
838 | #define PRIV_NEEDMAILHELO 0x0001 /* insist on HELO for MAIL, at least */ |
839 | #define PRIV_NEEDEXPNHELO 0x0002 /* insist on HELO for EXPN */ | |
840 | #define PRIV_NEEDVRFYHELO 0x0004 /* insist on HELO for VRFY */ | |
841 | #define PRIV_NOEXPN 0x0008 /* disallow EXPN command entirely */ | |
842 | #define PRIV_NOVRFY 0x0010 /* disallow VRFY command entirely */ | |
843 | #define PRIV_AUTHWARNINGS 0x0020 /* flag possible authorization probs */ | |
844 | #define PRIV_NORECEIPTS 0x0040 /* disallow return receipts */ | |
845 | #define PRIV_RESTRICTMAILQ 0x1000 /* restrict mailq command */ | |
846 | #define PRIV_RESTRICTQRUN 0x2000 /* restrict queue run */ | |
847 | #define PRIV_GOAWAY 0x0fff /* don't give no info, anyway, anyhow */ | |
1c7897ef EA |
848 | |
849 | /* struct defining such things */ | |
850 | struct prival | |
851 | { | |
852 | char *pv_name; /* name of privacy flag */ | |
853 | int pv_flag; /* numeric level */ | |
854 | }; | |
3341995c | 855 | |
e3ecd56f EA |
856 | |
857 | /* | |
28f94061 | 858 | ** Flags passed to remotename, parseaddr, allocaddr, and buildaddr. |
e3ecd56f EA |
859 | */ |
860 | ||
b5cdafa3 EA |
861 | #define RF_SENDERADDR 0x001 /* this is a sender address */ |
862 | #define RF_HEADERADDR 0x002 /* this is a header address */ | |
863 | #define RF_CANONICAL 0x004 /* strip comment information */ | |
864 | #define RF_ADDDOMAIN 0x008 /* OK to do domain extension */ | |
865 | #define RF_COPYPARSE 0x010 /* copy parsed user & host */ | |
866 | #define RF_COPYPADDR 0x020 /* copy print address */ | |
28f94061 EA |
867 | #define RF_COPYALL (RF_COPYPARSE|RF_COPYPADDR) |
868 | #define RF_COPYNONE 0 | |
e3ecd56f | 869 | |
fce21cb9 EA |
870 | |
871 | /* | |
872 | ** Flags passed to safefile. | |
873 | */ | |
874 | ||
f16ad954 EA |
875 | #define SFF_ANYFILE 0 /* no special restrictions */ |
876 | #define SFF_MUSTOWN 0x0001 /* user must own this file */ | |
877 | #define SFF_NOSLINK 0x0002 /* file cannot be a symbolic link */ | |
e2ac6a24 | 878 | #define SFF_ROOTOK 0x0004 /* ok for root to own this file */ |
39ce28fb | 879 | #define SFF_RUNASREALUID 0x0008 /* if no ctladdr, run as real uid */ |
e4a6739d | 880 | #define SFF_NOPATHCHECK 0x0010 /* don't bother checking dir path */ |
d52f8819 EA |
881 | #define SFF_SETUIDOK 0x0020 /* setuid files are ok */ |
882 | #define SFF_CREAT 0x0040 /* ok to create file if necessary */ | |
6e4a5e06 | 883 | #define SFF_REGONLY 0x0080 /* regular files only */ |
fce21cb9 | 884 | |
ed47dc44 EA |
885 | /* flags that are actually specific to safefopen */ |
886 | #define SFF_OPENASROOT 0x1000 /* open as root instead of real user */ | |
887 | ||
fce21cb9 | 888 | |
022362dd EA |
889 | /* |
890 | ** Flags passed to mime8to7. | |
891 | */ | |
892 | ||
893 | #define M87F_OUTER 0 /* outer context */ | |
894 | #define M87F_NO8BIT 0x0001 /* can't have 8-bit in this section */ | |
568b126e | 895 | #define M87F_DIGEST 0x0002 /* processing multipart/digest */ |
022362dd EA |
896 | |
897 | ||
3341995c EA |
898 | /* |
899 | ** Regular UNIX sockaddrs are too small to handle ISO addresses, so | |
900 | ** we are forced to declare a supertype here. | |
901 | */ | |
902 | ||
3356c77c | 903 | union bigsockaddr |
3341995c | 904 | { |
3356c77c | 905 | struct sockaddr sa; /* general version */ |
a40faef5 | 906 | #if NETUNIX |
2122a474 | 907 | struct sockaddr_un sunix; /* UNIX family */ |
3a4fbef8 | 908 | #endif |
a40faef5 | 909 | #if NETINET |
3356c77c EA |
910 | struct sockaddr_in sin; /* INET family */ |
911 | #endif | |
a40faef5 | 912 | #if NETISO |
3356c77c EA |
913 | struct sockaddr_iso siso; /* ISO family */ |
914 | #endif | |
a40faef5 | 915 | #if NETNS |
88e65f7c EA |
916 | struct sockaddr_ns sns; /* XNS family */ |
917 | #endif | |
a40faef5 | 918 | #if NETX25 |
88e65f7c EA |
919 | struct sockaddr_x25 sx25; /* X.25 family */ |
920 | #endif | |
3341995c EA |
921 | }; |
922 | ||
3356c77c | 923 | #define SOCKADDR union bigsockaddr |
13311af1 EA |
924 | |
925 | ||
926 | /* | |
927 | ** Vendor codes | |
928 | ** | |
929 | ** Vendors can customize sendmail to add special behaviour, | |
930 | ** generally for back compatibility. Ideally, this should | |
931 | ** be set up in the .cf file using the "V" command. However, | |
932 | ** it's quite reasonable for some vendors to want the default | |
933 | ** be their old version; this can be set using | |
934 | ** -DVENDOR_DEFAULT=VENDOR_xxx | |
935 | ** in the Makefile. | |
936 | ** | |
937 | ** Vendors should apply to sendmail@CS.Berkeley.EDU for | |
938 | ** unique vendor codes. | |
939 | */ | |
940 | ||
941 | #define VENDOR_BERKELEY 1 /* Berkeley-native configuration file */ | |
942 | #define VENDOR_SUN 2 /* Sun-native configuration file */ | |
4874708a | 943 | #define VENDOR_HP 3 /* Hewlett-Packard specific config syntax */ |
13311af1 EA |
944 | |
945 | EXTERN int VendorCode; /* vendor-specific operation enhancements */ | |
d0bd03ce | 946 | \f/* |
b3cbe40f EA |
947 | ** Global variables. |
948 | */ | |
949 | ||
327272f5 | 950 | EXTERN bool FromFlag; /* if set, "From" person is explicit */ |
327272f5 EA |
951 | EXTERN bool MeToo; /* send to the sender also */ |
952 | EXTERN bool IgnrDot; /* don't let dot end messages */ | |
953 | EXTERN bool SaveFrom; /* save leading "From" lines */ | |
954 | EXTERN bool Verbose; /* set if blow-by-blow desired */ | |
955 | EXTERN bool GrabTo; /* if set, get recipients from msg */ | |
cbdb7357 | 956 | EXTERN bool SuprErrs; /* set if we are suppressing errors */ |
49086753 | 957 | EXTERN bool HoldErrs; /* only output errors to transcript */ |
3135d20c | 958 | EXTERN bool NoConnect; /* don't connect to non-local mailers */ |
c1e24818 | 959 | EXTERN bool SuperSafe; /* be extra careful, even if expensive */ |
2e3062fe | 960 | EXTERN bool ForkQueueRuns; /* fork for each job when running the queue */ |
6bf17095 | 961 | EXTERN bool AutoRebuild; /* auto-rebuild the alias database as needed */ |
7355ccf5 | 962 | EXTERN bool CheckAliases; /* parse addresses during newaliases */ |
c420ea6b | 963 | EXTERN bool NoAlias; /* suppress aliasing */ |
58979c07 | 964 | EXTERN bool UseNameServer; /* using DNS -- interpret h_errno & MX RRs */ |
bc0cae7d | 965 | EXTERN bool UseHesiod; /* using Hesiod -- interpret Hesiod errors */ |
c23930c0 EA |
966 | EXTERN bool SevenBitInput; /* force 7-bit data on input */ |
967 | EXTERN bool HasEightBits; /* has at least one eight bit input byte */ | |
487582d9 | 968 | EXTERN time_t SafeAlias; /* interval to wait until @:@ in alias file */ |
cbdb7357 EA |
969 | EXTERN FILE *InChannel; /* input connection */ |
970 | EXTERN FILE *OutChannel; /* output connection */ | |
6c25232c EA |
971 | EXTERN char *RealUserName; /* real user name of caller */ |
972 | EXTERN uid_t RealUid; /* real uid of caller */ | |
973 | EXTERN gid_t RealGid; /* real gid of caller */ | |
05c5b8b4 EA |
974 | EXTERN uid_t DefUid; /* default uid to run as */ |
975 | EXTERN gid_t DefGid; /* default gid to run as */ | |
3fbc69d6 | 976 | EXTERN char *DefUser; /* default user to run as (from DefUid) */ |
327272f5 | 977 | EXTERN int OldUmask; /* umask when sendmail starts up */ |
1ea752a1 | 978 | EXTERN int Errors; /* set if errors (local to single pass) */ |
327272f5 | 979 | EXTERN int ExitStat; /* exit status code */ |
792a6b53 | 980 | EXTERN int LineNumber; /* line number in current input */ |
c1e24818 | 981 | EXTERN int LogLevel; /* level of logging to perform */ |
d9667c04 | 982 | EXTERN int FileMode; /* mode on files */ |
2e3062fe EA |
983 | EXTERN int QueueLA; /* load average starting forced queueing */ |
984 | EXTERN int RefuseLA; /* load average refusing connections are */ | |
3620ad97 | 985 | EXTERN int CurrentLA; /* current load average */ |
faad4dd5 | 986 | EXTERN long QueueFactor; /* slope of queue function */ |
ed45aae1 | 987 | EXTERN time_t QueueIntvl; /* intervals between running the queue */ |
c1e24818 | 988 | EXTERN char *HelpFile; /* location of SMTP help file */ |
05c5b8b4 | 989 | EXTERN char *ErrMsgFile; /* file to prepend to all error messages */ |
c1e24818 EA |
990 | EXTERN char *StatFile; /* location of statistics summary */ |
991 | EXTERN char *QueueDir; /* location of queue directory */ | |
7338e3d4 | 992 | EXTERN char *FileName; /* name to print on error messages */ |
2e3062fe | 993 | EXTERN char *SmtpPhase; /* current phase in SMTP processing */ |
57c97d4a | 994 | EXTERN char *MyHostName; /* name of this host for SMTP messages */ |
2e3062fe | 995 | EXTERN char *RealHostName; /* name of host we are talking to */ |
3341995c | 996 | EXTERN SOCKADDR RealHostAddr; /* address of host we are talking to */ |
57c97d4a | 997 | EXTERN char *CurHostName; /* current host we are dealing with */ |
c1e24818 EA |
998 | EXTERN jmp_buf TopFrame; /* branch-to-top-of-loop-on-error frame */ |
999 | EXTERN bool QuickAbort; /* .... but only if we want a quick abort */ | |
f61c3c40 | 1000 | EXTERN bool LogUsrErrs; /* syslog user errors (e.g., SMTP RCPT cmd) */ |
64409ce4 EA |
1001 | EXTERN bool SendMIMEErrors; /* send error messages in MIME format */ |
1002 | EXTERN bool MatchGecos; /* look for user names in gecos field */ | |
acc25d70 | 1003 | EXTERN bool UseErrorsTo; /* use Errors-To: header (back compat) */ |
d4f6a25e | 1004 | EXTERN bool TryNullMXList; /* if we are the best MX, try host directly */ |
fe3849ea | 1005 | EXTERN bool InChild; /* true if running in an SMTP subprocess */ |
2653232b | 1006 | EXTERN bool DisConnected; /* running with OutChannel redirected to xf */ |
79bf226a | 1007 | EXTERN bool ColonOkInAddr; /* single colon legal in address */ |
a7fab044 | 1008 | EXTERN bool NoMXforCanon; /* don't use MX records when canonifying */ |
64409ce4 | 1009 | EXTERN char SpaceSub; /* substitution for <lwsp> */ |
1c7897ef | 1010 | EXTERN int PrivacyFlags; /* privacy flags */ |
7150062b | 1011 | EXTERN char *ConfFile; /* location of configuration file [conf.c] */ |
1c7897ef | 1012 | extern char *PidFile; /* location of proc id file [conf.c] */ |
2e3062fe | 1013 | extern ADDRESS NullAddress; /* a null (template) address [main.c] */ |
faad4dd5 EA |
1014 | EXTERN long WkClassFact; /* multiplier for message class -> priority */ |
1015 | EXTERN long WkRecipFact; /* multiplier for # of recipients -> priority */ | |
1016 | EXTERN long WkTimeFact; /* priority offset each time this job is run */ | |
64409ce4 EA |
1017 | EXTERN char *UdbSpec; /* user database source spec */ |
1018 | EXTERN int MaxHopCount; /* max # of hops until bounce */ | |
1019 | EXTERN int ConfigLevel; /* config file level */ | |
1020 | EXTERN char *TimeZoneSpec; /* override time zone specification */ | |
1021 | EXTERN char *ForwardPath; /* path to search for .forward files */ | |
1022 | EXTERN long MinBlocksFree; /* min # of blocks free on queue fs */ | |
1023 | EXTERN char *FallBackMX; /* fall back MX host */ | |
1024 | EXTERN long MaxMessageSize; /* advertised max size we will accept */ | |
3d85b03a EA |
1025 | EXTERN time_t MaxHostStatAge; /* max age of cached host status info */ |
1026 | EXTERN time_t MinQueueAge; /* min delivery interval */ | |
73943d18 | 1027 | EXTERN time_t DialDelay; /* delay between dial-on-demand tries */ |
f967a599 | 1028 | EXTERN char *SafeFileEnv; /* chroot location for file delivery */ |
f0416b32 | 1029 | EXTERN char *HostsFile; /* path to /etc/hosts file */ |
4adc40ad | 1030 | EXTERN int MaxQueueRun; /* maximum number of jobs in one queue run */ |
aa6383c2 EA |
1031 | EXTERN int MaxChildren; /* maximum number of daemonic children */ |
1032 | EXTERN int CurChildren; /* current number of daemonic children */ | |
0868adc3 | 1033 | EXTERN char *ServiceSwitchFile; /* backup service switch */ |
a50ac3e2 | 1034 | EXTERN char *DefaultCharSet; /* default character set for MIME */ |
3d85b03a | 1035 | EXTERN int DeliveryNiceness; /* how nice to be during delivery */ |
2e3062fe | 1036 | EXTERN char *PostMasterCopy; /* address to get errs cc's */ |
8dcff118 | 1037 | EXTERN int CheckpointInterval; /* queue file checkpoint interval */ |
63d473ff | 1038 | EXTERN bool DontPruneRoutes; /* don't prune source routes */ |
49a18928 | 1039 | EXTERN bool DontExpandCnames; /* do not $[...$] expand CNAMEs */ |
a979db86 | 1040 | EXTERN int MaxMciCache; /* maximum entries in MCI cache */ |
f2e44ded | 1041 | EXTERN time_t MciCacheTimeout; /* maximum idle time on connections */ |
d6c28d1a EA |
1042 | EXTERN char *QueueLimitRecipient; /* limit queue runs to this recipient */ |
1043 | EXTERN char *QueueLimitSender; /* limit queue runs to this sender */ | |
1044 | EXTERN char *QueueLimitId; /* limit queue runs to this id */ | |
8e5c6745 | 1045 | EXTERN FILE *TrafficLogFile; /* file in which to log all traffic */ |
05b75231 EA |
1046 | EXTERN char *UserEnviron[MAXUSERENVIRON + 1]; |
1047 | /* saved user environment */ | |
3a4fbef8 | 1048 | extern int errno; |
7f5e2eef EA |
1049 | |
1050 | ||
1051 | /* | |
1052 | ** Timeouts | |
1053 | ** | |
1054 | ** Indicated values are the MINIMUM per RFC 1123 section 5.3.2. | |
1055 | */ | |
1056 | ||
1057 | EXTERN struct | |
1058 | { | |
cf7a936d | 1059 | /* RFC 1123-specified timeouts [minimum value] */ |
7f5e2eef EA |
1060 | time_t to_initial; /* initial greeting timeout [5m] */ |
1061 | time_t to_mail; /* MAIL command [5m] */ | |
1062 | time_t to_rcpt; /* RCPT command [5m] */ | |
1063 | time_t to_datainit; /* DATA initiation [2m] */ | |
1064 | time_t to_datablock; /* DATA block [3m] */ | |
1065 | time_t to_datafinal; /* DATA completion [10m] */ | |
1066 | time_t to_nextcommand; /* next command [5m] */ | |
1067 | /* following timeouts are not mentioned in RFC 1123 */ | |
1068 | time_t to_rset; /* RSET command */ | |
1069 | time_t to_helo; /* HELO command */ | |
1070 | time_t to_quit; /* QUIT command */ | |
1071 | time_t to_miscshort; /* misc short commands (NOOP, VERB, etc) */ | |
cf7a936d | 1072 | time_t to_ident; /* IDENT protocol requests */ |
039f3bb5 | 1073 | time_t to_fileopen; /* opening :include: and .forward files */ |
c2bdb1dd | 1074 | /* following are per message */ |
3b2e4211 EA |
1075 | time_t to_q_return[MAXTOCLASS]; /* queue return timeouts */ |
1076 | time_t to_q_warning[MAXTOCLASS]; /* queue warning timeouts */ | |
7f5e2eef EA |
1077 | } TimeOuts; |
1078 | ||
3b2e4211 EA |
1079 | /* timeout classes for return and warning timeouts */ |
1080 | # define TOC_NORMAL 0 /* normal delivery */ | |
1081 | # define TOC_URGENT 1 /* urgent delivery */ | |
1082 | # define TOC_NONURGENT 2 /* non-urgent delivery */ | |
1083 | ||
7f5e2eef EA |
1084 | |
1085 | /* | |
9678c96d EA |
1086 | ** Trace information |
1087 | */ | |
b3cbe40f | 1088 | |
9678c96d EA |
1089 | /* trace vector and macros for debugging flags */ |
1090 | EXTERN u_char tTdvect[100]; | |
1091 | # define tTd(flag, level) (tTdvect[flag] >= level) | |
1092 | # define tTdlevel(flag) (tTdvect[flag]) | |
1093 | \f/* | |
1094 | ** Miscellaneous information. | |
1095 | */ | |
b3cbe40f | 1096 | |
b3cbe40f | 1097 | |
15842c3c EA |
1098 | |
1099 | /* | |
1100 | ** Some in-line functions | |
1101 | */ | |
1102 | ||
1103 | /* set exit status */ | |
c8ec8736 EA |
1104 | #define setstat(s) { \ |
1105 | if (ExitStat == EX_OK || ExitStat == EX_TEMPFAIL) \ | |
1106 | ExitStat = s; \ | |
1107 | } | |
29871fef | 1108 | |
15842c3c | 1109 | /* make a copy of a string */ |
c8ec8736 | 1110 | #define newstr(s) strcpy(xalloc(strlen(s) + 1), s) |
15842c3c | 1111 | |
2e3062fe EA |
1112 | #define STRUCTCOPY(s, d) d = s |
1113 | ||
15842c3c EA |
1114 | |
1115 | /* | |
1116 | ** Declarations of useful functions | |
1117 | */ | |
29871fef | 1118 | |
179d940c EA |
1119 | extern char *xalloc __P((int)); |
1120 | extern FILE *dfopen __P((char *, int, int)); | |
1121 | extern char *sfgets __P((char *, int, FILE *, time_t, char *)); | |
1122 | extern char *queuename __P((ENVELOPE *, int)); | |
1123 | extern time_t curtime __P(()); | |
1124 | extern bool transienterror __P((int)); | |
1125 | extern char *fgetfolded __P((char *, int, FILE *)); | |
1126 | extern char *username __P(()); | |
1127 | extern char *pintvl __P((time_t, bool)); | |
1128 | extern char *anynet_ntoa __P((SOCKADDR *)); | |
1129 | extern bool shouldqueue __P((long, time_t)); | |
1130 | extern bool lockfile __P((int, char *, char *, int)); | |
1131 | extern char *hostsignature __P((MAILER *, char *, ENVELOPE *)); | |
1132 | extern void openxscript __P((ENVELOPE *)); | |
1133 | extern void closexscript __P((ENVELOPE *)); | |
1134 | extern char *shortenstring __P((const char *, int)); | |
1135 | extern bool usershellok __P((char *)); | |
1136 | extern void commaize __P((HDR *, char *, bool, MCI *, ENVELOPE *)); | |
1137 | extern char *hvalue __P((char *, HDR *)); | |
1138 | extern char *defcharset __P((ENVELOPE *)); | |
1139 | extern bool wordinclass __P((char *, int)); | |
1140 | extern char *denlstring __P((char *, bool, bool)); | |
1141 | extern void makelower __P((char *)); | |
1142 | extern void rebuildaliases __P((MAP *, bool)); | |
1143 | extern void readaliases __P((MAP *, FILE *, bool, bool)); | |
1144 | extern void finis __P(()); | |
1145 | extern void setsender __P((char *, ENVELOPE *, char **, bool)); | |
1146 | extern FILE *safefopen __P((char *, int, int, int)); | |
1147 | extern void xputs __P((const char *)); | |
1148 | extern void logsender __P((ENVELOPE *, char *)); | |
1149 | extern void smtprset __P((MAILER *, MCI *, ENVELOPE *)); | |
1150 | extern void smtpquit __P((MAILER *, MCI *, ENVELOPE *)); | |
1151 | extern void setuserenv __P((const char *, const char *)); | |
1152 | extern void disconnect __P((int, ENVELOPE *)); | |
1153 | extern void putxline __P((char *, MCI *, int)); | |
1154 | extern void dumpfd __P((int, bool, bool)); | |
179d940c EA |
1155 | extern void makemailer __P((char *)); |
1156 | extern void putfromline __P((MCI *, ENVELOPE *)); | |
1157 | extern void setoption __P((int, char *, bool, bool, ENVELOPE *)); | |
1158 | extern void setclass __P((int, char *)); | |
1159 | extern void inittimeouts __P((char *)); | |
1160 | extern void logdelivery __P((MAILER *, MCI *, const char *, ADDRESS *, time_t, ENVELOPE *)); | |
1161 | extern void giveresponse __P((int, MAILER *, MCI *, ADDRESS *, time_t, ENVELOPE *)); | |
1162 | ||
713c523f | 1163 | extern const char *errstring __P((int)); |
53335960 | 1164 | extern sigfunc_t setsignal __P((int, sigfunc_t)); |
5fde1e81 EA |
1165 | extern struct hostent *sm_gethostbyname __P((char *)); |
1166 | extern struct hostent *sm_gethostbyaddr __P((char *, int, int)); | |
1435d39a | 1167 | extern struct passwd *sm_getpwnam __P((char *)); |
782a2f97 | 1168 | extern struct passwd *sm_getpwuid __P((UID_T)); |
58633cc7 | 1169 | |
179d940c EA |
1170 | #ifdef XDEBUG |
1171 | extern void checkfd012 __P((char *)); | |
1172 | #endif | |
1173 | ||
58633cc7 EA |
1174 | /* ellipsis is a different case though */ |
1175 | #ifdef __STDC__ | |
34025690 EA |
1176 | extern void auth_warning(ENVELOPE *, const char *, ...); |
1177 | extern void syserr(const char *, ...); | |
1178 | extern void usrerr(const char *, ...); | |
1179 | extern void message(const char *, ...); | |
1180 | extern void nmessage(const char *, ...); | |
58633cc7 | 1181 | #else |
713c523f EA |
1182 | extern void auth_warning(); |
1183 | extern void syserr(); | |
1184 | extern void usrerr(); | |
1185 | extern void message(); | |
1186 | extern void nmessage(); | |
58633cc7 | 1187 | #endif |
70aca632 EA |
1188 | |
1189 | /* | |
1190 | ** HACK to fix bug in C compiler on CCI | |
1191 | */ | |
1192 | ||
1193 | #undef isascii | |
5eddb1af | 1194 | #define isascii(x) (((x) & ~0177) == 0) |