1295Seric /* 234921Sbostic * Copyright (c) 1983 Eric P. Allman 333731Sbostic * Copyright (c) 1988 Regents of the University of California. 433731Sbostic * All rights reserved. 533731Sbostic * 642829Sbostic * %sccs.include.redist.c% 733731Sbostic * 8*52106Seric * @(#)sendmail.h 5.28 (Berkeley) 01/04/92 933731Sbostic */ 1022727Sdist 1122727Sdist /* 123313Seric ** SENDMAIL.H -- Global definitions for sendmail. 13295Seric */ 14295Seric 154371Seric # ifdef _DEFINE 164371Seric # define EXTERN 175194Seric # ifndef lint 18*52106Seric static char SmailSccsId[] = "@(#)sendmail.h 5.28 01/04/92"; 195194Seric # endif lint 204371Seric # else _DEFINE 214371Seric # define EXTERN extern 224371Seric # endif _DEFINE 23295Seric 2450537Seric # include <sys/types.h> 254183Seric # include <stdio.h> 264183Seric # include <ctype.h> 277355Seric # include <setjmp.h> 2851961Seric # include <sysexits.h> 299144Seric # include "conf.h" 301390Seric # include "useful.h" 311390Seric 327674Seric # ifdef LOG 3318575Smiriam # include <sys/syslog.h> 347674Seric # endif LOG 3510679Seric 3624943Seric # ifdef DAEMON 3724943Seric # ifdef VMUNIX 3824943Seric # include <sys/socket.h> 3924943Seric # include <netinet/in.h> 4024943Seric # endif VMUNIX 4124943Seric # endif DAEMON 4210679Seric 4324943Seric 4416907Seric # define PSBUFSIZE (MAXNAME + MAXATOM) /* size of prescan buffer */ 4516907Seric 4616907Seric 4710679Seric /* 4810679Seric ** Data structure for bit maps. 4910679Seric ** 5010679Seric ** Each bit in this map can be referenced by an ascii character. 5110679Seric ** This is 128 possible bits, or 12 8-bit bytes. 5210679Seric */ 5310679Seric 5410679Seric #define BITMAPBYTES 16 /* number of bytes in a bit map */ 5510679Seric #define BYTEBITS 8 /* number of bits in a byte */ 5610679Seric 5710679Seric /* internal macros */ 5810679Seric #define _BITWORD(bit) (bit / (BYTEBITS * sizeof (int))) 5910679Seric #define _BITBIT(bit) (1 << (bit % (BYTEBITS * sizeof (int)))) 6010679Seric 6110679Seric typedef int BITMAP[BITMAPBYTES / sizeof (int)]; 6210679Seric 6310679Seric /* test bit number N */ 6410679Seric #define bitnset(bit, map) ((map)[_BITWORD(bit)] & _BITBIT(bit)) 6510679Seric 6610679Seric /* set bit number N */ 6710679Seric #define setbitn(bit, map) (map)[_BITWORD(bit)] |= _BITBIT(bit) 6810679Seric 6910679Seric /* clear bit number N */ 7010679Seric #define clrbitn(bit, map) (map)[_BITWORD(bit)] &= ~_BITBIT(bit) 7110679Seric 7210679Seric /* clear an entire bit map */ 7311053Seric #define clrbitmap(map) bzero((char *) map, BITMAPBYTES) 747799Seric /* 753190Seric ** Address structure. 763190Seric ** Addresses are stored internally in this structure. 773190Seric */ 783190Seric 793190Seric struct address 803190Seric { 813190Seric char *q_paddr; /* the printname for the address */ 823190Seric char *q_user; /* user name */ 8340973Sbostic char *q_ruser; /* real user name, or NULL if q_user */ 843190Seric char *q_host; /* host name */ 854597Seric struct mailer *q_mailer; /* mailer to use */ 864149Seric u_short q_flags; /* status flags, see below */ 874213Seric short q_uid; /* user-id of receiver (if known) */ 884398Seric short q_gid; /* group-id of receiver (if known) */ 894079Seric char *q_home; /* home dir (local mailer only) */ 904995Seric char *q_fullname; /* full name if known */ 914995Seric struct address *q_next; /* chain */ 924995Seric struct address *q_alias; /* address this results from */ 935034Seric struct address *q_tchain; /* temporary use chain */ 944987Seric time_t q_timeout; /* timeout for this address */ 953190Seric }; 963190Seric 973190Seric typedef struct address ADDRESS; 983190Seric 993190Seric # define QDONTSEND 000001 /* don't send to this address */ 1004068Seric # define QBADADDR 000002 /* this address is verified bad */ 1014403Seric # define QGOODUID 000004 /* the q_uid q_gid fields are good */ 1024422Seric # define QPRIMARY 000010 /* set from argv */ 1034624Seric # define QQUEUEUP 000020 /* queue for later transmission */ 10447285Seric # define QSENT 000040 /* has been successfully delivered */ 10551316Seric # define QNOTREMOTE 000100 /* not an address for remote forwarding */ 1066902Seric /* 107295Seric ** Mailer definition structure. 108295Seric ** Every mailer known to the system is declared in this 109295Seric ** structure. It defines the pathname of the mailer, some 110295Seric ** flags associated with it, and the argument vector to 1111390Seric ** pass to it. The flags are defined in conf.c 112295Seric ** 1134171Seric ** The argument vector is expanded before actual use. All 1144171Seric ** words except the first are passed through the macro 1154171Seric ** processor. 116295Seric */ 117295Seric 118295Seric struct mailer 119295Seric { 1203190Seric char *m_name; /* symbolic name of this mailer */ 121295Seric char *m_mailer; /* pathname of the mailer to use */ 12210679Seric BITMAP m_flags; /* status flags, see below */ 1234438Seric short m_mno; /* mailer number internally */ 1243049Seric char **m_argv; /* template argument vector */ 1258061Seric short m_s_rwset; /* rewriting set for sender addresses */ 1268061Seric short m_r_rwset; /* rewriting set for recipient addresses */ 12710323Seric char *m_eol; /* end of line string */ 12810679Seric long m_maxsize; /* size limit on message to this mailer */ 129*52106Seric int m_linelimit; /* max # characters per line */ 130295Seric }; 131295Seric 1324100Seric typedef struct mailer MAILER; 1334100Seric 1345601Seric /* bits for m_flags */ 13516871Seric # define M_CANONICAL 'C' /* make addresses canonical "u@dom" */ 13616871Seric # define M_EXPENSIVE 'e' /* it costs to use this mailer.... */ 13716871Seric # define M_ESCFROM 'E' /* escape From lines to >From */ 13810679Seric # define M_FOPT 'f' /* mailer takes picky -f flag */ 13916871Seric # define M_HST_UPPER 'h' /* preserve host case distinction */ 14016871Seric # define M_INTERNAL 'I' /* SMTP to another sendmail site */ 14116871Seric # define M_LOCAL 'l' /* delivery is to this host */ 14216871Seric # define M_LIMITS 'L' /* must enforce SMTP line limits */ 14316871Seric # define M_MUSER 'm' /* can handle multiple users at once */ 14416871Seric # define M_NHDR 'n' /* don't insert From line */ 14516871Seric # define M_FROMPATH 'p' /* use reverse-path in MAIL FROM: */ 14610679Seric # define M_ROPT 'r' /* mailer takes picky -r flag */ 14717466Seric # define M_SECURE_PORT 'R' /* try to send on a reserved TCP port */ 14816871Seric # define M_STRIPQ 's' /* strip quote chars from user/host */ 14910679Seric # define M_RESTR 'S' /* must be daemon to execute */ 15010679Seric # define M_USR_UPPER 'u' /* preserve user case distinction */ 15110679Seric # define M_UGLYUUCP 'U' /* this wants an ugly UUCP from line */ 15210679Seric # define M_XDOT 'X' /* use hidden-dot algorithm */ 153*52106Seric # define M_7BITS '7' /* use 7-bit path */ 154*52106Seric # define M_8BITS '8' /* use 8-bit path */ 155295Seric 1564597Seric EXTERN MAILER *Mailer[MAXMAILERS+1]; 157295Seric 1584597Seric EXTERN MAILER *LocalMailer; /* ptr to local mailer */ 1594597Seric EXTERN MAILER *ProgMailer; /* ptr to program mailer */ 1606902Seric /* 1612899Seric ** Header structure. 1622899Seric ** This structure is used internally to store header items. 1632899Seric */ 164295Seric 1652899Seric struct header 1662899Seric { 1672899Seric char *h_field; /* the name of the field */ 1682899Seric char *h_value; /* the value of that field */ 1692899Seric struct header *h_link; /* the next header */ 1704149Seric u_short h_flags; /* status bits, see below */ 17110679Seric BITMAP h_mflags; /* m_flags bits needed */ 1722899Seric }; 173295Seric 1742899Seric typedef struct header HDR; 1752899Seric 176295Seric /* 1772899Seric ** Header information structure. 1782899Seric ** Defined in conf.c, this struct declares the header fields 1792899Seric ** that have some magic meaning. 1802899Seric */ 1812899Seric 1822899Seric struct hdrinfo 1832899Seric { 1842899Seric char *hi_field; /* the name of the field */ 1854149Seric u_short hi_flags; /* status bits, see below */ 1862899Seric }; 1872899Seric 1882899Seric extern struct hdrinfo HdrInfo[]; 1892899Seric 1902899Seric /* bits for h_flags and hi_flags */ 1913060Seric # define H_EOH 00001 /* this field terminates header */ 1925918Seric # define H_RCPT 00002 /* contains recipient addresses */ 1932899Seric # define H_DEFAULT 00004 /* if another value is found, drop this */ 19411416Seric # define H_RESENT 00010 /* this address is a "Resent-..." address */ 1953386Seric # define H_CHECK 00020 /* check h_mflags against m_flags */ 1963390Seric # define H_ACHECK 00040 /* ditto, but always (not just default) */ 1974149Seric # define H_FORCE 00100 /* force this field, even if default */ 1988061Seric # define H_TRACE 00200 /* this field contains trace information */ 1997761Seric # define H_FROM 00400 /* this is a from-type field */ 20024945Seric # define H_VALID 01000 /* this field has a validated value */ 2016902Seric /* 2026902Seric ** Envelope structure. 2036902Seric ** This structure defines the message itself. There is usually 2046902Seric ** only one of these -- for the message that we originally read 2056902Seric ** and which is our primary interest -- but other envelopes can 2066902Seric ** be generated during processing. For example, error messages 2076902Seric ** will have their own envelope. 2086902Seric */ 2092899Seric 2106902Seric struct envelope 2116902Seric { 2126987Seric HDR *e_header; /* head of header list */ 2136987Seric long e_msgpriority; /* adjusted priority of this message */ 2147859Seric time_t e_ctime; /* time message appeared in the queue */ 2156987Seric char *e_to; /* the target person */ 2168061Seric char *e_receiptto; /* return receipt address */ 2176987Seric ADDRESS e_from; /* the person it is from */ 21851951Seric char *e_sender; /* string version of from person */ 21951951Seric char *e_returnpath; /* string version of return path */ 2208180Seric char **e_fromdomain; /* the domain part of the sender */ 2216987Seric ADDRESS *e_sendqueue; /* list of message recipients */ 2227044Seric ADDRESS *e_errorqueue; /* the queue for error responses */ 2236987Seric long e_msgsize; /* size of the message in bytes */ 22424943Seric int e_nrcpts; /* number of recipients */ 2256987Seric short e_class; /* msg class (priority, junk, etc.) */ 2269336Seric short e_flags; /* flags, see below */ 2279373Seric short e_hopcount; /* number of times processed */ 2286987Seric int (*e_puthdr)(); /* function to put header of message */ 2296987Seric int (*e_putbody)(); /* function to put body of message */ 2306987Seric struct envelope *e_parent; /* the message this one encloses */ 2319336Seric struct envelope *e_sibling; /* the next envelope of interest */ 2326987Seric char *e_df; /* location of temp file */ 2339541Seric FILE *e_dfp; /* temporary file */ 2347810Seric char *e_id; /* code for this entry in queue */ 2359541Seric FILE *e_xfp; /* transcript file */ 23651920Seric FILE *e_lockfp; /* the lock file for this message */ 23710102Seric char *e_message; /* error message */ 2386987Seric char *e_macro[128]; /* macro definitions */ 2396902Seric }; 2402899Seric 2416902Seric typedef struct envelope ENVELOPE; 2424624Seric 2439336Seric /* values for e_flags */ 2449336Seric #define EF_OLDSTYLE 000001 /* use spaces (not commas) in hdrs */ 2459336Seric #define EF_INQUEUE 000002 /* this message is fully queued */ 2469336Seric #define EF_TIMEOUT 000004 /* this message is too old */ 2479336Seric #define EF_CLRQUEUE 000010 /* disk copy is no longer needed */ 2489336Seric #define EF_SENDRECEIPT 000020 /* send a return receipt */ 2499336Seric #define EF_FATALERRS 000040 /* fatal errors occured */ 2509336Seric #define EF_KEEPQUEUE 000100 /* keep queue files always */ 2519373Seric #define EF_RESPONSE 000200 /* this is an error or return receipt */ 25211416Seric #define EF_RESENT 000400 /* this message is being forwarded */ 2539336Seric 2546902Seric EXTERN ENVELOPE *CurEnv; /* envelope currently being processed */ 2556902Seric /* 25624980Seric ** Message priority classes. 2575034Seric ** 25824980Seric ** The message class is read directly from the Priority: header 25924980Seric ** field in the message. 2606910Seric ** 26124980Seric ** CurEnv->e_msgpriority is the number of bytes in the message plus 26224980Seric ** the creation time (so that jobs ``tend'' to be ordered correctly), 26324980Seric ** adjusted by the message class, the number of recipients, and the 26424980Seric ** amount of time the message has been sitting around. This number 26524980Seric ** is used to order the queue. Higher values mean LOWER priority. 26612516Seric ** 26724980Seric ** Each priority class point is worth WkClassFact priority points; 26824980Seric ** each recipient is worth WkRecipFact priority points. Each time 26924980Seric ** we reprocess a message the priority is adjusted by WkTimeFact. 27024980Seric ** WkTimeFact should normally decrease the priority so that jobs 27124980Seric ** that have historically failed will be run later; thanks go to 27224980Seric ** Jay Lepreau at Utah for pointing out the error in my thinking. 27324980Seric ** 2746910Seric ** The "class" is this number, unadjusted by the age or size of 2756910Seric ** this message. Classes with negative representations will have 2766910Seric ** error messages thrown away if they are not local. 2774624Seric */ 2784624Seric 2798249Seric struct priority 2808249Seric { 2818249Seric char *pri_name; /* external name of priority */ 2828249Seric int pri_val; /* internal value for same */ 2838249Seric }; 2844624Seric 2858249Seric EXTERN struct priority Priorities[MAXPRIORITIES]; 2868249Seric EXTERN int NumPriorities; /* pointer into Priorities */ 2876902Seric /* 2883153Seric ** Rewrite rules. 2893153Seric */ 2902899Seric 2913153Seric struct rewrite 2923153Seric { 2933153Seric char **r_lhs; /* pattern match */ 2943153Seric char **r_rhs; /* substitution value */ 2953153Seric struct rewrite *r_next;/* next in chain */ 2963153Seric }; 2972899Seric 2988057Seric EXTERN struct rewrite *RewriteRules[MAXRWSETS]; 2993153Seric 3008057Seric /* 3018057Seric ** Special characters in rewriting rules. 3028057Seric ** These are used internally only. 3038057Seric ** The COND* rules are actually used in macros rather than in 3048057Seric ** rewriting rules, but are given here because they 3058057Seric ** cannot conflict. 3068057Seric */ 3073153Seric 3088057Seric /* left hand side items */ 3098057Seric # define MATCHZANY '\020' /* match zero or more tokens */ 3108057Seric # define MATCHANY '\021' /* match one or more tokens */ 3118057Seric # define MATCHONE '\022' /* match exactly one token */ 3128057Seric # define MATCHCLASS '\023' /* match one token in a class */ 31316908Seric # define MATCHNCLASS '\024' /* match anything not in class */ 31416908Seric # define MATCHREPL '\025' /* replacement on RHS for above */ 3158057Seric 3168057Seric /* right hand side items */ 31716908Seric # define CANONNET '\026' /* canonical net, next token */ 31816908Seric # define CANONHOST '\027' /* canonical host, next token */ 31916908Seric # define CANONUSER '\030' /* canonical user, next N tokens */ 32016908Seric # define CALLSUBR '\031' /* call another rewriting set */ 3213153Seric 3228057Seric /* conditionals in macros */ 32316908Seric # define CONDIF '\032' /* conditional if-then */ 32416908Seric # define CONDELSE '\033' /* conditional else */ 32516908Seric # define CONDFI '\034' /* conditional fi */ 32616151Seric 32716905Seric /* bracket characters for host name lookup */ 32816908Seric # define HOSTBEGIN '\035' /* hostname lookup begin */ 32916908Seric # define HOSTEND '\036' /* hostname lookup end */ 33016905Seric 33116151Seric /* \001 is also reserved as the macro expansion character */ 33251782Seric 33351782Seric /* external <==> internal mapping table */ 33451782Seric struct metamac 33551782Seric { 33651782Seric char metaname; /* external code (after $) */ 33751782Seric char metaval; /* internal code (as above) */ 33851782Seric }; 3396902Seric /* 34024943Seric ** Information about hosts that we have looked up recently. 34124943Seric ** 34224943Seric ** This stuff is 4.2/3bsd specific. 34324943Seric */ 34424943Seric 34524943Seric # ifdef DAEMON 34624943Seric # ifdef VMUNIX 34724943Seric 34824943Seric # define HOSTINFO struct hostinfo 34924943Seric 35024943Seric HOSTINFO 35124943Seric { 35224943Seric char *ho_name; /* name of this host */ 35324943Seric struct in_addr ho_inaddr; /* internet address */ 35424943Seric short ho_flags; /* flag bits, see below */ 35524943Seric short ho_errno; /* error number on last connection */ 35624943Seric short ho_exitstat; /* exit status from last connection */ 35724943Seric }; 35824943Seric 35924943Seric 36024943Seric /* flag bits */ 36124943Seric #define HOF_VALID 00001 /* this entry is valid */ 36224943Seric 36324943Seric # endif VMUNIX 36424943Seric # endif DAEMON 36524943Seric /* 3664056Seric ** Symbol table definitions 3674056Seric */ 3683153Seric 3694056Seric struct symtab 3704056Seric { 3714056Seric char *s_name; /* name to be entered */ 3724100Seric char s_type; /* general type (see below) */ 3734056Seric struct symtab *s_next; /* pointer to next in chain */ 3744100Seric union 3754100Seric { 37624943Seric BITMAP sv_class; /* bit-map of word classes */ 37724943Seric ADDRESS *sv_addr; /* pointer to address header */ 37824943Seric MAILER *sv_mailer; /* pointer to mailer */ 37924943Seric char *sv_alias; /* alias */ 38024943Seric # ifdef HOSTINFO 38124943Seric HOSTINFO sv_host; /* host information */ 38224943Seric # endif HOSTINFO 3834100Seric } s_value; 3844056Seric }; 3854056Seric 3864056Seric typedef struct symtab STAB; 3874056Seric 3884100Seric /* symbol types */ 3894100Seric # define ST_UNDEF 0 /* undefined type */ 3904100Seric # define ST_CLASS 1 /* class map */ 3914100Seric # define ST_ADDRESS 2 /* an address in parsed format */ 3924100Seric # define ST_MAILER 3 /* a mailer header */ 3934100Seric # define ST_ALIAS 4 /* an alias */ 39424943Seric # define ST_HOST 5 /* host information */ 3954100Seric 3964100Seric # define s_class s_value.sv_class 3975976Seric # define s_address s_value.sv_addr 3984100Seric # define s_mailer s_value.sv_mailer 3994100Seric # define s_alias s_value.sv_alias 40050537Seric # undef s_host 40124943Seric # define s_host s_value.sv_host 4024100Seric 4034056Seric extern STAB *stab(); 4044056Seric 4054056Seric /* opcodes to stab */ 4064056Seric # define ST_FIND 0 /* find entry */ 4074056Seric # define ST_ENTER 1 /* enter if not there */ 4086902Seric /* 4097684Seric ** STRUCT EVENT -- event queue. 4107684Seric ** 4117684Seric ** Maintained in sorted order. 4127931Seric ** 4137931Seric ** We store the pid of the process that set this event to insure 4147931Seric ** that when we fork we will not take events intended for the parent. 4157684Seric */ 4167684Seric 4177684Seric struct event 4187684Seric { 4197684Seric time_t ev_time; /* time of the function call */ 4207684Seric int (*ev_func)(); /* function to call */ 4217684Seric int ev_arg; /* argument to ev_func */ 4227931Seric int ev_pid; /* pid that set this event */ 4237684Seric struct event *ev_link; /* link to next item */ 4247684Seric }; 4257684Seric 4267684Seric typedef struct event EVENT; 4277684Seric 4287684Seric EXTERN EVENT *EventQueue; /* head of event queue */ 4297684Seric /* 4309373Seric ** Operation, send, and error modes 4319278Seric ** 4329278Seric ** The operation mode describes the basic operation of sendmail. 4339278Seric ** This can be set from the command line, and is "send mail" by 4349278Seric ** default. 4359278Seric ** 4369278Seric ** The send mode tells how to send mail. It can be set in the 4379278Seric ** configuration file. It's setting determines how quickly the 4389278Seric ** mail will be delivered versus the load on your system. If the 4399278Seric ** -v (verbose) flag is given, it will be forced to SM_DELIVER 4409278Seric ** mode. 4419278Seric ** 4429373Seric ** The error mode tells how to return errors. 4436997Seric */ 4446997Seric 4459278Seric EXTERN char OpMode; /* operation mode, see below */ 4466997Seric 4479278Seric #define MD_DELIVER 'm' /* be a mail sender */ 4489278Seric #define MD_ARPAFTP 'a' /* old-style arpanet protocols */ 4499278Seric #define MD_SMTP 's' /* run SMTP on standard input */ 4506997Seric #define MD_DAEMON 'd' /* run as a daemon */ 4516997Seric #define MD_VERIFY 'v' /* verify: don't collect or deliver */ 4528334Seric #define MD_TEST 't' /* test mode: resolve addrs only */ 4539144Seric #define MD_INITALIAS 'i' /* initialize alias database */ 4549144Seric #define MD_PRINT 'p' /* print the queue */ 4559144Seric #define MD_FREEZE 'z' /* freeze the configuration file */ 4566997Seric 4579278Seric 4589278Seric EXTERN char SendMode; /* send mode, see below */ 4599278Seric 4609278Seric #define SM_DELIVER 'i' /* interactive delivery */ 4619278Seric #define SM_QUICKD 'j' /* deliver w/o queueing */ 4629278Seric #define SM_FORK 'b' /* deliver in background */ 4639278Seric #define SM_QUEUE 'q' /* queue, don't deliver */ 4649278Seric #define SM_VERIFY 'v' /* verify only (used internally) */ 4659373Seric 46614871Seric /* used only as a parameter to sendall */ 46714871Seric #define SM_DEFAULT '\0' /* unspecified, use SendMode */ 4689373Seric 46914871Seric 4709373Seric EXTERN char ErrorMode; /* error mode, see below */ 4719373Seric 4729373Seric #define EM_PRINT 'p' /* print errors */ 4739373Seric #define EM_MAIL 'm' /* mail back errors */ 4749373Seric #define EM_WRITE 'w' /* write back errors */ 4759373Seric #define EM_BERKNET 'e' /* special berknet processing */ 4769373Seric #define EM_QUIET 'q' /* don't print messages (stat only) */ 47725525Smiriam 47825525Smiriam /* offset used to issure that the error messages for name server error 47925525Smiriam * codes are unique. 48025525Smiriam */ 48125525Smiriam #define MAX_ERRNO 100 4826997Seric /* 483295Seric ** Global variables. 484295Seric */ 485295Seric 4864371Seric EXTERN bool FromFlag; /* if set, "From" person is explicit */ 4874371Seric EXTERN bool NoAlias; /* if set, don't do any aliasing */ 4884371Seric EXTERN bool ForceMail; /* if set, mail even if already got a copy */ 4894371Seric EXTERN bool MeToo; /* send to the sender also */ 4904371Seric EXTERN bool IgnrDot; /* don't let dot end messages */ 4914371Seric EXTERN bool SaveFrom; /* save leading "From" lines */ 4924371Seric EXTERN bool Verbose; /* set if blow-by-blow desired */ 4934371Seric EXTERN bool GrabTo; /* if set, get recipients from msg */ 4944371Seric EXTERN bool NoReturn; /* don't return letter to sender */ 4954553Seric EXTERN bool SuprErrs; /* set if we are suppressing errors */ 4966049Seric EXTERN bool QueueRun; /* currently running message from the queue */ 4974711Seric EXTERN bool HoldErrs; /* only output errors to transcript */ 4985904Seric EXTERN bool NoConnect; /* don't connect to non-local mailers */ 4998268Seric EXTERN bool SuperSafe; /* be extra careful, even if expensive */ 50024943Seric EXTERN bool ForkQueueRuns; /* fork for each job when running the queue */ 5019144Seric EXTERN bool AutoRebuild; /* auto-rebuild the alias database as needed */ 50225818Seric EXTERN bool CheckAliases; /* parse addresses during newaliases */ 50335651Seric EXTERN bool UseNameServer; /* use internet domain name server */ 504*52106Seric EXTERN bool EightBit; /* try to preserve 8-bit data */ 50517465Seric EXTERN int SafeAlias; /* minutes to wait until @:@ in alias file */ 5068268Seric EXTERN time_t TimeOut; /* time until timeout */ 5074553Seric EXTERN FILE *InChannel; /* input connection */ 5084553Seric EXTERN FILE *OutChannel; /* output connection */ 5094537Seric EXTERN int RealUid; /* when Daemon, real uid of caller */ 5104537Seric EXTERN int RealGid; /* when Daemon, real gid of caller */ 5118268Seric EXTERN int DefUid; /* default uid to run as */ 51240973Sbostic EXTERN char *DefUser; /* default user to run as (from DefUid) */ 5138268Seric EXTERN int DefGid; /* default gid to run as */ 5144371Seric EXTERN int OldUmask; /* umask when sendmail starts up */ 5156049Seric EXTERN int Errors; /* set if errors (local to single pass) */ 5164371Seric EXTERN int ExitStat; /* exit status code */ 5174553Seric EXTERN int AliasLevel; /* depth of aliasing */ 5187282Seric EXTERN int MotherPid; /* proc id of parent process */ 5198057Seric EXTERN int LineNumber; /* line number in current input */ 52016139Seric EXTERN time_t ReadTimeout; /* timeout on reads */ 5218268Seric EXTERN int LogLevel; /* level of logging to perform */ 5229045Seric EXTERN int FileMode; /* mode on files */ 52324943Seric EXTERN int QueueLA; /* load average starting forced queueing */ 52424943Seric EXTERN int RefuseLA; /* load average refusing connections are */ 52551920Seric EXTERN int CurrentLA; /* current load average */ 52624943Seric EXTERN int QueueFactor; /* slope of queue function */ 5274624Seric EXTERN time_t QueueIntvl; /* intervals between running the queue */ 5288268Seric EXTERN char *AliasFile; /* location of alias file */ 5298268Seric EXTERN char *HelpFile; /* location of SMTP help file */ 5308268Seric EXTERN char *StatFile; /* location of statistics summary */ 5318268Seric EXTERN char *QueueDir; /* location of queue directory */ 5329373Seric EXTERN char *FileName; /* name to print on error messages */ 53324943Seric EXTERN char *SmtpPhase; /* current phase in SMTP processing */ 53425050Seric EXTERN char *MyHostName; /* name of this host for SMTP messages */ 53524943Seric EXTERN char *RealHostName; /* name of host we are talking to */ 53636230Skarels EXTERN struct sockaddr_in RealHostAddr;/* address of host we are talking to */ 53725050Seric EXTERN char *CurHostName; /* current host we are dealing with */ 5388268Seric EXTERN jmp_buf TopFrame; /* branch-to-top-of-loop-on-error frame */ 5398268Seric EXTERN bool QuickAbort; /* .... but only if we want a quick abort */ 54051951Seric EXTERN bool LogUsrErrs; /* syslog user errors (e.g., SMTP RCPT cmd) */ 5417859Seric extern char *ConfFile; /* location of configuration file [conf.c] */ 5429065Seric extern char *FreezeFile; /* location of frozen memory image [conf.c] */ 5437859Seric extern char Arpa_Info[]; /* the reply code for Arpanet info [conf.c] */ 54424943Seric extern ADDRESS NullAddress; /* a null (template) address [main.c] */ 54524943Seric EXTERN char SpaceSub; /* substitution for <lwsp> */ 54624980Seric EXTERN int WkClassFact; /* multiplier for message class -> priority */ 54724980Seric EXTERN int WkRecipFact; /* multiplier for # of recipients -> priority */ 54824980Seric EXTERN int WkTimeFact; /* priority offset each time this job is run */ 54951305Seric EXTERN int Nmx; /* number of MX RRs */ 55024943Seric EXTERN char *PostMasterCopy; /* address to get errs cc's */ 55129865Seric EXTERN char *MxHosts[MAXMXHOSTS+1]; /* for MX RRs */ 55224943Seric EXTERN char *TrustedUsers[MAXTRUST+1]; /* list of trusted users */ 55325026Seric EXTERN char *UserEnviron[MAXUSERENVIRON+1]; /* saved user environment */ 55447285Seric EXTERN int CheckpointInterval; /* queue file checkpoint interval */ 55551216Seric EXTERN bool NoWildcardMX; /* we don't have wildcard MX records */ 55651360Seric EXTERN char *UdbSpec; /* user database source spec [udbexpand.c] */ 55751305Seric EXTERN int MaxHopCount; /* number of hops until we give an error */ 55851316Seric EXTERN int ConfigLevel; /* config file level -- what does .cf expect? */ 559*52106Seric EXTERN char *TimeZoneSpec; /* override time zone specification */ 5607674Seric /* 5617674Seric ** Trace information 5627674Seric */ 563295Seric 5647674Seric /* trace vector and macros for debugging flags */ 5657674Seric EXTERN u_char tTdvect[100]; 5667674Seric # define tTd(flag, level) (tTdvect[flag] >= level) 5677674Seric # define tTdlevel(flag) (tTdvect[flag]) 5687674Seric /* 5697674Seric ** Miscellaneous information. 5707674Seric */ 571295Seric 572295Seric 57310213Seric 57410213Seric /* 57510213Seric ** Some in-line functions 57610213Seric */ 57710213Seric 57810213Seric /* set exit status */ 57911426Seric #define setstat(s) { \ 58011426Seric if (ExitStat == EX_OK || ExitStat == EX_TEMPFAIL) \ 58111426Seric ExitStat = s; \ 58211426Seric } 5834085Seric 58410213Seric /* make a copy of a string */ 58511426Seric #define newstr(s) strcpy(xalloc(strlen(s) + 1), s) 5864085Seric 58724943Seric #define STRUCTCOPY(s, d) d = s 58810213Seric 58924943Seric 59010213Seric /* 59110213Seric ** Declarations of useful functions 59210213Seric */ 59310213Seric 5949883Seric extern ADDRESS *parseaddr(); 5954085Seric extern char *xalloc(); 5964085Seric extern bool sameaddr(); 5976889Seric extern FILE *dfopen(); 5987684Seric extern EVENT *setevent(); 5997684Seric extern char *sfgets(); 6007810Seric extern char *queuename(); 6017884Seric extern time_t curtime(); 602