[12553] | 1 | /* |
---|
| 2 | * Copyright (c) 1998 Sendmail, Inc. All rights reserved. |
---|
| 3 | * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. |
---|
| 4 | * Copyright (c) 1988, 1993 |
---|
| 5 | * The Regents of the University of California. All rights reserved. |
---|
| 6 | * |
---|
| 7 | * By using this file, you agree to the terms and conditions set |
---|
| 8 | * forth in the LICENSE file which can be found at the top level of |
---|
| 9 | * the sendmail distribution. |
---|
| 10 | * |
---|
| 11 | * |
---|
| 12 | * @(#)sendmail.h 8.295 (Berkeley) 1/26/1999 |
---|
| 13 | */ |
---|
| 14 | |
---|
| 15 | /* |
---|
| 16 | ** SENDMAIL.H -- Global definitions for sendmail. |
---|
| 17 | */ |
---|
| 18 | |
---|
| 19 | # ifdef _DEFINE |
---|
| 20 | # define EXTERN |
---|
| 21 | # ifndef lint |
---|
| 22 | static char SmailSccsId[] = "@(#)sendmail.h 8.295 1/26/1999"; |
---|
| 23 | # endif |
---|
| 24 | # else /* _DEFINE */ |
---|
| 25 | # define EXTERN extern |
---|
| 26 | # endif /* _DEFINE */ |
---|
| 27 | |
---|
| 28 | # include <unistd.h> |
---|
| 29 | # include <stddef.h> |
---|
| 30 | # include <stdlib.h> |
---|
| 31 | # include <stdio.h> |
---|
| 32 | # include <ctype.h> |
---|
| 33 | # include <setjmp.h> |
---|
| 34 | # include <string.h> |
---|
| 35 | # include <time.h> |
---|
| 36 | # include <errno.h> |
---|
| 37 | # ifdef EX_OK |
---|
| 38 | # undef EX_OK /* for SVr4.2 SMP */ |
---|
| 39 | # endif |
---|
| 40 | # include <sysexits.h> |
---|
| 41 | |
---|
| 42 | # include "conf.h" |
---|
| 43 | # include "useful.h" |
---|
| 44 | |
---|
| 45 | # ifdef LOG |
---|
| 46 | # include <syslog.h> |
---|
| 47 | # endif /* LOG */ |
---|
| 48 | |
---|
| 49 | # if NETINET || NETUNIX || NETISO || NETNS || NETX25 |
---|
| 50 | # include <sys/socket.h> |
---|
| 51 | # endif |
---|
| 52 | # if NETUNIX |
---|
| 53 | # include <sys/un.h> |
---|
| 54 | # endif |
---|
| 55 | # if NETINET |
---|
| 56 | # include <netinet/in.h> |
---|
| 57 | # endif |
---|
| 58 | # if NETISO |
---|
| 59 | # include <netiso/iso.h> |
---|
| 60 | # endif |
---|
| 61 | # if NETNS |
---|
| 62 | # include <netns/ns.h> |
---|
| 63 | # endif |
---|
| 64 | # if NETX25 |
---|
| 65 | # include <netccitt/x25.h> |
---|
| 66 | # endif |
---|
| 67 | |
---|
| 68 | #if NAMED_BIND |
---|
| 69 | # include <arpa/nameser.h> |
---|
| 70 | # ifdef NOERROR |
---|
| 71 | # undef NOERROR /* avoid <sys/streams.h> conflict */ |
---|
| 72 | # endif |
---|
| 73 | #endif |
---|
| 74 | |
---|
| 75 | #ifdef HESIOD |
---|
| 76 | # include <hesiod.h> |
---|
| 77 | # if !defined(HES_ER_OK) || defined(HESIOD_INTERFACES) |
---|
| 78 | # define HESIOD_INIT /* support for the new interface */ |
---|
| 79 | EXTERN void *HesiodContext; |
---|
| 80 | # endif |
---|
| 81 | #endif |
---|
| 82 | |
---|
| 83 | /* |
---|
| 84 | ** Following are "sort of" configuration constants, but they should |
---|
| 85 | ** be pretty solid on most architectures today. They have to be |
---|
| 86 | ** defined after <arpa/nameser.h> because some versions of that |
---|
| 87 | ** file also define them. In all cases, we can't use sizeof because |
---|
| 88 | ** some systems (e.g., Crays) always treat everything as being at |
---|
| 89 | ** least 64 bits. |
---|
| 90 | */ |
---|
| 91 | |
---|
| 92 | #ifndef INADDRSZ |
---|
| 93 | # define INADDRSZ 4 /* size of an IPv4 address in bytes */ |
---|
| 94 | #endif |
---|
| 95 | #ifndef INT16SZ |
---|
| 96 | # define INT16SZ 2 /* size of a 16 bit integer in bytes */ |
---|
| 97 | #endif |
---|
| 98 | #ifndef INT32SZ |
---|
| 99 | # define INT32SZ 4 /* size of a 32 bit integer in bytes */ |
---|
| 100 | #endif |
---|
| 101 | |
---|
| 102 | |
---|
| 103 | |
---|
| 104 | /* forward references for prototypes */ |
---|
| 105 | typedef struct envelope ENVELOPE; |
---|
| 106 | typedef struct mailer MAILER; |
---|
| 107 | |
---|
| 108 | |
---|
| 109 | /* |
---|
| 110 | ** Data structure for bit maps. |
---|
| 111 | ** |
---|
| 112 | ** Each bit in this map can be referenced by an ascii character. |
---|
| 113 | ** This is 256 possible bits, or 32 8-bit bytes. |
---|
| 114 | */ |
---|
| 115 | |
---|
| 116 | #define BITMAPBYTES 32 /* number of bytes in a bit map */ |
---|
| 117 | #define BYTEBITS 8 /* number of bits in a byte */ |
---|
| 118 | |
---|
| 119 | /* internal macros */ |
---|
| 120 | #define _BITWORD(bit) ((bit) / (BYTEBITS * sizeof (int))) |
---|
| 121 | #define _BITBIT(bit) (1 << ((bit) % (BYTEBITS * sizeof (int)))) |
---|
| 122 | |
---|
| 123 | typedef int BITMAP[BITMAPBYTES / sizeof (int)]; |
---|
| 124 | |
---|
| 125 | /* test bit number N */ |
---|
| 126 | #define bitnset(bit, map) ((map)[_BITWORD(bit)] & _BITBIT(bit)) |
---|
| 127 | |
---|
| 128 | /* set bit number N */ |
---|
| 129 | #define setbitn(bit, map) (map)[_BITWORD(bit)] |= _BITBIT(bit) |
---|
| 130 | |
---|
| 131 | /* clear bit number N */ |
---|
| 132 | #define clrbitn(bit, map) (map)[_BITWORD(bit)] &= ~_BITBIT(bit) |
---|
| 133 | |
---|
| 134 | /* clear an entire bit map */ |
---|
| 135 | #define clrbitmap(map) bzero((char *) map, BITMAPBYTES) |
---|
| 136 | |
---|
| 137 | |
---|
| 138 | /* |
---|
| 139 | ** Utility macros |
---|
| 140 | */ |
---|
| 141 | |
---|
| 142 | /* return number of bytes left in a buffer */ |
---|
| 143 | #define SPACELEFT(buf, ptr) (sizeof buf - ((ptr) - buf)) |
---|
| 144 | /* |
---|
| 145 | ** Address structure. |
---|
| 146 | ** Addresses are stored internally in this structure. |
---|
| 147 | */ |
---|
| 148 | |
---|
| 149 | struct address |
---|
| 150 | { |
---|
| 151 | char *q_paddr; /* the printname for the address */ |
---|
| 152 | char *q_user; /* user name */ |
---|
| 153 | char *q_ruser; /* real user name, or NULL if q_user */ |
---|
| 154 | char *q_host; /* host name */ |
---|
| 155 | struct mailer *q_mailer; /* mailer to use */ |
---|
| 156 | u_long q_flags; /* status flags, see below */ |
---|
| 157 | uid_t q_uid; /* user-id of receiver (if known) */ |
---|
| 158 | gid_t q_gid; /* group-id of receiver (if known) */ |
---|
| 159 | char *q_home; /* home dir (local mailer only) */ |
---|
| 160 | char *q_fullname; /* full name if known */ |
---|
| 161 | struct address *q_next; /* chain */ |
---|
| 162 | struct address *q_alias; /* address this results from */ |
---|
| 163 | char *q_owner; /* owner of q_alias */ |
---|
| 164 | struct address *q_tchain; /* temporary use chain */ |
---|
| 165 | char *q_orcpt; /* ORCPT parameter from RCPT TO: line */ |
---|
| 166 | char *q_status; /* status code for DSNs */ |
---|
| 167 | char *q_rstatus; /* remote status message for DSNs */ |
---|
| 168 | time_t q_statdate; /* date of status messages */ |
---|
| 169 | char *q_statmta; /* MTA generating q_rstatus */ |
---|
| 170 | short q_specificity; /* how "specific" this address is */ |
---|
| 171 | }; |
---|
| 172 | |
---|
| 173 | typedef struct address ADDRESS; |
---|
| 174 | |
---|
| 175 | # define QDONTSEND 0x00000001 /* don't send to this address */ |
---|
| 176 | # define QBADADDR 0x00000002 /* this address is verified bad */ |
---|
| 177 | # define QGOODUID 0x00000004 /* the q_uid q_gid fields are good */ |
---|
| 178 | # define QPRIMARY 0x00000008 /* set from RCPT or argv */ |
---|
| 179 | # define QQUEUEUP 0x00000010 /* queue for later transmission */ |
---|
| 180 | # define QSENT 0x00000020 /* has been successfully delivered */ |
---|
| 181 | # define QNOTREMOTE 0x00000040 /* address not for remote forwarding */ |
---|
| 182 | # define QSELFREF 0x00000080 /* this address references itself */ |
---|
| 183 | # define QVERIFIED 0x00000100 /* verified, but not expanded */ |
---|
| 184 | # define QBOGUSSHELL 0x00000400 /* user has no valid shell listed */ |
---|
| 185 | # define QUNSAFEADDR 0x00000800 /* address aquired via unsafe path */ |
---|
| 186 | # define QPINGONSUCCESS 0x00001000 /* give return on successful delivery */ |
---|
| 187 | # define QPINGONFAILURE 0x00002000 /* give return on failure */ |
---|
| 188 | # define QPINGONDELAY 0x00004000 /* give return on message delay */ |
---|
| 189 | # define QHASNOTIFY 0x00008000 /* propogate notify parameter */ |
---|
| 190 | # define QRELAYED 0x00010000 /* DSN: relayed to non-DSN aware sys */ |
---|
| 191 | # define QEXPANDED 0x00020000 /* DSN: undergone list expansion */ |
---|
| 192 | # define QDELIVERED 0x00040000 /* DSN: successful final delivery */ |
---|
| 193 | # define QDELAYED 0x00080000 /* DSN: message delayed */ |
---|
| 194 | # define QTHISPASS 0x40000000 /* temp: address set this pass */ |
---|
| 195 | # define QRCPTOK 0x80000000 /* recipient() processed address */ |
---|
| 196 | |
---|
| 197 | # define Q_PINGFLAGS (QPINGONSUCCESS|QPINGONFAILURE|QPINGONDELAY) |
---|
| 198 | |
---|
| 199 | # define NULLADDR ((ADDRESS *) NULL) |
---|
| 200 | |
---|
| 201 | /* functions */ |
---|
| 202 | extern ADDRESS *parseaddr __P((char *, ADDRESS *, int, int, char **, ENVELOPE *)); |
---|
| 203 | extern ADDRESS *buildaddr __P((char **, ADDRESS *, int, ENVELOPE *)); |
---|
| 204 | extern ADDRESS *recipient __P((ADDRESS *, ADDRESS **, int, ENVELOPE *)); |
---|
| 205 | extern char **prescan __P((char *, int, char[], int, char **, u_char *)); |
---|
| 206 | extern int rewrite __P((char **, int, int, ENVELOPE *)); |
---|
| 207 | extern char *remotename __P((char *, MAILER *, int, int *, ENVELOPE *)); |
---|
| 208 | extern ADDRESS *getctladdr __P((ADDRESS *)); |
---|
| 209 | extern bool sameaddr __P((ADDRESS *, ADDRESS *)); |
---|
| 210 | extern bool emptyaddr __P((ADDRESS *)); |
---|
| 211 | extern void printaddr __P((ADDRESS *, bool)); |
---|
| 212 | extern void cataddr __P((char **, char **, char *, int, int)); |
---|
| 213 | extern int sendtolist __P((char *, ADDRESS *, ADDRESS **, int, ENVELOPE *)); |
---|
| 214 | /* |
---|
| 215 | ** Mailer definition structure. |
---|
| 216 | ** Every mailer known to the system is declared in this |
---|
| 217 | ** structure. It defines the pathname of the mailer, some |
---|
| 218 | ** flags associated with it, and the argument vector to |
---|
| 219 | ** pass to it. The flags are defined in conf.c |
---|
| 220 | ** |
---|
| 221 | ** The argument vector is expanded before actual use. All |
---|
| 222 | ** words except the first are passed through the macro |
---|
| 223 | ** processor. |
---|
| 224 | */ |
---|
| 225 | |
---|
| 226 | struct mailer |
---|
| 227 | { |
---|
| 228 | char *m_name; /* symbolic name of this mailer */ |
---|
| 229 | char *m_mailer; /* pathname of the mailer to use */ |
---|
| 230 | char *m_mtatype; /* type of this MTA */ |
---|
| 231 | char *m_addrtype; /* type for addresses */ |
---|
| 232 | char *m_diagtype; /* type for diagnostics */ |
---|
| 233 | BITMAP m_flags; /* status flags, see below */ |
---|
| 234 | short m_mno; /* mailer number internally */ |
---|
| 235 | short m_nice; /* niceness to run at (mostly for prog) */ |
---|
| 236 | char **m_argv; /* template argument vector */ |
---|
| 237 | short m_sh_rwset; /* rewrite set: sender header addresses */ |
---|
| 238 | short m_se_rwset; /* rewrite set: sender envelope addresses */ |
---|
| 239 | short m_rh_rwset; /* rewrite set: recipient header addresses */ |
---|
| 240 | short m_re_rwset; /* rewrite set: recipient envelope addresses */ |
---|
| 241 | char *m_eol; /* end of line string */ |
---|
| 242 | long m_maxsize; /* size limit on message to this mailer */ |
---|
| 243 | int m_linelimit; /* max # characters per line */ |
---|
| 244 | char *m_execdir; /* directory to chdir to before execv */ |
---|
| 245 | uid_t m_uid; /* UID to run as */ |
---|
| 246 | gid_t m_gid; /* GID to run as */ |
---|
| 247 | char *m_defcharset; /* default character set */ |
---|
| 248 | }; |
---|
| 249 | |
---|
| 250 | /* bits for m_flags */ |
---|
| 251 | # define M_ESMTP 'a' /* run Extended SMTP protocol */ |
---|
| 252 | # define M_ALIASABLE 'A' /* user can be LHS of an alias */ |
---|
| 253 | # define M_BLANKEND 'b' /* ensure blank line at end of message */ |
---|
| 254 | # define M_NOCOMMENT 'c' /* don't include comment part of address */ |
---|
| 255 | # define M_CANONICAL 'C' /* make addresses canonical "u@dom" */ |
---|
| 256 | # define M_NOBRACKET 'd' /* never angle bracket envelope route-addrs */ |
---|
| 257 | /* 'D' CF: include Date: */ |
---|
| 258 | # define M_EXPENSIVE 'e' /* it costs to use this mailer.... */ |
---|
| 259 | # define M_ESCFROM 'E' /* escape From lines to >From */ |
---|
| 260 | # define M_FOPT 'f' /* mailer takes picky -f flag */ |
---|
| 261 | /* 'F' CF: include From: or Resent-From: */ |
---|
| 262 | # define M_NO_NULL_FROM 'g' /* sender of errors should be $g */ |
---|
| 263 | # define M_HST_UPPER 'h' /* preserve host case distinction */ |
---|
| 264 | # define M_PREHEAD 'H' /* MAIL11V3: preview headers */ |
---|
| 265 | # define M_UDBENVELOPE 'i' /* do udbsender rewriting on envelope */ |
---|
| 266 | # define M_INTERNAL 'I' /* SMTP to another sendmail site */ |
---|
| 267 | # define M_UDBRECIPIENT 'j' /* do udbsender rewriting on recipient lines */ |
---|
| 268 | # define M_NOLOOPCHECK 'k' /* don't check for loops in HELO command */ |
---|
| 269 | # define M_CHUNKING 'K' /* CHUNKING: reserved for future use */ |
---|
| 270 | # define M_LOCALMAILER 'l' /* delivery is to this host */ |
---|
| 271 | # define M_LIMITS 'L' /* must enforce SMTP line limits */ |
---|
| 272 | # define M_MUSER 'm' /* can handle multiple users at once */ |
---|
| 273 | /* 'M' CF: include Message-Id: */ |
---|
| 274 | # define M_NHDR 'n' /* don't insert From line */ |
---|
| 275 | # define M_MANYSTATUS 'N' /* MAIL11V3: DATA returns multi-status */ |
---|
| 276 | # define M_RUNASRCPT 'o' /* always run mailer as recipient */ |
---|
| 277 | # define M_FROMPATH 'p' /* use reverse-path in MAIL FROM: */ |
---|
| 278 | /* 'P' CF: include Return-Path: */ |
---|
| 279 | # define M_VRFY250 'q' /* VRFY command returns 250 instead of 252 */ |
---|
| 280 | # define M_ROPT 'r' /* mailer takes picky -r flag */ |
---|
| 281 | # define M_SECURE_PORT 'R' /* try to send on a reserved TCP port */ |
---|
| 282 | # define M_STRIPQ 's' /* strip quote chars from user/host */ |
---|
| 283 | # define M_SPECIFIC_UID 'S' /* run as specific uid/gid */ |
---|
| 284 | # define M_USR_UPPER 'u' /* preserve user case distinction */ |
---|
| 285 | # define M_UGLYUUCP 'U' /* this wants an ugly UUCP from line */ |
---|
| 286 | # define M_CONTENT_LEN 'v' /* add Content-Length: header (SVr4) */ |
---|
| 287 | /* 'V' UIUC: !-relativize all addresses */ |
---|
| 288 | # define M_HASPWENT 'w' /* check for /etc/passwd entry */ |
---|
| 289 | /* 'x' CF: include Full-Name: */ |
---|
| 290 | # define M_XDOT 'X' /* use hidden-dot algorithm */ |
---|
| 291 | # define M_LMTP 'z' /* run Local Mail Transport Protocol */ |
---|
| 292 | # define M_NOMX '0' /* turn off MX lookups */ |
---|
| 293 | # define M_NONULLS '1' /* don't send null bytes */ |
---|
| 294 | # define M_EBCDIC '3' /* extend Q-P encoding for EBCDIC */ |
---|
| 295 | # define M_TRYRULESET5 '5' /* use ruleset 5 after local aliasing */ |
---|
| 296 | # define M_7BITHDRS '6' /* strip headers to 7 bits even in 8 bit path */ |
---|
| 297 | # define M_7BITS '7' /* use 7-bit path */ |
---|
| 298 | # define M_8BITS '8' /* force "just send 8" behaviour */ |
---|
| 299 | # define M_MAKE8BIT '9' /* convert 7 -> 8 bit if appropriate */ |
---|
| 300 | # define M_CHECKINCLUDE ':' /* check for :include: files */ |
---|
| 301 | # define M_CHECKPROG '|' /* check for |program addresses */ |
---|
| 302 | # define M_CHECKFILE '/' /* check for /file addresses */ |
---|
| 303 | # define M_CHECKUDB '@' /* user can be user database key */ |
---|
| 304 | # define M_CHECKHDIR '~' /* SGI: check for valid home directory */ |
---|
| 305 | |
---|
| 306 | EXTERN MAILER *Mailer[MAXMAILERS+1]; |
---|
| 307 | |
---|
| 308 | EXTERN MAILER *LocalMailer; /* ptr to local mailer */ |
---|
| 309 | EXTERN MAILER *ProgMailer; /* ptr to program mailer */ |
---|
| 310 | EXTERN MAILER *FileMailer; /* ptr to *file* mailer */ |
---|
| 311 | EXTERN MAILER *InclMailer; /* ptr to *include* mailer */ |
---|
| 312 | /* |
---|
| 313 | ** Information about currently open connections to mailers, or to |
---|
| 314 | ** hosts that we have looked up recently. |
---|
| 315 | */ |
---|
| 316 | |
---|
| 317 | # define MCI struct mailer_con_info |
---|
| 318 | |
---|
| 319 | MCI |
---|
| 320 | { |
---|
| 321 | short mci_flags; /* flag bits, see below */ |
---|
| 322 | short mci_errno; /* error number on last connection */ |
---|
| 323 | short mci_herrno; /* h_errno from last DNS lookup */ |
---|
| 324 | short mci_exitstat; /* exit status from last connection */ |
---|
| 325 | short mci_state; /* SMTP state */ |
---|
| 326 | off_t mci_contentlen; /* body length for Content-Length: */ |
---|
| 327 | long mci_maxsize; /* max size this server will accept */ |
---|
| 328 | FILE *mci_in; /* input side of connection */ |
---|
| 329 | FILE *mci_out; /* output side of connection */ |
---|
| 330 | pid_t mci_pid; /* process id of subordinate proc */ |
---|
| 331 | char *mci_phase; /* SMTP phase string */ |
---|
| 332 | struct mailer *mci_mailer; /* ptr to the mailer for this conn */ |
---|
| 333 | char *mci_host; /* host name */ |
---|
| 334 | char *mci_status; /* DSN status to be copied to addrs */ |
---|
| 335 | char *mci_rstatus; /* SMTP status to be copied to addrs */ |
---|
| 336 | time_t mci_lastuse; /* last usage time */ |
---|
| 337 | FILE *mci_statfile; /* long term status file */ |
---|
| 338 | }; |
---|
| 339 | |
---|
| 340 | |
---|
| 341 | /* flag bits */ |
---|
| 342 | #define MCIF_VALID 0x0001 /* this entry is valid */ |
---|
| 343 | #define MCIF_TEMP 0x0002 /* don't cache this connection */ |
---|
| 344 | #define MCIF_CACHED 0x0004 /* currently in open cache */ |
---|
| 345 | #define MCIF_ESMTP 0x0008 /* this host speaks ESMTP */ |
---|
| 346 | #define MCIF_EXPN 0x0010 /* EXPN command supported */ |
---|
| 347 | #define MCIF_SIZE 0x0020 /* SIZE option supported */ |
---|
| 348 | #define MCIF_8BITMIME 0x0040 /* BODY=8BITMIME supported */ |
---|
| 349 | #define MCIF_7BIT 0x0080 /* strip this message to 7 bits */ |
---|
| 350 | #define MCIF_MULTSTAT 0x0100 /* MAIL11V3: handles MULT status */ |
---|
| 351 | #define MCIF_INHEADER 0x0200 /* currently outputing header */ |
---|
| 352 | #define MCIF_CVT8TO7 0x0400 /* convert from 8 to 7 bits */ |
---|
| 353 | #define MCIF_DSN 0x0800 /* DSN extension supported */ |
---|
| 354 | #define MCIF_8BITOK 0x1000 /* OK to send 8 bit characters */ |
---|
| 355 | #define MCIF_CVT7TO8 0x2000 /* convert from 7 to 8 bits */ |
---|
| 356 | #define MCIF_INMIME 0x4000 /* currently reading MIME header */ |
---|
| 357 | |
---|
| 358 | /* states */ |
---|
| 359 | #define MCIS_CLOSED 0 /* no traffic on this connection */ |
---|
| 360 | #define MCIS_OPENING 1 /* sending initial protocol */ |
---|
| 361 | #define MCIS_OPEN 2 /* open, initial protocol sent */ |
---|
| 362 | #define MCIS_ACTIVE 3 /* message being sent */ |
---|
| 363 | #define MCIS_QUITING 4 /* running quit protocol */ |
---|
| 364 | #define MCIS_SSD 5 /* service shutting down */ |
---|
| 365 | #define MCIS_ERROR 6 /* I/O error on connection */ |
---|
| 366 | |
---|
| 367 | /* functions */ |
---|
| 368 | extern MCI *mci_get __P((char *, MAILER *)); |
---|
| 369 | extern void mci_cache __P((MCI *)); |
---|
| 370 | extern void mci_flush __P((bool, MCI *)); |
---|
| 371 | extern void mci_dump __P((MCI *, bool)); |
---|
| 372 | extern void mci_dump_all __P((bool)); |
---|
| 373 | extern MCI **mci_scan __P((MCI *)); |
---|
| 374 | extern int mci_traverse_persistent __P((int (*)(), char *)); |
---|
| 375 | extern int mci_print_persistent __P((char *, char *)); |
---|
| 376 | extern int mci_purge_persistent __P((char *, char *)); |
---|
| 377 | extern int mci_lock_host __P((MCI *)); |
---|
| 378 | extern void mci_unlock_host __P((MCI *)); |
---|
| 379 | extern int mci_lock_host_statfile __P((MCI *)); |
---|
| 380 | extern void mci_store_persistent __P((MCI *)); |
---|
| 381 | extern int mci_read_persistent __P((FILE *, MCI *)); |
---|
| 382 | /* |
---|
| 383 | ** Header structure. |
---|
| 384 | ** This structure is used internally to store header items. |
---|
| 385 | */ |
---|
| 386 | |
---|
| 387 | struct header |
---|
| 388 | { |
---|
| 389 | char *h_field; /* the name of the field */ |
---|
| 390 | char *h_value; /* the value of that field */ |
---|
| 391 | struct header *h_link; /* the next header */ |
---|
| 392 | u_short h_flags; /* status bits, see below */ |
---|
| 393 | BITMAP h_mflags; /* m_flags bits needed */ |
---|
| 394 | }; |
---|
| 395 | |
---|
| 396 | typedef struct header HDR; |
---|
| 397 | |
---|
| 398 | /* |
---|
| 399 | ** Header information structure. |
---|
| 400 | ** Defined in conf.c, this struct declares the header fields |
---|
| 401 | ** that have some magic meaning. |
---|
| 402 | */ |
---|
| 403 | |
---|
| 404 | struct hdrinfo |
---|
| 405 | { |
---|
| 406 | char *hi_field; /* the name of the field */ |
---|
| 407 | u_short hi_flags; /* status bits, see below */ |
---|
| 408 | char *hi_ruleset; /* validity check ruleset */ |
---|
| 409 | }; |
---|
| 410 | |
---|
| 411 | extern struct hdrinfo HdrInfo[]; |
---|
| 412 | |
---|
| 413 | /* bits for h_flags and hi_flags */ |
---|
| 414 | # define H_EOH 0x0001 /* this field terminates header */ |
---|
| 415 | # define H_RCPT 0x0002 /* contains recipient addresses */ |
---|
| 416 | # define H_DEFAULT 0x0004 /* if another value is found, drop this */ |
---|
| 417 | # define H_RESENT 0x0008 /* this address is a "Resent-..." address */ |
---|
| 418 | # define H_CHECK 0x0010 /* check h_mflags against m_flags */ |
---|
| 419 | # define H_ACHECK 0x0020 /* ditto, but always (not just default) */ |
---|
| 420 | # define H_FORCE 0x0040 /* force this field, even if default */ |
---|
| 421 | # define H_TRACE 0x0080 /* this field contains trace information */ |
---|
| 422 | # define H_FROM 0x0100 /* this is a from-type field */ |
---|
| 423 | # define H_VALID 0x0200 /* this field has a validated value */ |
---|
| 424 | # define H_RECEIPTTO 0x0400 /* this field has return receipt info */ |
---|
| 425 | # define H_ERRORSTO 0x0800 /* this field has error address info */ |
---|
| 426 | # define H_CTE 0x1000 /* this field is a content-transfer-encoding */ |
---|
| 427 | # define H_CTYPE 0x2000 /* this is a content-type field */ |
---|
| 428 | # define H_BCC 0x4000 /* Bcc: header: strip value or delete */ |
---|
| 429 | # define H_ENCODABLE 0x8000 /* field can be RFC 1522 encoded */ |
---|
| 430 | |
---|
| 431 | /* functions */ |
---|
| 432 | extern void addheader __P((char *, char *, HDR **)); |
---|
| 433 | extern char *hvalue __P((char *, HDR *)); |
---|
| 434 | extern void commaize __P((HDR *, char *, bool, MCI *, ENVELOPE *)); |
---|
| 435 | extern void put_vanilla_header __P((HDR *, char *, MCI *)); |
---|
| 436 | extern void eatheader __P((ENVELOPE *, bool)); |
---|
| 437 | extern int chompheader __P((char *, bool, HDR **, ENVELOPE *)); |
---|
| 438 | /* |
---|
| 439 | ** Envelope structure. |
---|
| 440 | ** This structure defines the message itself. There is usually |
---|
| 441 | ** only one of these -- for the message that we originally read |
---|
| 442 | ** and which is our primary interest -- but other envelopes can |
---|
| 443 | ** be generated during processing. For example, error messages |
---|
| 444 | ** will have their own envelope. |
---|
| 445 | */ |
---|
| 446 | |
---|
| 447 | struct envelope |
---|
| 448 | { |
---|
| 449 | HDR *e_header; /* head of header list */ |
---|
| 450 | long e_msgpriority; /* adjusted priority of this message */ |
---|
| 451 | time_t e_ctime; /* time message appeared in the queue */ |
---|
| 452 | char *e_to; /* the target person */ |
---|
| 453 | ADDRESS e_from; /* the person it is from */ |
---|
| 454 | char *e_sender; /* e_from.q_paddr w comments stripped */ |
---|
| 455 | char **e_fromdomain; /* the domain part of the sender */ |
---|
| 456 | ADDRESS *e_sendqueue; /* list of message recipients */ |
---|
| 457 | ADDRESS *e_errorqueue; /* the queue for error responses */ |
---|
| 458 | long e_msgsize; /* size of the message in bytes */ |
---|
| 459 | long e_flags; /* flags, see below */ |
---|
| 460 | int e_nrcpts; /* number of recipients */ |
---|
| 461 | short e_class; /* msg class (priority, junk, etc.) */ |
---|
| 462 | short e_hopcount; /* number of times processed */ |
---|
| 463 | short e_nsent; /* number of sends since checkpoint */ |
---|
| 464 | short e_sendmode; /* message send mode */ |
---|
| 465 | short e_errormode; /* error return mode */ |
---|
| 466 | short e_timeoutclass; /* message timeout class */ |
---|
| 467 | void (*e_puthdr)__P((MCI *, HDR *, ENVELOPE *, int)); |
---|
| 468 | /* function to put header of message */ |
---|
| 469 | void (*e_putbody)__P((MCI *, ENVELOPE *, char *)); |
---|
| 470 | /* function to put body of message */ |
---|
| 471 | struct envelope *e_parent; /* the message this one encloses */ |
---|
| 472 | struct envelope *e_sibling; /* the next envelope of interest */ |
---|
| 473 | char *e_bodytype; /* type of message body */ |
---|
| 474 | FILE *e_dfp; /* temporary file */ |
---|
| 475 | char *e_id; /* code for this entry in queue */ |
---|
| 476 | FILE *e_xfp; /* transcript file */ |
---|
| 477 | FILE *e_lockfp; /* the lock file for this message */ |
---|
| 478 | char *e_message; /* error message */ |
---|
| 479 | char *e_statmsg; /* stat msg (changes per delivery) */ |
---|
| 480 | char *e_msgboundary; /* MIME-style message part boundary */ |
---|
| 481 | char *e_origrcpt; /* original recipient (one only) */ |
---|
| 482 | char *e_envid; /* envelope id from MAIL FROM: line */ |
---|
| 483 | char *e_status; /* DSN status for this message */ |
---|
| 484 | time_t e_dtime; /* time of last delivery attempt */ |
---|
| 485 | int e_ntries; /* number of delivery attempts */ |
---|
| 486 | dev_t e_dfdev; /* df file's device, for crash recov */ |
---|
| 487 | ino_t e_dfino; /* df file's ino, for crash recovery */ |
---|
| 488 | char *e_macro[256]; /* macro definitions */ |
---|
| 489 | }; |
---|
| 490 | |
---|
| 491 | /* values for e_flags */ |
---|
| 492 | #define EF_OLDSTYLE 0x0000001 /* use spaces (not commas) in hdrs */ |
---|
| 493 | #define EF_INQUEUE 0x0000002 /* this message is fully queued */ |
---|
| 494 | #define EF_NO_BODY_RETN 0x0000004 /* omit message body on error */ |
---|
| 495 | #define EF_CLRQUEUE 0x0000008 /* disk copy is no longer needed */ |
---|
| 496 | #define EF_SENDRECEIPT 0x0000010 /* send a return receipt */ |
---|
| 497 | #define EF_FATALERRS 0x0000020 /* fatal errors occured */ |
---|
| 498 | #define EF_DELETE_BCC 0x0000040 /* delete Bcc: headers entirely */ |
---|
| 499 | #define EF_RESPONSE 0x0000080 /* this is an error or return receipt */ |
---|
| 500 | #define EF_RESENT 0x0000100 /* this message is being forwarded */ |
---|
| 501 | #define EF_VRFYONLY 0x0000200 /* verify only (don't expand aliases) */ |
---|
| 502 | #define EF_WARNING 0x0000400 /* warning message has been sent */ |
---|
| 503 | #define EF_QUEUERUN 0x0000800 /* this envelope is from queue */ |
---|
| 504 | #define EF_GLOBALERRS 0x0001000 /* treat errors as global */ |
---|
| 505 | #define EF_PM_NOTIFY 0x0002000 /* send return mail to postmaster */ |
---|
| 506 | #define EF_METOO 0x0004000 /* send to me too */ |
---|
| 507 | #define EF_LOGSENDER 0x0008000 /* need to log the sender */ |
---|
| 508 | #define EF_NORECEIPT 0x0010000 /* suppress all return-receipts */ |
---|
| 509 | #define EF_HAS8BIT 0x0020000 /* at least one 8-bit char in body */ |
---|
| 510 | #define EF_NL_NOT_EOL 0x0040000 /* don't accept raw NL as EOLine */ |
---|
| 511 | #define EF_CRLF_NOT_EOL 0x0080000 /* don't accept CR-LF as EOLine */ |
---|
| 512 | #define EF_RET_PARAM 0x0100000 /* RCPT command had RET argument */ |
---|
| 513 | #define EF_HAS_DF 0x0200000 /* set when df file is instantiated */ |
---|
| 514 | #define EF_IS_MIME 0x0400000 /* really is a MIME message */ |
---|
| 515 | #define EF_DONT_MIME 0x0800000 /* never MIME this message */ |
---|
| 516 | #define EF_DISCARD 0x1000000 /* discard the message */ |
---|
| 517 | |
---|
| 518 | EXTERN ENVELOPE *CurEnv; /* envelope currently being processed */ |
---|
| 519 | |
---|
| 520 | /* functions */ |
---|
| 521 | extern ENVELOPE *newenvelope __P((ENVELOPE *, ENVELOPE *)); |
---|
| 522 | extern void dropenvelope __P((ENVELOPE *, bool)); |
---|
| 523 | extern void clearenvelope __P((ENVELOPE *, bool)); |
---|
| 524 | |
---|
| 525 | extern void putheader __P((MCI *, HDR *, ENVELOPE *, int)); |
---|
| 526 | extern void putbody __P((MCI *, ENVELOPE *, char *)); |
---|
| 527 | /* |
---|
| 528 | ** Message priority classes. |
---|
| 529 | ** |
---|
| 530 | ** The message class is read directly from the Priority: header |
---|
| 531 | ** field in the message. |
---|
| 532 | ** |
---|
| 533 | ** CurEnv->e_msgpriority is the number of bytes in the message plus |
---|
| 534 | ** the creation time (so that jobs ``tend'' to be ordered correctly), |
---|
| 535 | ** adjusted by the message class, the number of recipients, and the |
---|
| 536 | ** amount of time the message has been sitting around. This number |
---|
| 537 | ** is used to order the queue. Higher values mean LOWER priority. |
---|
| 538 | ** |
---|
| 539 | ** Each priority class point is worth WkClassFact priority points; |
---|
| 540 | ** each recipient is worth WkRecipFact priority points. Each time |
---|
| 541 | ** we reprocess a message the priority is adjusted by WkTimeFact. |
---|
| 542 | ** WkTimeFact should normally decrease the priority so that jobs |
---|
| 543 | ** that have historically failed will be run later; thanks go to |
---|
| 544 | ** Jay Lepreau at Utah for pointing out the error in my thinking. |
---|
| 545 | ** |
---|
| 546 | ** The "class" is this number, unadjusted by the age or size of |
---|
| 547 | ** this message. Classes with negative representations will have |
---|
| 548 | ** error messages thrown away if they are not local. |
---|
| 549 | */ |
---|
| 550 | |
---|
| 551 | struct priority |
---|
| 552 | { |
---|
| 553 | char *pri_name; /* external name of priority */ |
---|
| 554 | int pri_val; /* internal value for same */ |
---|
| 555 | }; |
---|
| 556 | |
---|
| 557 | EXTERN struct priority Priorities[MAXPRIORITIES]; |
---|
| 558 | EXTERN int NumPriorities; /* pointer into Priorities */ |
---|
| 559 | /* |
---|
| 560 | ** Rewrite rules. |
---|
| 561 | */ |
---|
| 562 | |
---|
| 563 | struct rewrite |
---|
| 564 | { |
---|
| 565 | char **r_lhs; /* pattern match */ |
---|
| 566 | char **r_rhs; /* substitution value */ |
---|
| 567 | struct rewrite *r_next;/* next in chain */ |
---|
| 568 | }; |
---|
| 569 | |
---|
| 570 | EXTERN struct rewrite *RewriteRules[MAXRWSETS]; |
---|
| 571 | |
---|
| 572 | /* |
---|
| 573 | ** Special characters in rewriting rules. |
---|
| 574 | ** These are used internally only. |
---|
| 575 | ** The COND* rules are actually used in macros rather than in |
---|
| 576 | ** rewriting rules, but are given here because they |
---|
| 577 | ** cannot conflict. |
---|
| 578 | */ |
---|
| 579 | |
---|
| 580 | /* left hand side items */ |
---|
| 581 | # define MATCHZANY ((u_char)0220) /* match zero or more tokens */ |
---|
| 582 | # define MATCHANY ((u_char)0221) /* match one or more tokens */ |
---|
| 583 | # define MATCHONE ((u_char)0222) /* match exactly one token */ |
---|
| 584 | # define MATCHCLASS ((u_char)0223) /* match one token in a class */ |
---|
| 585 | # define MATCHNCLASS ((u_char)0224) /* match anything not in class */ |
---|
| 586 | # define MATCHREPL ((u_char)0225) /* replacement on RHS for above */ |
---|
| 587 | |
---|
| 588 | /* right hand side items */ |
---|
| 589 | # define CANONNET ((u_char)0226) /* canonical net, next token */ |
---|
| 590 | # define CANONHOST ((u_char)0227) /* canonical host, next token */ |
---|
| 591 | # define CANONUSER ((u_char)0230) /* canonical user, next N tokens */ |
---|
| 592 | # define CALLSUBR ((u_char)0231) /* call another rewriting set */ |
---|
| 593 | |
---|
| 594 | /* conditionals in macros */ |
---|
| 595 | # define CONDIF ((u_char)0232) /* conditional if-then */ |
---|
| 596 | # define CONDELSE ((u_char)0233) /* conditional else */ |
---|
| 597 | # define CONDFI ((u_char)0234) /* conditional fi */ |
---|
| 598 | |
---|
| 599 | /* bracket characters for host name lookup */ |
---|
| 600 | # define HOSTBEGIN ((u_char)0235) /* hostname lookup begin */ |
---|
| 601 | # define HOSTEND ((u_char)0236) /* hostname lookup end */ |
---|
| 602 | |
---|
| 603 | /* bracket characters for generalized lookup */ |
---|
| 604 | # define LOOKUPBEGIN ((u_char)0205) /* generalized lookup begin */ |
---|
| 605 | # define LOOKUPEND ((u_char)0206) /* generalized lookup end */ |
---|
| 606 | |
---|
| 607 | /* macro substitution character */ |
---|
| 608 | # define MACROEXPAND ((u_char)0201) /* macro expansion */ |
---|
| 609 | # define MACRODEXPAND ((u_char)0202) /* deferred macro expansion */ |
---|
| 610 | |
---|
| 611 | /* to make the code clearer */ |
---|
| 612 | # define MATCHZERO CANONHOST |
---|
| 613 | |
---|
| 614 | /* external <==> internal mapping table */ |
---|
| 615 | struct metamac |
---|
| 616 | { |
---|
| 617 | char metaname; /* external code (after $) */ |
---|
| 618 | u_char metaval; /* internal code (as above) */ |
---|
| 619 | }; |
---|
| 620 | |
---|
| 621 | /* values for macros with external names only */ |
---|
| 622 | # define MID_OPMODE 0202 /* operation mode */ |
---|
| 623 | |
---|
| 624 | /* functions */ |
---|
| 625 | extern void expand __P((char *, char *, size_t, ENVELOPE *)); |
---|
| 626 | extern void define __P((int, char *, ENVELOPE *)); |
---|
| 627 | extern char *macvalue __P((int, ENVELOPE *)); |
---|
| 628 | extern char *macname __P((int)); |
---|
| 629 | extern int macid __P((char *, char **)); |
---|
| 630 | /* |
---|
| 631 | ** Name canonification short circuit. |
---|
| 632 | ** |
---|
| 633 | ** If the name server for a host is down, the process of trying to |
---|
| 634 | ** canonify the name can hang. This is similar to (but alas, not |
---|
| 635 | ** identical to) looking up the name for delivery. This stab type |
---|
| 636 | ** caches the result of the name server lookup so we don't hang |
---|
| 637 | ** multiple times. |
---|
| 638 | */ |
---|
| 639 | |
---|
| 640 | #define NAMECANON struct _namecanon |
---|
| 641 | |
---|
| 642 | NAMECANON |
---|
| 643 | { |
---|
| 644 | short nc_errno; /* cached errno */ |
---|
| 645 | short nc_herrno; /* cached h_errno */ |
---|
| 646 | short nc_stat; /* cached exit status code */ |
---|
| 647 | short nc_flags; /* flag bits */ |
---|
| 648 | char *nc_cname; /* the canonical name */ |
---|
| 649 | }; |
---|
| 650 | |
---|
| 651 | /* values for nc_flags */ |
---|
| 652 | #define NCF_VALID 0x0001 /* entry valid */ |
---|
| 653 | /* |
---|
| 654 | ** Mapping functions |
---|
| 655 | ** |
---|
| 656 | ** These allow arbitrary mappings in the config file. The idea |
---|
| 657 | ** (albeit not the implementation) comes from IDA sendmail. |
---|
| 658 | */ |
---|
| 659 | |
---|
| 660 | # define MAPCLASS struct _mapclass |
---|
| 661 | # define MAP struct _map |
---|
| 662 | # define MAXMAPACTIONS 3 /* size of map_actions array */ |
---|
| 663 | |
---|
| 664 | |
---|
| 665 | /* |
---|
| 666 | ** An actual map. |
---|
| 667 | */ |
---|
| 668 | |
---|
| 669 | MAP |
---|
| 670 | { |
---|
| 671 | MAPCLASS *map_class; /* the class of this map */ |
---|
| 672 | char *map_mname; /* name of this map */ |
---|
| 673 | long map_mflags; /* flags, see below */ |
---|
| 674 | char *map_file; /* the (nominal) filename */ |
---|
| 675 | ARBPTR_T map_db1; /* the open database ptr */ |
---|
| 676 | ARBPTR_T map_db2; /* an "extra" database pointer */ |
---|
| 677 | char *map_keycolnm; /* key column name */ |
---|
| 678 | char *map_valcolnm; /* value column name */ |
---|
| 679 | u_char map_keycolno; /* key column number */ |
---|
| 680 | u_char map_valcolno; /* value column number */ |
---|
| 681 | char map_coldelim; /* column delimiter */ |
---|
| 682 | char *map_app; /* to append to successful matches */ |
---|
| 683 | char *map_tapp; /* to append to "tempfail" matches */ |
---|
| 684 | char *map_domain; /* the (nominal) NIS domain */ |
---|
| 685 | char *map_rebuild; /* program to run to do auto-rebuild */ |
---|
| 686 | time_t map_mtime; /* last database modification time */ |
---|
| 687 | pid_t map_pid; /* PID of process which opened map */ |
---|
| 688 | int map_lockfd; /* auxiliary lock file descriptor */ |
---|
| 689 | short map_specificity; /* specificity of aliases */ |
---|
| 690 | MAP *map_stack[MAXMAPSTACK]; /* list for stacked maps */ |
---|
| 691 | short map_return[MAXMAPACTIONS]; /* return bitmaps for stacked maps */ |
---|
| 692 | }; |
---|
| 693 | |
---|
| 694 | /* bit values for map_mflags */ |
---|
| 695 | # define MF_VALID 0x00000001 /* this entry is valid */ |
---|
| 696 | # define MF_INCLNULL 0x00000002 /* include null byte in key */ |
---|
| 697 | # define MF_OPTIONAL 0x00000004 /* don't complain if map not found */ |
---|
| 698 | # define MF_NOFOLDCASE 0x00000008 /* don't fold case in keys */ |
---|
| 699 | # define MF_MATCHONLY 0x00000010 /* don't use the map value */ |
---|
| 700 | # define MF_OPEN 0x00000020 /* this entry is open */ |
---|
| 701 | # define MF_WRITABLE 0x00000040 /* open for writing */ |
---|
| 702 | # define MF_ALIAS 0x00000080 /* this is an alias file */ |
---|
| 703 | # define MF_TRY0NULL 0x00000100 /* try with no null byte */ |
---|
| 704 | # define MF_TRY1NULL 0x00000200 /* try with the null byte */ |
---|
| 705 | # define MF_LOCKED 0x00000400 /* this map is currently locked */ |
---|
| 706 | # define MF_ALIASWAIT 0x00000800 /* alias map in aliaswait state */ |
---|
| 707 | # define MF_IMPL_HASH 0x00001000 /* implicit: underlying hash database */ |
---|
| 708 | # define MF_IMPL_NDBM 0x00002000 /* implicit: underlying NDBM database */ |
---|
| 709 | # define MF_UNSAFEDB 0x00004000 /* this map is world writable */ |
---|
| 710 | # define MF_APPEND 0x00008000 /* append new entry on rebuiled */ |
---|
| 711 | # define MF_KEEPQUOTES 0x00010000 /* don't dequote key before lookup */ |
---|
| 712 | # define MF_NODEFER 0x00020000 /* don't defer if map lookup fails */ |
---|
| 713 | # define MF_REGEX_NOT 0x00040000 /* regular expression negation */ |
---|
| 714 | |
---|
| 715 | /* indices for map_actions */ |
---|
| 716 | # define MA_NOTFOUND 0 /* member map returned "not found" */ |
---|
| 717 | # define MA_UNAVAIL 1 /* member map is not available */ |
---|
| 718 | # define MA_TRYAGAIN 2 /* member map returns temp failure */ |
---|
| 719 | |
---|
| 720 | /* |
---|
| 721 | ** The class of a map -- essentially the functions to call |
---|
| 722 | */ |
---|
| 723 | |
---|
| 724 | MAPCLASS |
---|
| 725 | { |
---|
| 726 | char *map_cname; /* name of this map class */ |
---|
| 727 | char *map_ext; /* extension for database file */ |
---|
| 728 | short map_cflags; /* flag bits, see below */ |
---|
| 729 | bool (*map_parse)__P((MAP *, char *)); |
---|
| 730 | /* argument parsing function */ |
---|
| 731 | char *(*map_lookup)__P((MAP *, char *, char **, int *)); |
---|
| 732 | /* lookup function */ |
---|
| 733 | void (*map_store)__P((MAP *, char *, char *)); |
---|
| 734 | /* store function */ |
---|
| 735 | bool (*map_open)__P((MAP *, int)); |
---|
| 736 | /* open function */ |
---|
| 737 | void (*map_close)__P((MAP *)); |
---|
| 738 | /* close function */ |
---|
| 739 | }; |
---|
| 740 | |
---|
| 741 | /* bit values for map_cflags */ |
---|
| 742 | #define MCF_ALIASOK 0x0001 /* can be used for aliases */ |
---|
| 743 | #define MCF_ALIASONLY 0x0002 /* usable only for aliases */ |
---|
| 744 | #define MCF_REBUILDABLE 0x0004 /* can rebuild alias files */ |
---|
| 745 | #define MCF_OPTFILE 0x0008 /* file name is optional */ |
---|
| 746 | |
---|
| 747 | /* functions */ |
---|
| 748 | extern char *map_rewrite __P((MAP *, const char *, size_t, char **)); |
---|
| 749 | extern MAP *makemapentry __P((char *)); |
---|
| 750 | extern void initmaps __P((bool, ENVELOPE *)); |
---|
| 751 | /* |
---|
| 752 | ** Symbol table definitions |
---|
| 753 | */ |
---|
| 754 | |
---|
| 755 | struct symtab |
---|
| 756 | { |
---|
| 757 | char *s_name; /* name to be entered */ |
---|
| 758 | short s_type; /* general type (see below) */ |
---|
| 759 | short s_len; /* length of this entry */ |
---|
| 760 | struct symtab *s_next; /* pointer to next in chain */ |
---|
| 761 | union |
---|
| 762 | { |
---|
| 763 | BITMAP sv_class; /* bit-map of word classes */ |
---|
| 764 | ADDRESS *sv_addr; /* pointer to address header */ |
---|
| 765 | MAILER *sv_mailer; /* pointer to mailer */ |
---|
| 766 | char *sv_alias; /* alias */ |
---|
| 767 | MAPCLASS sv_mapclass; /* mapping function class */ |
---|
| 768 | MAP sv_map; /* mapping function */ |
---|
| 769 | char *sv_hostsig; /* host signature */ |
---|
| 770 | MCI sv_mci; /* mailer connection info */ |
---|
| 771 | NAMECANON sv_namecanon; /* canonical name cache */ |
---|
| 772 | int sv_macro; /* macro name => id mapping */ |
---|
| 773 | int sv_ruleset; /* ruleset index */ |
---|
| 774 | struct hdrinfo sv_header; /* header metainfo */ |
---|
| 775 | char *sv_service[MAXMAPSTACK]; /* service switch */ |
---|
| 776 | } s_value; |
---|
| 777 | }; |
---|
| 778 | |
---|
| 779 | typedef struct symtab STAB; |
---|
| 780 | |
---|
| 781 | /* symbol types */ |
---|
| 782 | # define ST_UNDEF 0 /* undefined type */ |
---|
| 783 | # define ST_CLASS 1 /* class map */ |
---|
| 784 | # define ST_ADDRESS 2 /* an address in parsed format */ |
---|
| 785 | # define ST_MAILER 3 /* a mailer header */ |
---|
| 786 | # define ST_ALIAS 4 /* an alias */ |
---|
| 787 | # define ST_MAPCLASS 5 /* mapping function class */ |
---|
| 788 | # define ST_MAP 6 /* mapping function */ |
---|
| 789 | # define ST_HOSTSIG 7 /* host signature */ |
---|
| 790 | # define ST_NAMECANON 8 /* cached canonical name */ |
---|
| 791 | # define ST_MACRO 9 /* macro name to id mapping */ |
---|
| 792 | # define ST_RULESET 10 /* ruleset index */ |
---|
| 793 | # define ST_SERVICE 11 /* service switch entry */ |
---|
| 794 | # define ST_HEADER 12 /* special header flags */ |
---|
| 795 | # define ST_MCI 16 /* mailer connection info (offset) */ |
---|
| 796 | |
---|
| 797 | # define s_class s_value.sv_class |
---|
| 798 | # define s_address s_value.sv_addr |
---|
| 799 | # define s_mailer s_value.sv_mailer |
---|
| 800 | # define s_alias s_value.sv_alias |
---|
| 801 | # define s_mci s_value.sv_mci |
---|
| 802 | # define s_mapclass s_value.sv_mapclass |
---|
| 803 | # define s_hostsig s_value.sv_hostsig |
---|
| 804 | # define s_map s_value.sv_map |
---|
| 805 | # define s_namecanon s_value.sv_namecanon |
---|
| 806 | # define s_macro s_value.sv_macro |
---|
| 807 | # define s_ruleset s_value.sv_ruleset |
---|
| 808 | # define s_service s_value.sv_service |
---|
| 809 | # define s_header s_value.sv_header |
---|
| 810 | |
---|
| 811 | extern STAB *stab __P((char *, int, int)); |
---|
| 812 | extern void stabapply __P((void (*)(STAB *, int), int)); |
---|
| 813 | |
---|
| 814 | /* opcodes to stab */ |
---|
| 815 | # define ST_FIND 0 /* find entry */ |
---|
| 816 | # define ST_ENTER 1 /* enter if not there */ |
---|
| 817 | /* |
---|
| 818 | ** STRUCT EVENT -- event queue. |
---|
| 819 | ** |
---|
| 820 | ** Maintained in sorted order. |
---|
| 821 | ** |
---|
| 822 | ** We store the pid of the process that set this event to insure |
---|
| 823 | ** that when we fork we will not take events intended for the parent. |
---|
| 824 | */ |
---|
| 825 | |
---|
| 826 | struct event |
---|
| 827 | { |
---|
| 828 | time_t ev_time; /* time of the function call */ |
---|
| 829 | void (*ev_func)__P((int)); |
---|
| 830 | /* function to call */ |
---|
| 831 | int ev_arg; /* argument to ev_func */ |
---|
| 832 | int ev_pid; /* pid that set this event */ |
---|
| 833 | struct event *ev_link; /* link to next item */ |
---|
| 834 | }; |
---|
| 835 | |
---|
| 836 | typedef struct event EVENT; |
---|
| 837 | |
---|
| 838 | EXTERN EVENT *EventQueue; /* head of event queue */ |
---|
| 839 | |
---|
| 840 | /* functions */ |
---|
| 841 | extern EVENT *setevent __P((time_t, void(*)(), int)); |
---|
| 842 | extern void clrevent __P((EVENT *)); |
---|
| 843 | /* |
---|
| 844 | ** Operation, send, error, and MIME modes |
---|
| 845 | ** |
---|
| 846 | ** The operation mode describes the basic operation of sendmail. |
---|
| 847 | ** This can be set from the command line, and is "send mail" by |
---|
| 848 | ** default. |
---|
| 849 | ** |
---|
| 850 | ** The send mode tells how to send mail. It can be set in the |
---|
| 851 | ** configuration file. It's setting determines how quickly the |
---|
| 852 | ** mail will be delivered versus the load on your system. If the |
---|
| 853 | ** -v (verbose) flag is given, it will be forced to SM_DELIVER |
---|
| 854 | ** mode. |
---|
| 855 | ** |
---|
| 856 | ** The error mode tells how to return errors. |
---|
| 857 | */ |
---|
| 858 | |
---|
| 859 | EXTERN char OpMode; /* operation mode, see below */ |
---|
| 860 | |
---|
| 861 | #define MD_DELIVER 'm' /* be a mail sender */ |
---|
| 862 | #define MD_SMTP 's' /* run SMTP on standard input */ |
---|
| 863 | #define MD_ARPAFTP 'a' /* obsolete ARPANET mode (Grey Book) */ |
---|
| 864 | #define MD_DAEMON 'd' /* run as a daemon */ |
---|
| 865 | #define MD_FGDAEMON 'D' /* run daemon in foreground */ |
---|
| 866 | #define MD_VERIFY 'v' /* verify: don't collect or deliver */ |
---|
| 867 | #define MD_TEST 't' /* test mode: resolve addrs only */ |
---|
| 868 | #define MD_INITALIAS 'i' /* initialize alias database */ |
---|
| 869 | #define MD_PRINT 'p' /* print the queue */ |
---|
| 870 | #define MD_FREEZE 'z' /* freeze the configuration file */ |
---|
| 871 | #define MD_HOSTSTAT 'h' /* print persistent host stat info */ |
---|
| 872 | #define MD_PURGESTAT 'H' /* purge persistent host stat info */ |
---|
| 873 | |
---|
| 874 | /* values for e_sendmode -- send modes */ |
---|
| 875 | #define SM_DELIVER 'i' /* interactive delivery */ |
---|
| 876 | #define SM_FORK 'b' /* deliver in background */ |
---|
| 877 | #define SM_QUEUE 'q' /* queue, don't deliver */ |
---|
| 878 | #define SM_DEFER 'd' /* defer map lookups as well as queue */ |
---|
| 879 | #define SM_VERIFY 'v' /* verify only (used internally) */ |
---|
| 880 | |
---|
| 881 | /* used only as a parameter to sendall */ |
---|
| 882 | #define SM_DEFAULT '\0' /* unspecified, use SendMode */ |
---|
| 883 | |
---|
| 884 | |
---|
| 885 | /* values for e_errormode -- error handling modes */ |
---|
| 886 | #define EM_PRINT 'p' /* print errors */ |
---|
| 887 | #define EM_MAIL 'm' /* mail back errors */ |
---|
| 888 | #define EM_WRITE 'w' /* write back errors */ |
---|
| 889 | #define EM_BERKNET 'e' /* special berknet processing */ |
---|
| 890 | #define EM_QUIET 'q' /* don't print messages (stat only) */ |
---|
| 891 | |
---|
| 892 | |
---|
| 893 | /* MIME processing mode */ |
---|
| 894 | EXTERN int MimeMode; |
---|
| 895 | |
---|
| 896 | /* bit values for MimeMode */ |
---|
| 897 | #define MM_CVTMIME 0x0001 /* convert 8 to 7 bit MIME */ |
---|
| 898 | #define MM_PASS8BIT 0x0002 /* just send 8 bit data blind */ |
---|
| 899 | #define MM_MIME8BIT 0x0004 /* convert 8-bit data to MIME */ |
---|
| 900 | |
---|
| 901 | /* queue sorting order algorithm */ |
---|
| 902 | EXTERN int QueueSortOrder; |
---|
| 903 | |
---|
| 904 | #define QS_BYPRIORITY 0 /* sort by message priority */ |
---|
| 905 | #define QS_BYHOST 1 /* sort by first host name */ |
---|
| 906 | #define QS_BYTIME 2 /* sort by submission time */ |
---|
| 907 | |
---|
| 908 | |
---|
| 909 | /* how to handle messages without any recipient addresses */ |
---|
| 910 | EXTERN int NoRecipientAction; |
---|
| 911 | |
---|
| 912 | #define NRA_NO_ACTION 0 /* just leave it as is */ |
---|
| 913 | #define NRA_ADD_TO 1 /* add To: header */ |
---|
| 914 | #define NRA_ADD_APPARENTLY_TO 2 /* add Apparently-To: header */ |
---|
| 915 | #define NRA_ADD_BCC 3 /* add empty Bcc: header */ |
---|
| 916 | #define NRA_ADD_TO_UNDISCLOSED 4 /* add To: undisclosed:; header */ |
---|
| 917 | |
---|
| 918 | |
---|
| 919 | /* flags to putxline */ |
---|
| 920 | #define PXLF_NOTHINGSPECIAL 0 /* no special mapping */ |
---|
| 921 | #define PXLF_MAPFROM 0x0001 /* map From_ to >From_ */ |
---|
| 922 | #define PXLF_STRIP8BIT 0x0002 /* strip 8th bit */ |
---|
| 923 | #define PXLF_HEADER 0x0004 /* map newlines in headers */ |
---|
| 924 | /* |
---|
| 925 | ** Additional definitions |
---|
| 926 | */ |
---|
| 927 | |
---|
| 928 | |
---|
| 929 | /* |
---|
| 930 | ** Privacy flags |
---|
| 931 | ** These are bit values for the PrivacyFlags word. |
---|
| 932 | */ |
---|
| 933 | |
---|
| 934 | #define PRIV_PUBLIC 0 /* what have I got to hide? */ |
---|
| 935 | #define PRIV_NEEDMAILHELO 0x0001 /* insist on HELO for MAIL, at least */ |
---|
| 936 | #define PRIV_NEEDEXPNHELO 0x0002 /* insist on HELO for EXPN */ |
---|
| 937 | #define PRIV_NEEDVRFYHELO 0x0004 /* insist on HELO for VRFY */ |
---|
| 938 | #define PRIV_NOEXPN 0x0008 /* disallow EXPN command entirely */ |
---|
| 939 | #define PRIV_NOVRFY 0x0010 /* disallow VRFY command entirely */ |
---|
| 940 | #define PRIV_AUTHWARNINGS 0x0020 /* flag possible authorization probs */ |
---|
| 941 | #define PRIV_NORECEIPTS 0x0040 /* disallow return receipts */ |
---|
| 942 | #define PRIV_NOETRN 0x0080 /* disallow ETRN command entirely */ |
---|
| 943 | #define PRIV_NOVERB 0x0100 /* disallow VERB command entirely */ |
---|
| 944 | #define PRIV_RESTRICTMAILQ 0x1000 /* restrict mailq command */ |
---|
| 945 | #define PRIV_RESTRICTQRUN 0x2000 /* restrict queue run */ |
---|
| 946 | #define PRIV_GOAWAY 0x0fff /* don't give no info, anyway, anyhow */ |
---|
| 947 | |
---|
| 948 | /* struct defining such things */ |
---|
| 949 | struct prival |
---|
| 950 | { |
---|
| 951 | char *pv_name; /* name of privacy flag */ |
---|
| 952 | int pv_flag; /* numeric level */ |
---|
| 953 | }; |
---|
| 954 | |
---|
| 955 | |
---|
| 956 | /* |
---|
| 957 | ** Flags passed to remotename, parseaddr, allocaddr, and buildaddr. |
---|
| 958 | */ |
---|
| 959 | |
---|
| 960 | #define RF_SENDERADDR 0x001 /* this is a sender address */ |
---|
| 961 | #define RF_HEADERADDR 0x002 /* this is a header address */ |
---|
| 962 | #define RF_CANONICAL 0x004 /* strip comment information */ |
---|
| 963 | #define RF_ADDDOMAIN 0x008 /* OK to do domain extension */ |
---|
| 964 | #define RF_COPYPARSE 0x010 /* copy parsed user & host */ |
---|
| 965 | #define RF_COPYPADDR 0x020 /* copy print address */ |
---|
| 966 | #define RF_COPYALL (RF_COPYPARSE|RF_COPYPADDR) |
---|
| 967 | #define RF_COPYNONE 0 |
---|
| 968 | |
---|
| 969 | |
---|
| 970 | /* |
---|
| 971 | ** Flags passed to safefile/safedirpath. |
---|
| 972 | */ |
---|
| 973 | |
---|
| 974 | #define SFF_ANYFILE 0 /* no special restrictions */ |
---|
| 975 | #define SFF_MUSTOWN 0x0001 /* user must own this file */ |
---|
| 976 | #define SFF_NOSLINK 0x0002 /* file cannot be a symbolic link */ |
---|
| 977 | #define SFF_ROOTOK 0x0004 /* ok for root to own this file */ |
---|
| 978 | #define SFF_RUNASREALUID 0x0008 /* if no ctladdr, run as real uid */ |
---|
| 979 | #define SFF_NOPATHCHECK 0x0010 /* don't bother checking dir path */ |
---|
| 980 | #define SFF_SETUIDOK 0x0020 /* setuid files are ok */ |
---|
| 981 | #define SFF_CREAT 0x0040 /* ok to create file if necessary */ |
---|
| 982 | #define SFF_REGONLY 0x0080 /* regular files only */ |
---|
| 983 | #define SFF_SAFEDIRPATH 0x0100 /* no writable directories allowed */ |
---|
| 984 | #define SFF_NOHLINK 0x0200 /* file cannot have hard links */ |
---|
| 985 | #define SFF_NOWLINK 0x0400 /* links only in non-writable dirs */ |
---|
| 986 | #define SFF_NOGWFILES 0x0800 /* disallow world writable files */ |
---|
| 987 | #define SFF_NOWWFILES 0x1000 /* disallow group writable files */ |
---|
| 988 | |
---|
| 989 | /* flags that are actually specific to safeopen/safefopen/dfopen */ |
---|
| 990 | #define SFF_OPENASROOT 0x2000 /* open as root instead of real user */ |
---|
| 991 | #define SFF_NOLOCK 0x4000 /* don't lock the file */ |
---|
| 992 | |
---|
| 993 | /* pseudo-flags */ |
---|
| 994 | #define SFF_NOLINK (SFF_NOHLINK|SFF_NOSLINK) |
---|
| 995 | |
---|
| 996 | /* functions */ |
---|
| 997 | extern int safefile __P((char *, UID_T, GID_T, char *, int, int, struct stat *)); |
---|
| 998 | extern int safedirpath __P((char *, UID_T, GID_T, char *, int)); |
---|
| 999 | extern int safeopen __P((char *, int, int, int)); |
---|
| 1000 | extern FILE *safefopen __P((char *, int, int, int)); |
---|
| 1001 | extern int dfopen __P((char *, int, int, int)); |
---|
| 1002 | extern bool filechanged __P((char *, int, struct stat *)); |
---|
| 1003 | |
---|
| 1004 | |
---|
| 1005 | /* |
---|
| 1006 | ** Flags passed to mime8to7. |
---|
| 1007 | */ |
---|
| 1008 | |
---|
| 1009 | #define M87F_OUTER 0 /* outer context */ |
---|
| 1010 | #define M87F_NO8BIT 0x0001 /* can't have 8-bit in this section */ |
---|
| 1011 | #define M87F_DIGEST 0x0002 /* processing multipart/digest */ |
---|
| 1012 | #define M87F_NO8TO7 0x0004 /* don't do 8->7 bit conversions */ |
---|
| 1013 | |
---|
| 1014 | |
---|
| 1015 | /* |
---|
| 1016 | ** Flags passed to returntosender. |
---|
| 1017 | */ |
---|
| 1018 | |
---|
| 1019 | #define RTSF_NO_BODY 0 /* send headers only */ |
---|
| 1020 | #define RTSF_SEND_BODY 0x0001 /* include body of message in return */ |
---|
| 1021 | #define RTSF_PM_BOUNCE 0x0002 /* this is a postmaster bounce */ |
---|
| 1022 | |
---|
| 1023 | |
---|
| 1024 | /* |
---|
| 1025 | ** Regular UNIX sockaddrs are too small to handle ISO addresses, so |
---|
| 1026 | ** we are forced to declare a supertype here. |
---|
| 1027 | */ |
---|
| 1028 | |
---|
| 1029 | # if NETINET || NETUNIX || NETISO || NETNS || NETX25 |
---|
| 1030 | union bigsockaddr |
---|
| 1031 | { |
---|
| 1032 | struct sockaddr sa; /* general version */ |
---|
| 1033 | #if NETUNIX |
---|
| 1034 | struct sockaddr_un sunix; /* UNIX family */ |
---|
| 1035 | #endif |
---|
| 1036 | #if NETINET |
---|
| 1037 | struct sockaddr_in sin; /* INET family */ |
---|
| 1038 | #endif |
---|
| 1039 | #if NETISO |
---|
| 1040 | struct sockaddr_iso siso; /* ISO family */ |
---|
| 1041 | #endif |
---|
| 1042 | #if NETNS |
---|
| 1043 | struct sockaddr_ns sns; /* XNS family */ |
---|
| 1044 | #endif |
---|
| 1045 | #if NETX25 |
---|
| 1046 | struct sockaddr_x25 sx25; /* X.25 family */ |
---|
| 1047 | #endif |
---|
| 1048 | }; |
---|
| 1049 | |
---|
| 1050 | #define SOCKADDR union bigsockaddr |
---|
| 1051 | |
---|
| 1052 | EXTERN SOCKADDR RealHostAddr; /* address of host we are talking to */ |
---|
| 1053 | |
---|
| 1054 | extern char *hostnamebyanyaddr __P((SOCKADDR *)); |
---|
| 1055 | extern char *anynet_ntoa __P((SOCKADDR *)); |
---|
| 1056 | # if DAEMON |
---|
| 1057 | extern char *validate_connection __P((SOCKADDR *, char *, ENVELOPE *)); |
---|
| 1058 | # endif |
---|
| 1059 | |
---|
| 1060 | #endif |
---|
| 1061 | |
---|
| 1062 | |
---|
| 1063 | /* |
---|
| 1064 | ** Vendor codes |
---|
| 1065 | ** |
---|
| 1066 | ** Vendors can customize sendmail to add special behaviour, |
---|
| 1067 | ** generally for back compatibility. Ideally, this should |
---|
| 1068 | ** be set up in the .cf file using the "V" command. However, |
---|
| 1069 | ** it's quite reasonable for some vendors to want the default |
---|
| 1070 | ** be their old version; this can be set using |
---|
| 1071 | ** -DVENDOR_DEFAULT=VENDOR_xxx |
---|
| 1072 | ** in the Makefile. |
---|
| 1073 | ** |
---|
| 1074 | ** Vendors should apply to sendmail@CS.Berkeley.EDU for |
---|
| 1075 | ** unique vendor codes. |
---|
| 1076 | */ |
---|
| 1077 | |
---|
| 1078 | #define VENDOR_BERKELEY 1 /* Berkeley-native configuration file */ |
---|
| 1079 | #define VENDOR_SUN 2 /* Sun-native configuration file */ |
---|
| 1080 | #define VENDOR_HP 3 /* Hewlett-Packard specific config syntax */ |
---|
| 1081 | #define VENDOR_IBM 4 /* IBM specific config syntax */ |
---|
| 1082 | #define VENDOR_SENDMAIL 5 /* Sendmail, Inc. specific config syntax */ |
---|
| 1083 | |
---|
| 1084 | EXTERN int VendorCode; /* vendor-specific operation enhancements */ |
---|
| 1085 | |
---|
| 1086 | /* prototypes for vendor-specific hook routines */ |
---|
| 1087 | extern void vendor_set_uid __P((UID_T)); |
---|
| 1088 | extern void vendor_daemon_setup __P((ENVELOPE *)); |
---|
| 1089 | |
---|
| 1090 | /* |
---|
| 1091 | ** DontBlameSendmail options |
---|
| 1092 | ** |
---|
| 1093 | ** Hopefully nobody uses these. |
---|
| 1094 | */ |
---|
| 1095 | #define DBS_SAFE 0 |
---|
| 1096 | #define DBS_ASSUMESAFECHOWN 0x00000001 |
---|
| 1097 | #define DBS_GROUPWRITABLEDIRPATHSAFE 0x00000002 |
---|
| 1098 | #define DBS_GROUPWRITABLEFORWARDFILESAFE 0x00000004 |
---|
| 1099 | #define DBS_GROUPWRITABLEINCLUDEFILESAFE 0x00000008 |
---|
| 1100 | #define DBS_GROUPWRITABLEALIASFILE 0x00000010 |
---|
| 1101 | #define DBS_WORLDWRITABLEALIASFILE 0x00000020 |
---|
| 1102 | #define DBS_FORWARDFILEINUNSAFEDIRPATH 0x00000040 |
---|
| 1103 | #define DBS_MAPINUNSAFEDIRPATH 0x00000080 |
---|
| 1104 | #define DBS_LINKEDALIASFILEINWRITABLEDIR 0x00000100 |
---|
| 1105 | #define DBS_LINKEDCLASSFILEINWRITABLEDIR 0x00000200 |
---|
| 1106 | #define DBS_LINKEDFORWARDFILEINWRITABLEDIR 0x00000400 |
---|
| 1107 | #define DBS_LINKEDINCLUDEFILEINWRITABLEDIR 0x00000800 |
---|
| 1108 | #define DBS_LINKEDMAPINWRITABLEDIR 0x00001000 |
---|
| 1109 | #define DBS_LINKEDSERVICESWITCHFILEINWRITABLEDIR 0x00002000 |
---|
| 1110 | #define DBS_FILEDELIVERYTOHARDLINK 0x00004000 |
---|
| 1111 | #define DBS_FILEDELIVERYTOSYMLINK 0x00008000 |
---|
| 1112 | #define DBS_WRITEMAPTOHARDLINK 0x00010000 |
---|
| 1113 | #define DBS_WRITEMAPTOSYMLINK 0x00020000 |
---|
| 1114 | #define DBS_WRITESTATSTOHARDLINK 0x00040000 |
---|
| 1115 | #define DBS_WRITESTATSTOSYMLINK 0x00080000 |
---|
| 1116 | #define DBS_FORWARDFILEINGROUPWRITABLEDIRPATH 0x00100000 |
---|
| 1117 | #define DBS_INCLUDEFILEINGROUPWRITABLEDIRPATH 0x00200000 |
---|
| 1118 | #define DBS_CLASSFILEINUNSAFEDIRPATH 0x00400000 |
---|
| 1119 | #define DBS_ERRORHEADERINUNSAFEDIRPATH 0x00800000 |
---|
| 1120 | #define DBS_HELPFILEINUNSAFEDIRPATH 0x01000000 |
---|
| 1121 | #define DBS_FORWARDFILEINUNSAFEDIRPATHSAFE 0x02000000 |
---|
| 1122 | #define DBS_INCLUDEFILEINUNSAFEDIRPATHSAFE 0x04000000 |
---|
| 1123 | #define DBS_RUNPROGRAMINUNSAFEDIRPATH 0x08000000 |
---|
| 1124 | #define DBS_RUNWRITABLEPROGRAM 0x10000000 |
---|
| 1125 | #define DBS_INCLUDEFILEINUNSAFEDIRPATH 0x20000000 |
---|
| 1126 | |
---|
| 1127 | /* struct defining such things */ |
---|
| 1128 | struct dbsval |
---|
| 1129 | { |
---|
| 1130 | char *dbs_name; /* name of DontBlameSendmail flag */ |
---|
| 1131 | long dbs_flag; /* numeric level */ |
---|
| 1132 | }; |
---|
| 1133 | |
---|
| 1134 | EXTERN long DontBlameSendmail; /* DontBlameSendmail option bits */ |
---|
| 1135 | |
---|
| 1136 | /* |
---|
| 1137 | ** Terminal escape codes. |
---|
| 1138 | ** |
---|
| 1139 | ** To make debugging output clearer. |
---|
| 1140 | */ |
---|
| 1141 | |
---|
| 1142 | struct termescape |
---|
| 1143 | { |
---|
| 1144 | char *te_rv_on; /* turn reverse-video on */ |
---|
| 1145 | char *te_rv_off; /* turn reverse-video off */ |
---|
| 1146 | }; |
---|
| 1147 | |
---|
| 1148 | EXTERN struct termescape TermEscape; |
---|
| 1149 | |
---|
| 1150 | |
---|
| 1151 | /* |
---|
| 1152 | ** Error return from inet_addr(3), in case not defined in /usr/include. |
---|
| 1153 | */ |
---|
| 1154 | |
---|
| 1155 | #ifndef INADDR_NONE |
---|
| 1156 | # define INADDR_NONE 0xffffffff |
---|
| 1157 | #endif |
---|
| 1158 | /* |
---|
| 1159 | ** Global variables. |
---|
| 1160 | */ |
---|
| 1161 | |
---|
| 1162 | EXTERN bool FromFlag; /* if set, "From" person is explicit */ |
---|
| 1163 | EXTERN bool MeToo; /* send to the sender also */ |
---|
| 1164 | EXTERN bool IgnrDot; /* don't let dot end messages */ |
---|
| 1165 | EXTERN bool SaveFrom; /* save leading "From" lines */ |
---|
| 1166 | EXTERN bool GrabTo; /* if set, get recipients from msg */ |
---|
| 1167 | EXTERN bool SuprErrs; /* set if we are suppressing errors */ |
---|
| 1168 | EXTERN bool HoldErrs; /* only output errors to transcript */ |
---|
| 1169 | EXTERN bool NoConnect; /* don't connect to non-local mailers */ |
---|
| 1170 | EXTERN bool SuperSafe; /* be extra careful, even if expensive */ |
---|
| 1171 | EXTERN bool ForkQueueRuns; /* fork for each job when running the queue */ |
---|
| 1172 | EXTERN bool AutoRebuild; /* auto-rebuild the alias database as needed */ |
---|
| 1173 | EXTERN bool CheckAliases; /* parse addresses during newaliases */ |
---|
| 1174 | EXTERN bool NoAlias; /* suppress aliasing */ |
---|
| 1175 | EXTERN bool UseNameServer; /* using DNS -- interpret h_errno & MX RRs */ |
---|
| 1176 | EXTERN bool UseHesiod; /* using Hesiod -- interpret Hesiod errors */ |
---|
| 1177 | EXTERN bool SevenBitInput; /* force 7-bit data on input */ |
---|
| 1178 | EXTERN bool HasEightBits; /* has at least one eight bit input byte */ |
---|
| 1179 | EXTERN bool ConfigFileRead; /* configuration file has been read */ |
---|
| 1180 | EXTERN time_t SafeAlias; /* interval to wait until @:@ in alias file */ |
---|
| 1181 | EXTERN FILE *InChannel; /* input connection */ |
---|
| 1182 | EXTERN FILE *OutChannel; /* output connection */ |
---|
| 1183 | EXTERN char *RealUserName; /* real user name of caller */ |
---|
| 1184 | EXTERN uid_t RealUid; /* real uid of caller */ |
---|
| 1185 | EXTERN gid_t RealGid; /* real gid of caller */ |
---|
| 1186 | EXTERN uid_t DefUid; /* default uid to run as */ |
---|
| 1187 | EXTERN gid_t DefGid; /* default gid to run as */ |
---|
| 1188 | EXTERN char *DefUser; /* default user to run as (from DefUid) */ |
---|
| 1189 | EXTERN uid_t TrustedUid; /* uid of trusted user for files and startup */ |
---|
| 1190 | EXTERN MODE_T OldUmask; /* umask when sendmail starts up */ |
---|
| 1191 | EXTERN int Verbose; /* set if blow-by-blow desired */ |
---|
| 1192 | EXTERN int Errors; /* set if errors (local to single pass) */ |
---|
| 1193 | EXTERN int ExitStat; /* exit status code */ |
---|
| 1194 | EXTERN int LineNumber; /* line number in current input */ |
---|
| 1195 | EXTERN int LogLevel; /* level of logging to perform */ |
---|
| 1196 | EXTERN int FileMode; /* mode on files */ |
---|
| 1197 | EXTERN int QueueLA; /* load average starting forced queueing */ |
---|
| 1198 | EXTERN int RefuseLA; /* load average refusing connections are */ |
---|
| 1199 | EXTERN int CurrentLA; /* current load average */ |
---|
| 1200 | EXTERN long QueueFactor; /* slope of queue function */ |
---|
| 1201 | EXTERN time_t QueueIntvl; /* intervals between running the queue */ |
---|
| 1202 | EXTERN char *HelpFile; /* location of SMTP help file */ |
---|
| 1203 | EXTERN char *ErrMsgFile; /* file to prepend to all error messages */ |
---|
| 1204 | EXTERN char *StatFile; /* location of statistics summary */ |
---|
| 1205 | EXTERN char *QueueDir; /* location of queue directory */ |
---|
| 1206 | EXTERN char *FileName; /* name to print on error messages */ |
---|
| 1207 | EXTERN char *SmtpPhase; /* current phase in SMTP processing */ |
---|
| 1208 | EXTERN char *MyHostName; /* name of this host for SMTP messages */ |
---|
| 1209 | EXTERN char *RealHostName; /* name of host we are talking to */ |
---|
| 1210 | EXTERN char *CurHostName; /* current host we are dealing with */ |
---|
| 1211 | EXTERN jmp_buf TopFrame; /* branch-to-top-of-loop-on-error frame */ |
---|
| 1212 | EXTERN bool QuickAbort; /* .... but only if we want a quick abort */ |
---|
| 1213 | EXTERN bool OnlyOneError; /* .... or only want to give one SMTP reply */ |
---|
| 1214 | EXTERN bool LogUsrErrs; /* syslog user errors (e.g., SMTP RCPT cmd) */ |
---|
| 1215 | EXTERN bool SendMIMEErrors; /* send error messages in MIME format */ |
---|
| 1216 | EXTERN bool MatchGecos; /* look for user names in gecos field */ |
---|
| 1217 | EXTERN bool UseErrorsTo; /* use Errors-To: header (back compat) */ |
---|
| 1218 | EXTERN bool TryNullMXList; /* if we are the best MX, try host directly */ |
---|
| 1219 | EXTERN bool InChild; /* true if running in an SMTP subprocess */ |
---|
| 1220 | EXTERN bool DisConnected; /* running with OutChannel redirected to xf */ |
---|
| 1221 | EXTERN bool ColonOkInAddr; /* single colon legal in address */ |
---|
| 1222 | EXTERN bool HasWildcardMX; /* don't use MX records when canonifying */ |
---|
| 1223 | EXTERN char SpaceSub; /* substitution for <lwsp> */ |
---|
| 1224 | EXTERN int PrivacyFlags; /* privacy flags */ |
---|
| 1225 | EXTERN char *ConfFile; /* location of configuration file [conf.c] */ |
---|
| 1226 | EXTERN char *PidFile; /* location of proc id file [conf.c] */ |
---|
| 1227 | EXTERN char *ControlSocketName; /* control socket filename [control.c] */ |
---|
| 1228 | extern ADDRESS NullAddress; /* a null (template) address [main.c] */ |
---|
| 1229 | EXTERN long WkClassFact; /* multiplier for message class -> priority */ |
---|
| 1230 | EXTERN long WkRecipFact; /* multiplier for # of recipients -> priority */ |
---|
| 1231 | EXTERN long WkTimeFact; /* priority offset each time this job is run */ |
---|
| 1232 | EXTERN char *UdbSpec; /* user database source spec */ |
---|
| 1233 | EXTERN int MaxHopCount; /* max # of hops until bounce */ |
---|
| 1234 | EXTERN int ConfigLevel; /* config file level */ |
---|
| 1235 | EXTERN char *TimeZoneSpec; /* override time zone specification */ |
---|
| 1236 | EXTERN char *ForwardPath; /* path to search for .forward files */ |
---|
| 1237 | EXTERN long MinBlocksFree; /* min # of blocks free on queue fs */ |
---|
| 1238 | EXTERN char *FallBackMX; /* fall back MX host */ |
---|
| 1239 | EXTERN long MaxMessageSize; /* advertised max size we will accept */ |
---|
| 1240 | EXTERN time_t MinQueueAge; /* min delivery interval */ |
---|
| 1241 | EXTERN time_t DialDelay; /* delay between dial-on-demand tries */ |
---|
| 1242 | EXTERN char *SafeFileEnv; /* chroot location for file delivery */ |
---|
| 1243 | EXTERN char *HostsFile; /* path to /etc/hosts file */ |
---|
| 1244 | EXTERN char *HostStatDir; /* location of host status information */ |
---|
| 1245 | EXTERN int MaxQueueRun; /* maximum number of jobs in one queue run */ |
---|
| 1246 | EXTERN int MaxChildren; /* maximum number of daemonic children */ |
---|
| 1247 | EXTERN int CurChildren; /* current number of daemonic children */ |
---|
| 1248 | EXTERN char *SmtpGreeting; /* SMTP greeting message (old $e macro) */ |
---|
| 1249 | EXTERN char *UnixFromLine; /* UNIX From_ line (old $l macro) */ |
---|
| 1250 | EXTERN char *OperatorChars; /* operators (old $o macro) */ |
---|
| 1251 | EXTERN bool DontInitGroups; /* avoid initgroups() because of NIS cost */ |
---|
| 1252 | EXTERN int DefaultNotify; /* default DSN notification flags */ |
---|
| 1253 | EXTERN bool AllowBogusHELO; /* allow syntax errors on HELO command */ |
---|
| 1254 | EXTERN bool UserSubmission; /* initial (user) mail submission */ |
---|
| 1255 | EXTERN char *RunAsUserName; /* user to become for bulk of run */ |
---|
| 1256 | EXTERN uid_t RunAsUid; /* UID to become for bulk of run */ |
---|
| 1257 | EXTERN gid_t RunAsGid; /* GID to become for bulk of run */ |
---|
| 1258 | EXTERN int MaxRcptPerMsg; /* max recipients per SMTP message */ |
---|
| 1259 | EXTERN bool DoQueueRun; /* non-interrupt time queue run needed */ |
---|
| 1260 | EXTERN u_long ConnectOnlyTo; /* override connection address (for testing) */ |
---|
| 1261 | EXTERN int MaxHeadersLength; /* max length of headers */ |
---|
| 1262 | #if _FFR_DSN_RRT_OPTION |
---|
| 1263 | EXTERN bool RrtImpliesDsn; /* turn Return-Receipt-To: into DSN */ |
---|
| 1264 | #endif |
---|
| 1265 | EXTERN char *DeadLetterDrop; /* path to dead letter office */ |
---|
| 1266 | EXTERN bool DontProbeInterfaces; /* don't probe interfaces for names */ |
---|
| 1267 | EXTERN bool ChownAlwaysSafe; /* treat chown(2) as safe */ |
---|
| 1268 | EXTERN bool IgnoreHostStatus; /* ignore long term host status files */ |
---|
| 1269 | EXTERN bool SingleThreadDelivery; /* single thread hosts on delivery */ |
---|
| 1270 | EXTERN bool SingleLineFromHeader; /* force From: header to be one line */ |
---|
| 1271 | EXTERN bool DontLockReadFiles; /* don't read lock support files */ |
---|
| 1272 | EXTERN int ConnRateThrottle; /* throttle for SMTP connection rate */ |
---|
| 1273 | EXTERN int MaxAliasRecursion; /* maximum depth of alias recursion */ |
---|
| 1274 | EXTERN int MaxMacroRecursion; /* maximum depth of macro recursion */ |
---|
| 1275 | EXTERN int MaxRuleRecursion; /* maximum depth of ruleset recursion */ |
---|
| 1276 | EXTERN char *MustQuoteChars; /* quote these characters in phrases */ |
---|
| 1277 | EXTERN char *ServiceSwitchFile; /* backup service switch */ |
---|
| 1278 | EXTERN char *DefaultCharSet; /* default character set for MIME */ |
---|
| 1279 | EXTERN char *PostMasterCopy; /* address to get errs cc's */ |
---|
| 1280 | EXTERN int CheckpointInterval; /* queue file checkpoint interval */ |
---|
| 1281 | EXTERN bool DontPruneRoutes; /* don't prune source routes */ |
---|
| 1282 | EXTERN bool DontExpandCnames; /* do not $[...$] expand CNAMEs */ |
---|
| 1283 | EXTERN int MaxMciCache; /* maximum entries in MCI cache */ |
---|
| 1284 | EXTERN time_t ServiceCacheTime; /* time service switch was cached */ |
---|
| 1285 | EXTERN time_t ServiceCacheMaxAge; /* refresh interval for cache */ |
---|
| 1286 | EXTERN time_t MciCacheTimeout; /* maximum idle time on connections */ |
---|
| 1287 | EXTERN time_t MciInfoTimeout; /* how long 'til we retry down hosts */ |
---|
| 1288 | EXTERN FILE *TrafficLogFile; /* file in which to log all traffic */ |
---|
| 1289 | EXTERN char *DoubleBounceAddr; /* where to send double bounces */ |
---|
| 1290 | EXTERN char **ExternalEnviron; /* input environment */ |
---|
| 1291 | EXTERN char *UserEnviron[MAXUSERENVIRON + 1]; |
---|
| 1292 | /* saved user environment */ |
---|
| 1293 | EXTERN int MaxMimeHeaderLength; /* maximum MIME header length */ |
---|
| 1294 | EXTERN int MaxMimeFieldLength; /* maximum MIME field length */ |
---|
| 1295 | |
---|
| 1296 | extern int errno; |
---|
| 1297 | |
---|
| 1298 | /* |
---|
| 1299 | ** Queue Run Limitations |
---|
| 1300 | */ |
---|
| 1301 | struct queue_char |
---|
| 1302 | { |
---|
| 1303 | char *queue_match; /* string to match */ |
---|
| 1304 | struct queue_char *queue_next; |
---|
| 1305 | }; |
---|
| 1306 | |
---|
| 1307 | typedef struct queue_char QUEUE_CHAR; |
---|
| 1308 | |
---|
| 1309 | EXTERN QUEUE_CHAR *QueueLimitRecipient; /* limit queue runs to this recipient */ |
---|
| 1310 | EXTERN QUEUE_CHAR *QueueLimitSender; /* limit queue runs to this sender */ |
---|
| 1311 | EXTERN QUEUE_CHAR *QueueLimitId; /* limit queue runs to this id */ |
---|
| 1312 | |
---|
| 1313 | /* |
---|
| 1314 | ** Timeouts |
---|
| 1315 | ** |
---|
| 1316 | ** Indicated values are the MINIMUM per RFC 1123 section 5.3.2. |
---|
| 1317 | */ |
---|
| 1318 | |
---|
| 1319 | EXTERN struct |
---|
| 1320 | { |
---|
| 1321 | /* RFC 1123-specified timeouts [minimum value] */ |
---|
| 1322 | time_t to_initial; /* initial greeting timeout [5m] */ |
---|
| 1323 | time_t to_mail; /* MAIL command [5m] */ |
---|
| 1324 | time_t to_rcpt; /* RCPT command [5m] */ |
---|
| 1325 | time_t to_datainit; /* DATA initiation [2m] */ |
---|
| 1326 | time_t to_datablock; /* DATA block [3m] */ |
---|
| 1327 | time_t to_datafinal; /* DATA completion [10m] */ |
---|
| 1328 | time_t to_nextcommand; /* next command [5m] */ |
---|
| 1329 | /* following timeouts are not mentioned in RFC 1123 */ |
---|
| 1330 | time_t to_iconnect; /* initial connection timeout (first try) */ |
---|
| 1331 | time_t to_connect; /* initial connection timeout (later tries) */ |
---|
| 1332 | time_t to_rset; /* RSET command */ |
---|
| 1333 | time_t to_helo; /* HELO command */ |
---|
| 1334 | time_t to_quit; /* QUIT command */ |
---|
| 1335 | time_t to_miscshort; /* misc short commands (NOOP, VERB, etc) */ |
---|
| 1336 | time_t to_ident; /* IDENT protocol requests */ |
---|
| 1337 | time_t to_fileopen; /* opening :include: and .forward files */ |
---|
| 1338 | /* following are per message */ |
---|
| 1339 | time_t to_q_return[MAXTOCLASS]; /* queue return timeouts */ |
---|
| 1340 | time_t to_q_warning[MAXTOCLASS]; /* queue warning timeouts */ |
---|
| 1341 | } TimeOuts; |
---|
| 1342 | |
---|
| 1343 | /* timeout classes for return and warning timeouts */ |
---|
| 1344 | # define TOC_NORMAL 0 /* normal delivery */ |
---|
| 1345 | # define TOC_URGENT 1 /* urgent delivery */ |
---|
| 1346 | # define TOC_NONURGENT 2 /* non-urgent delivery */ |
---|
| 1347 | |
---|
| 1348 | |
---|
| 1349 | /* |
---|
| 1350 | ** Trace information |
---|
| 1351 | */ |
---|
| 1352 | |
---|
| 1353 | /* trace vector and macros for debugging flags */ |
---|
| 1354 | EXTERN u_char tTdvect[100]; |
---|
| 1355 | # define tTd(flag, level) (tTdvect[flag] >= level) |
---|
| 1356 | # define tTdlevel(flag) (tTdvect[flag]) |
---|
| 1357 | /* |
---|
| 1358 | ** Miscellaneous information. |
---|
| 1359 | */ |
---|
| 1360 | |
---|
| 1361 | |
---|
| 1362 | /* |
---|
| 1363 | ** The "no queue id" queue id for sm_syslog |
---|
| 1364 | */ |
---|
| 1365 | |
---|
| 1366 | #define NOQID "*~*" |
---|
| 1367 | |
---|
| 1368 | |
---|
| 1369 | /* |
---|
| 1370 | ** Some in-line functions |
---|
| 1371 | */ |
---|
| 1372 | |
---|
| 1373 | /* set exit status */ |
---|
| 1374 | #define setstat(s) { \ |
---|
| 1375 | if (ExitStat == EX_OK || ExitStat == EX_TEMPFAIL) \ |
---|
| 1376 | ExitStat = s; \ |
---|
| 1377 | } |
---|
| 1378 | |
---|
| 1379 | /* make a copy of a string */ |
---|
| 1380 | #define newstr(s) strcpy(xalloc(strlen(s) + 1), s) |
---|
| 1381 | |
---|
| 1382 | #define STRUCTCOPY(s, d) d = s |
---|
| 1383 | |
---|
| 1384 | |
---|
| 1385 | |
---|
| 1386 | /* |
---|
| 1387 | ** Declarations of useful functions |
---|
| 1388 | */ |
---|
| 1389 | |
---|
| 1390 | extern char *xalloc __P((int)); |
---|
| 1391 | extern char *sfgets __P((char *, int, FILE *, time_t, char *)); |
---|
| 1392 | extern char *queuename __P((ENVELOPE *, int)); |
---|
| 1393 | extern time_t curtime __P((void)); |
---|
| 1394 | extern bool transienterror __P((int)); |
---|
| 1395 | extern char *fgetfolded __P((char *, int, FILE *)); |
---|
| 1396 | extern char *username __P((void)); |
---|
| 1397 | extern char *pintvl __P((time_t, bool)); |
---|
| 1398 | extern bool shouldqueue __P((long, time_t)); |
---|
| 1399 | extern bool lockfile __P((int, char *, char *, int)); |
---|
| 1400 | extern char *hostsignature __P((MAILER *, char *, ENVELOPE *)); |
---|
| 1401 | extern void openxscript __P((ENVELOPE *)); |
---|
| 1402 | extern void closexscript __P((ENVELOPE *)); |
---|
| 1403 | extern char *shortenstring __P((const char *, int)); |
---|
| 1404 | extern bool usershellok __P((char *, char *)); |
---|
| 1405 | extern char *defcharset __P((ENVELOPE *)); |
---|
| 1406 | extern bool wordinclass __P((char *, int)); |
---|
| 1407 | extern char *denlstring __P((char *, bool, bool)); |
---|
| 1408 | extern void makelower __P((char *)); |
---|
| 1409 | extern bool rebuildaliases __P((MAP *, bool)); |
---|
| 1410 | extern void readaliases __P((MAP *, FILE *, bool, bool)); |
---|
| 1411 | extern void finis __P((bool, volatile int)); |
---|
| 1412 | extern void setsender __P((char *, ENVELOPE *, char **, int, bool)); |
---|
| 1413 | extern void xputs __P((const char *)); |
---|
| 1414 | extern void logsender __P((ENVELOPE *, char *)); |
---|
| 1415 | extern void smtprset __P((MAILER *, MCI *, ENVELOPE *)); |
---|
| 1416 | extern void smtpquit __P((MAILER *, MCI *, ENVELOPE *)); |
---|
| 1417 | extern void setuserenv __P((const char *, const char *)); |
---|
| 1418 | extern char *getextenv __P((const char *)); |
---|
| 1419 | extern void disconnect __P((int, ENVELOPE *)); |
---|
| 1420 | extern void putxline __P((char *, size_t, MCI *, int)); |
---|
| 1421 | extern void dumpfd __P((int, bool, bool)); |
---|
| 1422 | extern void makemailer __P((char *)); |
---|
| 1423 | extern void putfromline __P((MCI *, ENVELOPE *)); |
---|
| 1424 | extern void setoption __P((int, char *, bool, bool, ENVELOPE *)); |
---|
| 1425 | extern void setclass __P((int, char *)); |
---|
| 1426 | extern void inittimeouts __P((char *)); |
---|
| 1427 | extern void logdelivery __P((MAILER *, MCI *, const char *, ADDRESS *, time_t, ENVELOPE *)); |
---|
| 1428 | extern void giveresponse __P((int, MAILER *, MCI *, ADDRESS *, time_t, ENVELOPE *)); |
---|
| 1429 | extern void buildfname __P((char *, char *, char *, int)); |
---|
| 1430 | extern void mci_setstat __P((MCI *, int, char *, char *)); |
---|
| 1431 | extern char *smtptodsn __P((int)); |
---|
| 1432 | extern int rscheck __P((char *, char *, char *, ENVELOPE *e)); |
---|
| 1433 | extern void mime7to8 __P((MCI *, HDR *, ENVELOPE *)); |
---|
| 1434 | extern int mime8to7 __P((MCI *, HDR *, ENVELOPE *, char **, int)); |
---|
| 1435 | extern void xfclose __P((FILE *, char *, char *)); |
---|
| 1436 | extern int switch_map_find __P((char *, char *[], short [])); |
---|
| 1437 | extern void shorten_hostname __P((char [])); |
---|
| 1438 | extern int waitfor __P((pid_t)); |
---|
| 1439 | extern void proc_list_add __P((pid_t, char *)); |
---|
| 1440 | extern void proc_list_set __P((pid_t, char *)); |
---|
| 1441 | extern void proc_list_drop __P((pid_t)); |
---|
| 1442 | extern void proc_list_clear __P((void)); |
---|
| 1443 | extern void proc_list_display __P((FILE *)); |
---|
| 1444 | extern void proc_list_probe __P((void)); |
---|
| 1445 | extern void buffer_errors __P((void)); |
---|
| 1446 | extern void flush_errors __P((bool)); |
---|
| 1447 | extern void putline __P((char *, MCI *)); |
---|
| 1448 | extern bool xtextok __P((char *)); |
---|
| 1449 | extern char *xtextify __P((char *, char *)); |
---|
| 1450 | extern char *xuntextify __P((char *)); |
---|
| 1451 | extern void cleanstrcpy __P((char *, char *, int)); |
---|
| 1452 | extern int getmxrr __P((char *, char **, bool, int *)); |
---|
| 1453 | extern int strtorwset __P((char *, char **, int)); |
---|
| 1454 | extern void printav __P((char **)); |
---|
| 1455 | extern void printopenfds __P((bool)); |
---|
| 1456 | extern int endmailer __P((MCI *, ENVELOPE *, char **)); |
---|
| 1457 | extern void fixcrlf __P((char *, bool)); |
---|
| 1458 | extern int dofork __P((void)); |
---|
| 1459 | extern void initsys __P((ENVELOPE *)); |
---|
| 1460 | extern void collect __P((FILE *, bool, HDR **, ENVELOPE *)); |
---|
| 1461 | extern void stripquotes __P((char *)); |
---|
| 1462 | extern int include __P((char *, bool, ADDRESS *, ADDRESS **, int, ENVELOPE *)); |
---|
| 1463 | extern void unlockqueue __P((ENVELOPE *)); |
---|
| 1464 | extern void xunlink __P((char *)); |
---|
| 1465 | extern bool runqueue __P((bool, bool)); |
---|
| 1466 | extern int getla __P((void)); |
---|
| 1467 | extern void sendall __P((ENVELOPE *, int)); |
---|
| 1468 | extern void queueup __P((ENVELOPE *, bool)); |
---|
| 1469 | extern void checkfds __P((char *)); |
---|
| 1470 | extern int returntosender __P((char *, ADDRESS *, int, ENVELOPE *)); |
---|
| 1471 | extern void markstats __P((ENVELOPE *, ADDRESS *, bool)); |
---|
| 1472 | extern void poststats __P((char *)); |
---|
| 1473 | extern char *arpadate __P((char *)); |
---|
| 1474 | extern int mailfile __P((char *volatile, MAILER *volatile, ADDRESS *, volatile int, ENVELOPE *)); |
---|
| 1475 | extern void loseqfile __P((ENVELOPE *, char *)); |
---|
| 1476 | extern int prog_open __P((char **, int *, ENVELOPE *)); |
---|
| 1477 | extern bool getcanonname __P((char *, int, bool)); |
---|
| 1478 | extern bool path_is_dir __P((char *, bool)); |
---|
| 1479 | extern pid_t dowork __P((char *, bool, bool, ENVELOPE *)); |
---|
| 1480 | extern int drop_privileges __P((bool)); |
---|
| 1481 | extern void fill_fd __P((int, char *)); |
---|
| 1482 | extern void closecontrolsocket __P((bool)); |
---|
| 1483 | extern void clrcontrol __P((void)); |
---|
| 1484 | |
---|
| 1485 | extern const char *errstring __P((int)); |
---|
| 1486 | extern sigfunc_t setsignal __P((int, sigfunc_t)); |
---|
| 1487 | extern int blocksignal __P((int)); |
---|
| 1488 | extern int releasesignal __P((int)); |
---|
| 1489 | extern struct hostent *sm_gethostbyname __P((char *)); |
---|
| 1490 | extern struct hostent *sm_gethostbyaddr __P((char *, int, int)); |
---|
| 1491 | extern struct passwd *sm_getpwnam __P((char *)); |
---|
| 1492 | extern struct passwd *sm_getpwuid __P((UID_T)); |
---|
| 1493 | extern struct passwd *finduser __P((char *, bool *)); |
---|
| 1494 | |
---|
| 1495 | #ifdef XDEBUG |
---|
| 1496 | extern void checkfdopen __P((int, char *)); |
---|
| 1497 | extern void checkfd012 __P((char *)); |
---|
| 1498 | #endif |
---|
| 1499 | |
---|
| 1500 | /* ellipsis is a different case though */ |
---|
| 1501 | extern void auth_warning __P((ENVELOPE *, const char *, ...)); |
---|
| 1502 | extern void syserr __P((const char *, ...)); |
---|
| 1503 | extern void usrerr __P((const char *, ...)); |
---|
| 1504 | extern void message __P((const char *, ...)); |
---|
| 1505 | extern void nmessage __P((const char *, ...)); |
---|
| 1506 | extern void setproctitle __P((const char *, ...)); |
---|
| 1507 | extern void sm_setproctitle __P((bool, const char *, ...)); |
---|
| 1508 | extern void sm_syslog __P((int, const char *, const char *, ...)); |
---|
| 1509 | |
---|
| 1510 | #if !HASSNPRINTF |
---|
| 1511 | extern int snprintf __P((char *, size_t, const char *, ...)); |
---|
| 1512 | extern int vsnprintf __P((char *, size_t, const char *, va_list)); |
---|
| 1513 | #endif |
---|
| 1514 | extern char *quad_to_string __P((QUAD_T)); |
---|