1 /* 2 * Copyright (c) 1983 Eric P. Allman 3 * Copyright (c) 1988 Regents of the University of California. 4 * All rights reserved. 5 * 6 * %sccs.include.redist.c% 7 * 8 * @(#)sendmail.h 5.38 (Berkeley) 07/20/92 9 */ 10 11 /* 12 ** SENDMAIL.H -- Global definitions for sendmail. 13 */ 14 15 # ifdef _DEFINE 16 # define EXTERN 17 # ifndef lint 18 static char SmailSccsId[] = "@(#)sendmail.h 5.38 07/20/92"; 19 # endif lint 20 # else _DEFINE 21 # define EXTERN extern 22 # endif _DEFINE 23 24 # include <sys/types.h> 25 # include <stdio.h> 26 # include <ctype.h> 27 # include <setjmp.h> 28 # include <sysexits.h> 29 # include "conf.h" 30 # include "useful.h" 31 32 # ifdef LOG 33 # include <sys/syslog.h> 34 # endif LOG 35 36 # ifdef DAEMON 37 # include <sys/socket.h> 38 # include <netinet/in.h> 39 # endif DAEMON 40 41 42 # define PSBUFSIZE (MAXNAME + MAXATOM) /* size of prescan buffer */ 43 44 45 /* 46 ** Data structure for bit maps. 47 ** 48 ** Each bit in this map can be referenced by an ascii character. 49 ** This is 128 possible bits, or 12 8-bit bytes. 50 */ 51 52 #define BITMAPBYTES 16 /* number of bytes in a bit map */ 53 #define BYTEBITS 8 /* number of bits in a byte */ 54 55 /* internal macros */ 56 #define _BITWORD(bit) (bit / (BYTEBITS * sizeof (int))) 57 #define _BITBIT(bit) (1 << (bit % (BYTEBITS * sizeof (int)))) 58 59 typedef int BITMAP[BITMAPBYTES / sizeof (int)]; 60 61 /* test bit number N */ 62 #define bitnset(bit, map) ((map)[_BITWORD(bit)] & _BITBIT(bit)) 63 64 /* set bit number N */ 65 #define setbitn(bit, map) (map)[_BITWORD(bit)] |= _BITBIT(bit) 66 67 /* clear bit number N */ 68 #define clrbitn(bit, map) (map)[_BITWORD(bit)] &= ~_BITBIT(bit) 69 70 /* clear an entire bit map */ 71 #define clrbitmap(map) bzero((char *) map, BITMAPBYTES) 72 /* 73 ** Address structure. 74 ** Addresses are stored internally in this structure. 75 */ 76 77 struct address 78 { 79 char *q_paddr; /* the printname for the address */ 80 char *q_user; /* user name */ 81 char *q_ruser; /* real user name, or NULL if q_user */ 82 char *q_host; /* host name */ 83 struct mailer *q_mailer; /* mailer to use */ 84 u_short q_flags; /* status flags, see below */ 85 uid_t q_uid; /* user-id of receiver (if known) */ 86 gid_t q_gid; /* group-id of receiver (if known) */ 87 char *q_home; /* home dir (local mailer only) */ 88 char *q_fullname; /* full name if known */ 89 struct address *q_next; /* chain */ 90 struct address *q_alias; /* address this results from */ 91 struct address *q_tchain; /* temporary use chain */ 92 time_t q_timeout; /* timeout for this address */ 93 }; 94 95 typedef struct address ADDRESS; 96 97 # define QDONTSEND 000001 /* don't send to this address */ 98 # define QBADADDR 000002 /* this address is verified bad */ 99 # define QGOODUID 000004 /* the q_uid q_gid fields are good */ 100 # define QPRIMARY 000010 /* set from argv */ 101 # define QQUEUEUP 000020 /* queue for later transmission */ 102 # define QSENT 000040 /* has been successfully delivered */ 103 # define QNOTREMOTE 000100 /* not an address for remote forwarding */ 104 /* 105 ** Mailer definition structure. 106 ** Every mailer known to the system is declared in this 107 ** structure. It defines the pathname of the mailer, some 108 ** flags associated with it, and the argument vector to 109 ** pass to it. The flags are defined in conf.c 110 ** 111 ** The argument vector is expanded before actual use. All 112 ** words except the first are passed through the macro 113 ** processor. 114 */ 115 116 struct mailer 117 { 118 char *m_name; /* symbolic name of this mailer */ 119 char *m_mailer; /* pathname of the mailer to use */ 120 BITMAP m_flags; /* status flags, see below */ 121 short m_mno; /* mailer number internally */ 122 char **m_argv; /* template argument vector */ 123 short m_s_rwset; /* rewriting set for sender addresses */ 124 short m_r_rwset; /* rewriting set for recipient addresses */ 125 char *m_eol; /* end of line string */ 126 long m_maxsize; /* size limit on message to this mailer */ 127 int m_linelimit; /* max # characters per line */ 128 }; 129 130 typedef struct mailer MAILER; 131 132 /* bits for m_flags */ 133 # define M_CANONICAL 'C' /* make addresses canonical "u@dom" */ 134 # define M_EXPENSIVE 'e' /* it costs to use this mailer.... */ 135 # define M_ESCFROM 'E' /* escape From lines to >From */ 136 # define M_FOPT 'f' /* mailer takes picky -f flag */ 137 # define M_HST_UPPER 'h' /* preserve host case distinction */ 138 # define M_INTERNAL 'I' /* SMTP to another sendmail site */ 139 # define M_LOCAL 'l' /* delivery is to this host */ 140 # define M_LIMITS 'L' /* must enforce SMTP line limits */ 141 # define M_MUSER 'm' /* can handle multiple users at once */ 142 # define M_NHDR 'n' /* don't insert From line */ 143 # define M_FROMPATH 'p' /* use reverse-path in MAIL FROM: */ 144 # define M_ROPT 'r' /* mailer takes picky -r flag */ 145 # define M_SECURE_PORT 'R' /* try to send on a reserved TCP port */ 146 # define M_STRIPQ 's' /* strip quote chars from user/host */ 147 # define M_RESTR 'S' /* must be daemon to execute */ 148 # define M_USR_UPPER 'u' /* preserve user case distinction */ 149 # define M_UGLYUUCP 'U' /* this wants an ugly UUCP from line */ 150 # define M_XDOT 'X' /* use hidden-dot algorithm */ 151 # define M_7BITS '7' /* use 7-bit path */ 152 153 EXTERN MAILER *Mailer[MAXMAILERS+1]; 154 155 EXTERN MAILER *LocalMailer; /* ptr to local mailer */ 156 EXTERN MAILER *ProgMailer; /* ptr to program mailer */ 157 /* 158 ** Header structure. 159 ** This structure is used internally to store header items. 160 */ 161 162 struct header 163 { 164 char *h_field; /* the name of the field */ 165 char *h_value; /* the value of that field */ 166 struct header *h_link; /* the next header */ 167 u_short h_flags; /* status bits, see below */ 168 BITMAP h_mflags; /* m_flags bits needed */ 169 }; 170 171 typedef struct header HDR; 172 173 /* 174 ** Header information structure. 175 ** Defined in conf.c, this struct declares the header fields 176 ** that have some magic meaning. 177 */ 178 179 struct hdrinfo 180 { 181 char *hi_field; /* the name of the field */ 182 u_short hi_flags; /* status bits, see below */ 183 }; 184 185 extern struct hdrinfo HdrInfo[]; 186 187 /* bits for h_flags and hi_flags */ 188 # define H_EOH 00001 /* this field terminates header */ 189 # define H_RCPT 00002 /* contains recipient addresses */ 190 # define H_DEFAULT 00004 /* if another value is found, drop this */ 191 # define H_RESENT 00010 /* this address is a "Resent-..." address */ 192 # define H_CHECK 00020 /* check h_mflags against m_flags */ 193 # define H_ACHECK 00040 /* ditto, but always (not just default) */ 194 # define H_FORCE 00100 /* force this field, even if default */ 195 # define H_TRACE 00200 /* this field contains trace information */ 196 # define H_FROM 00400 /* this is a from-type field */ 197 # define H_VALID 01000 /* this field has a validated value */ 198 /* 199 ** Envelope structure. 200 ** This structure defines the message itself. There is usually 201 ** only one of these -- for the message that we originally read 202 ** and which is our primary interest -- but other envelopes can 203 ** be generated during processing. For example, error messages 204 ** will have their own envelope. 205 */ 206 207 struct envelope 208 { 209 HDR *e_header; /* head of header list */ 210 long e_msgpriority; /* adjusted priority of this message */ 211 time_t e_ctime; /* time message appeared in the queue */ 212 char *e_to; /* the target person */ 213 char *e_receiptto; /* return receipt address */ 214 ADDRESS e_from; /* the person it is from */ 215 char *e_sender; /* string version of from person */ 216 char *e_returnpath; /* string version of return path */ 217 char **e_fromdomain; /* the domain part of the sender */ 218 ADDRESS *e_sendqueue; /* list of message recipients */ 219 ADDRESS *e_errorqueue; /* the queue for error responses */ 220 long e_msgsize; /* size of the message in bytes */ 221 int e_nrcpts; /* number of recipients */ 222 short e_class; /* msg class (priority, junk, etc.) */ 223 short e_flags; /* flags, see below */ 224 short e_hopcount; /* number of times processed */ 225 int (*e_puthdr)(); /* function to put header of message */ 226 int (*e_putbody)(); /* function to put body of message */ 227 struct envelope *e_parent; /* the message this one encloses */ 228 struct envelope *e_sibling; /* the next envelope of interest */ 229 char *e_df; /* location of temp file */ 230 FILE *e_dfp; /* temporary file */ 231 char *e_id; /* code for this entry in queue */ 232 FILE *e_xfp; /* transcript file */ 233 FILE *e_lockfp; /* the lock file for this message */ 234 char *e_message; /* error message */ 235 char *e_macro[128]; /* macro definitions */ 236 }; 237 238 typedef struct envelope ENVELOPE; 239 240 /* values for e_flags */ 241 #define EF_OLDSTYLE 000001 /* use spaces (not commas) in hdrs */ 242 #define EF_INQUEUE 000002 /* this message is fully queued */ 243 #define EF_TIMEOUT 000004 /* this message is too old */ 244 #define EF_CLRQUEUE 000010 /* disk copy is no longer needed */ 245 #define EF_SENDRECEIPT 000020 /* send a return receipt */ 246 #define EF_FATALERRS 000040 /* fatal errors occured */ 247 #define EF_KEEPQUEUE 000100 /* keep queue files always */ 248 #define EF_RESPONSE 000200 /* this is an error or return receipt */ 249 #define EF_RESENT 000400 /* this message is being forwarded */ 250 251 EXTERN ENVELOPE *CurEnv; /* envelope currently being processed */ 252 /* 253 ** Message priority classes. 254 ** 255 ** The message class is read directly from the Priority: header 256 ** field in the message. 257 ** 258 ** CurEnv->e_msgpriority is the number of bytes in the message plus 259 ** the creation time (so that jobs ``tend'' to be ordered correctly), 260 ** adjusted by the message class, the number of recipients, and the 261 ** amount of time the message has been sitting around. This number 262 ** is used to order the queue. Higher values mean LOWER priority. 263 ** 264 ** Each priority class point is worth WkClassFact priority points; 265 ** each recipient is worth WkRecipFact priority points. Each time 266 ** we reprocess a message the priority is adjusted by WkTimeFact. 267 ** WkTimeFact should normally decrease the priority so that jobs 268 ** that have historically failed will be run later; thanks go to 269 ** Jay Lepreau at Utah for pointing out the error in my thinking. 270 ** 271 ** The "class" is this number, unadjusted by the age or size of 272 ** this message. Classes with negative representations will have 273 ** error messages thrown away if they are not local. 274 */ 275 276 struct priority 277 { 278 char *pri_name; /* external name of priority */ 279 int pri_val; /* internal value for same */ 280 }; 281 282 EXTERN struct priority Priorities[MAXPRIORITIES]; 283 EXTERN int NumPriorities; /* pointer into Priorities */ 284 /* 285 ** Rewrite rules. 286 */ 287 288 struct rewrite 289 { 290 char **r_lhs; /* pattern match */ 291 char **r_rhs; /* substitution value */ 292 struct rewrite *r_next;/* next in chain */ 293 }; 294 295 EXTERN struct rewrite *RewriteRules[MAXRWSETS]; 296 297 /* 298 ** Special characters in rewriting rules. 299 ** These are used internally only. 300 ** The COND* rules are actually used in macros rather than in 301 ** rewriting rules, but are given here because they 302 ** cannot conflict. 303 */ 304 305 /* left hand side items */ 306 # define MATCHZANY '\020' /* match zero or more tokens */ 307 # define MATCHANY '\021' /* match one or more tokens */ 308 # define MATCHONE '\022' /* match exactly one token */ 309 # define MATCHCLASS '\023' /* match one token in a class */ 310 # define MATCHNCLASS '\024' /* match anything not in class */ 311 # define MATCHREPL '\025' /* replacement on RHS for above */ 312 313 /* right hand side items */ 314 # define CANONNET '\026' /* canonical net, next token */ 315 # define CANONHOST '\027' /* canonical host, next token */ 316 # define CANONUSER '\030' /* canonical user, next N tokens */ 317 # define CALLSUBR '\031' /* call another rewriting set */ 318 319 /* conditionals in macros */ 320 # define CONDIF '\032' /* conditional if-then */ 321 # define CONDELSE '\033' /* conditional else */ 322 # define CONDFI '\034' /* conditional fi */ 323 324 /* bracket characters for host name lookup */ 325 # define HOSTBEGIN '\035' /* hostname lookup begin */ 326 # define HOSTEND '\036' /* hostname lookup end */ 327 328 /* bracket characters for generalized lookup */ 329 # define LOOKUPBEGIN '\005' /* generalized lookup begin */ 330 # define LOOKUPEND '\006' /* generalized lookup end */ 331 332 /* \001 is also reserved as the macro expansion character */ 333 334 /* external <==> internal mapping table */ 335 struct metamac 336 { 337 char metaname; /* external code (after $) */ 338 char metaval; /* internal code (as above) */ 339 }; 340 /* 341 ** Information about currently open connections to mailers, or to 342 ** hosts that we have looked up recently. 343 */ 344 345 # define MCI struct mailer_con_info 346 347 MCI 348 { 349 short mci_flags; /* flag bits, see below */ 350 short mci_errno; /* error number on last connection */ 351 short mci_exitstat; /* exit status from last connection */ 352 short mci_state; /* SMTP state */ 353 FILE *mci_in; /* input side of connection */ 354 FILE *mci_out; /* output side of connection */ 355 int mci_pid; /* process id of subordinate proc */ 356 char *mci_phase; /* SMTP phase string */ 357 struct mailer *mci_mailer; /* ptr to the mailer for this conn */ 358 char *mci_host; /* host name */ 359 time_t mci_lastuse; /* last usage time */ 360 }; 361 362 363 /* flag bits */ 364 #define MCIF_VALID 00001 /* this entry is valid */ 365 #define MCIF_TEMP 00002 /* don't cache this connection */ 366 #define MCIF_CACHED 00004 /* currently in open cache */ 367 368 /* states */ 369 #define MCIS_CLOSED 0 /* no traffic on this connection */ 370 #define MCIS_OPENING 1 /* sending initial protocol */ 371 #define MCIS_OPEN 2 /* open, initial protocol sent */ 372 #define MCIS_ACTIVE 3 /* message being sent */ 373 #define MCIS_QUITING 4 /* running quit protocol */ 374 #define MCIS_SSD 5 /* service shutting down */ 375 #define MCIS_ERROR 6 /* I/O error on connection */ 376 /* 377 ** Mapping functions 378 ** 379 ** These allow arbitrary mappings in the config file. The idea 380 ** (albeit not the implementation) comes from IDA sendmail. 381 */ 382 383 384 /* 385 ** The class of a map -- essentially the functions to call 386 */ 387 388 # define MAPCLASS struct _mapclass 389 390 MAPCLASS 391 { 392 bool (*map_init)(); /* initialization function */ 393 char *(*map_lookup)(); /* lookup function */ 394 }; 395 396 397 /* 398 ** An actual map. 399 */ 400 401 # define MAP struct _map 402 403 MAP 404 { 405 MAPCLASS *map_class; /* the class of this map */ 406 int map_flags; /* flags, see below */ 407 char *map_file; /* the (nominal) filename */ 408 }; 409 410 /* bit values for map_flags */ 411 # define MF_VALID 00001 /* this entry is valid */ 412 /* 413 ** Symbol table definitions 414 */ 415 416 struct symtab 417 { 418 char *s_name; /* name to be entered */ 419 char s_type; /* general type (see below) */ 420 struct symtab *s_next; /* pointer to next in chain */ 421 union 422 { 423 BITMAP sv_class; /* bit-map of word classes */ 424 ADDRESS *sv_addr; /* pointer to address header */ 425 MAILER *sv_mailer; /* pointer to mailer */ 426 char *sv_alias; /* alias */ 427 MAPCLASS sv_mapclass; /* mapping function class */ 428 MAP sv_map; /* mapping function */ 429 MCI sv_mci; /* mailer connection info */ 430 } s_value; 431 }; 432 433 typedef struct symtab STAB; 434 435 /* symbol types */ 436 # define ST_UNDEF 0 /* undefined type */ 437 # define ST_CLASS 1 /* class map */ 438 # define ST_ADDRESS 2 /* an address in parsed format */ 439 # define ST_MAILER 3 /* a mailer header */ 440 # define ST_ALIAS 4 /* an alias */ 441 # define ST_MAPCLASS 5 /* mapping function class */ 442 # define ST_MAP 6 /* mapping function */ 443 # define ST_MCI 16 /* mailer connection info (offset) */ 444 445 # define s_class s_value.sv_class 446 # define s_address s_value.sv_addr 447 # define s_mailer s_value.sv_mailer 448 # define s_alias s_value.sv_alias 449 # define s_mci s_value.sv_mci 450 # define s_mapclass s_value.sv_mapclass 451 # define s_map s_value.sv_map 452 453 extern STAB *stab(); 454 455 /* opcodes to stab */ 456 # define ST_FIND 0 /* find entry */ 457 # define ST_ENTER 1 /* enter if not there */ 458 /* 459 ** STRUCT EVENT -- event queue. 460 ** 461 ** Maintained in sorted order. 462 ** 463 ** We store the pid of the process that set this event to insure 464 ** that when we fork we will not take events intended for the parent. 465 */ 466 467 struct event 468 { 469 time_t ev_time; /* time of the function call */ 470 int (*ev_func)(); /* function to call */ 471 int ev_arg; /* argument to ev_func */ 472 int ev_pid; /* pid that set this event */ 473 struct event *ev_link; /* link to next item */ 474 }; 475 476 typedef struct event EVENT; 477 478 EXTERN EVENT *EventQueue; /* head of event queue */ 479 /* 480 ** Operation, send, and error modes 481 ** 482 ** The operation mode describes the basic operation of sendmail. 483 ** This can be set from the command line, and is "send mail" by 484 ** default. 485 ** 486 ** The send mode tells how to send mail. It can be set in the 487 ** configuration file. It's setting determines how quickly the 488 ** mail will be delivered versus the load on your system. If the 489 ** -v (verbose) flag is given, it will be forced to SM_DELIVER 490 ** mode. 491 ** 492 ** The error mode tells how to return errors. 493 */ 494 495 EXTERN char OpMode; /* operation mode, see below */ 496 497 #define MD_DELIVER 'm' /* be a mail sender */ 498 #define MD_SMTP 's' /* run SMTP on standard input */ 499 #define MD_DAEMON 'd' /* run as a daemon */ 500 #define MD_VERIFY 'v' /* verify: don't collect or deliver */ 501 #define MD_TEST 't' /* test mode: resolve addrs only */ 502 #define MD_INITALIAS 'i' /* initialize alias database */ 503 #define MD_PRINT 'p' /* print the queue */ 504 #define MD_FREEZE 'z' /* freeze the configuration file */ 505 506 507 EXTERN char SendMode; /* send mode, see below */ 508 509 #define SM_DELIVER 'i' /* interactive delivery */ 510 #define SM_QUICKD 'j' /* deliver w/o queueing */ 511 #define SM_FORK 'b' /* deliver in background */ 512 #define SM_QUEUE 'q' /* queue, don't deliver */ 513 #define SM_VERIFY 'v' /* verify only (used internally) */ 514 515 /* used only as a parameter to sendall */ 516 #define SM_DEFAULT '\0' /* unspecified, use SendMode */ 517 518 519 EXTERN char ErrorMode; /* error mode, see below */ 520 521 #define EM_PRINT 'p' /* print errors */ 522 #define EM_MAIL 'm' /* mail back errors */ 523 #define EM_WRITE 'w' /* write back errors */ 524 #define EM_BERKNET 'e' /* special berknet processing */ 525 #define EM_QUIET 'q' /* don't print messages (stat only) */ 526 527 /* offset used to issure that the error messages for name server error 528 * codes are unique. 529 */ 530 #define MAX_ERRNO 100 531 /* 532 ** Global variables. 533 */ 534 535 EXTERN bool FromFlag; /* if set, "From" person is explicit */ 536 EXTERN bool NoAlias; /* if set, don't do any aliasing */ 537 EXTERN bool ForceMail; /* if set, mail even if already got a copy */ 538 EXTERN bool MeToo; /* send to the sender also */ 539 EXTERN bool IgnrDot; /* don't let dot end messages */ 540 EXTERN bool SaveFrom; /* save leading "From" lines */ 541 EXTERN bool Verbose; /* set if blow-by-blow desired */ 542 EXTERN bool GrabTo; /* if set, get recipients from msg */ 543 EXTERN bool NoReturn; /* don't return letter to sender */ 544 EXTERN bool SuprErrs; /* set if we are suppressing errors */ 545 EXTERN bool QueueRun; /* currently running message from the queue */ 546 EXTERN bool HoldErrs; /* only output errors to transcript */ 547 EXTERN bool NoConnect; /* don't connect to non-local mailers */ 548 EXTERN bool SuperSafe; /* be extra careful, even if expensive */ 549 EXTERN bool ForkQueueRuns; /* fork for each job when running the queue */ 550 EXTERN bool AutoRebuild; /* auto-rebuild the alias database as needed */ 551 EXTERN bool CheckAliases; /* parse addresses during newaliases */ 552 EXTERN bool UseNameServer; /* use internet domain name server */ 553 EXTERN bool EightBit; /* try to preserve 8-bit data */ 554 EXTERN int SafeAlias; /* minutes to wait until @:@ in alias file */ 555 EXTERN time_t TimeOut; /* time until timeout */ 556 EXTERN FILE *InChannel; /* input connection */ 557 EXTERN FILE *OutChannel; /* output connection */ 558 EXTERN uid_t RealUid; /* when Daemon, real uid of caller */ 559 EXTERN gid_t RealGid; /* when Daemon, real gid of caller */ 560 EXTERN uid_t DefUid; /* default uid to run as */ 561 EXTERN gid_t DefGid; /* default gid to run as */ 562 EXTERN char *DefUser; /* default user to run as (from DefUid) */ 563 EXTERN int OldUmask; /* umask when sendmail starts up */ 564 EXTERN int Errors; /* set if errors (local to single pass) */ 565 EXTERN int ExitStat; /* exit status code */ 566 EXTERN int AliasLevel; /* depth of aliasing */ 567 EXTERN int MotherPid; /* proc id of parent process */ 568 EXTERN int LineNumber; /* line number in current input */ 569 EXTERN time_t ReadTimeout; /* timeout on reads */ 570 EXTERN int LogLevel; /* level of logging to perform */ 571 EXTERN int FileMode; /* mode on files */ 572 EXTERN int QueueLA; /* load average starting forced queueing */ 573 EXTERN int RefuseLA; /* load average refusing connections are */ 574 EXTERN int CurrentLA; /* current load average */ 575 EXTERN int QueueFactor; /* slope of queue function */ 576 EXTERN time_t QueueIntvl; /* intervals between running the queue */ 577 EXTERN char *AliasFile; /* location of alias file */ 578 EXTERN char *HelpFile; /* location of SMTP help file */ 579 EXTERN char *ErrMsgFile; /* file to prepend to all error messages */ 580 EXTERN char *StatFile; /* location of statistics summary */ 581 EXTERN char *QueueDir; /* location of queue directory */ 582 EXTERN char *FileName; /* name to print on error messages */ 583 EXTERN char *SmtpPhase; /* current phase in SMTP processing */ 584 EXTERN char *MyHostName; /* name of this host for SMTP messages */ 585 EXTERN char *RealHostName; /* name of host we are talking to */ 586 EXTERN struct sockaddr_in RealHostAddr;/* address of host we are talking to */ 587 EXTERN char *CurHostName; /* current host we are dealing with */ 588 EXTERN jmp_buf TopFrame; /* branch-to-top-of-loop-on-error frame */ 589 EXTERN bool QuickAbort; /* .... but only if we want a quick abort */ 590 EXTERN bool LogUsrErrs; /* syslog user errors (e.g., SMTP RCPT cmd) */ 591 extern char *ConfFile; /* location of configuration file [conf.c] */ 592 extern char *FreezeFile; /* location of frozen memory image [conf.c] */ 593 extern char Arpa_Info[]; /* the reply code for Arpanet info [conf.c] */ 594 extern ADDRESS NullAddress; /* a null (template) address [main.c] */ 595 EXTERN char SpaceSub; /* substitution for <lwsp> */ 596 EXTERN int WkClassFact; /* multiplier for message class -> priority */ 597 EXTERN int WkRecipFact; /* multiplier for # of recipients -> priority */ 598 EXTERN int WkTimeFact; /* priority offset each time this job is run */ 599 EXTERN char *PostMasterCopy; /* address to get errs cc's */ 600 EXTERN char *TrustedUsers[MAXTRUST+1]; /* list of trusted users */ 601 EXTERN char *UserEnviron[MAXUSERENVIRON+1]; /* saved user environment */ 602 EXTERN int CheckpointInterval; /* queue file checkpoint interval */ 603 EXTERN bool NoWildcardMX; /* we don't have wildcard MX records */ 604 EXTERN char *UdbSpec; /* user database source spec [udbexpand.c] */ 605 EXTERN int MaxHopCount; /* number of hops until we give an error */ 606 EXTERN int ConfigLevel; /* config file level -- what does .cf expect? */ 607 EXTERN char *TimeZoneSpec; /* override time zone specification */ 608 EXTERN bool MatchGecos; /* look for user names in gecos field */ 609 EXTERN int MaxMciCache; /* maximum entries in MCI cache */ 610 EXTERN time_t MciCacheTimeout; /* maximum idle time on connections */ 611 /* 612 ** Trace information 613 */ 614 615 /* trace vector and macros for debugging flags */ 616 EXTERN u_char tTdvect[100]; 617 # define tTd(flag, level) (tTdvect[flag] >= level) 618 # define tTdlevel(flag) (tTdvect[flag]) 619 /* 620 ** Miscellaneous information. 621 */ 622 623 624 625 /* 626 ** Some in-line functions 627 */ 628 629 /* set exit status */ 630 #define setstat(s) { \ 631 if (ExitStat == EX_OK || ExitStat == EX_TEMPFAIL) \ 632 ExitStat = s; \ 633 } 634 635 /* make a copy of a string */ 636 #define newstr(s) strcpy(xalloc(strlen(s) + 1), s) 637 638 #define STRUCTCOPY(s, d) d = s 639 640 641 /* 642 ** Declarations of useful functions 643 */ 644 645 extern ADDRESS *parseaddr(); 646 extern char *xalloc(); 647 extern bool sameaddr(); 648 extern FILE *dfopen(); 649 extern EVENT *setevent(); 650 extern char *sfgets(); 651 extern char *queuename(); 652 extern time_t curtime(); 653