📄 sendmail.h
字号:
/* * Copyright (c) 1983 Eric P. Allman * Copyright (c) 1988, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)sendmail.h 8.43 (Berkeley) 4/14/94 *//*** SENDMAIL.H -- Global definitions for sendmail.*/# ifdef _DEFINE# define EXTERN# ifndef lintstatic char SmailSccsId[] = "@(#)sendmail.h 8.43 4/14/94";# endif# else /* _DEFINE */# define EXTERN extern# endif /* _DEFINE */# include <unistd.h># include <stddef.h># include <stdlib.h># include <stdio.h># include <ctype.h># include <setjmp.h># include <sysexits.h># include <string.h># include <time.h># include <errno.h># include "conf.h"# include "useful.h"# ifdef LOG# include <syslog.h># endif /* LOG */# ifdef DAEMON# include <sys/socket.h># endif# ifdef NETUNIX# include <sys/un.h># endif# ifdef NETINET# include <netinet/in.h># endif# ifdef NETISO# include <netiso/iso.h># endif# ifdef NETNS# include <netns/ns.h># endif# ifdef NETX25# include <netccitt/x25.h># endif/*** Data structure for bit maps.**** Each bit in this map can be referenced by an ascii character.** This is 128 possible bits, or 12 8-bit bytes.*/#define BITMAPBYTES 16 /* number of bytes in a bit map */#define BYTEBITS 8 /* number of bits in a byte *//* internal macros */#define _BITWORD(bit) (bit / (BYTEBITS * sizeof (int)))#define _BITBIT(bit) (1 << (bit % (BYTEBITS * sizeof (int))))typedef int BITMAP[BITMAPBYTES / sizeof (int)];/* test bit number N */#define bitnset(bit, map) ((map)[_BITWORD(bit)] & _BITBIT(bit))/* set bit number N */#define setbitn(bit, map) (map)[_BITWORD(bit)] |= _BITBIT(bit)/* clear bit number N */#define clrbitn(bit, map) (map)[_BITWORD(bit)] &= ~_BITBIT(bit)/* clear an entire bit map */#define clrbitmap(map) bzero((char *) map, BITMAPBYTES)/*** Address structure.** Addresses are stored internally in this structure.*/struct address{ char *q_paddr; /* the printname for the address */ char *q_user; /* user name */ char *q_ruser; /* real user name, or NULL if q_user */ char *q_host; /* host name */ struct mailer *q_mailer; /* mailer to use */ u_short q_flags; /* status flags, see below */ uid_t q_uid; /* user-id of receiver (if known) */ gid_t q_gid; /* group-id of receiver (if known) */ char *q_home; /* home dir (local mailer only) */ char *q_fullname; /* full name if known */ struct address *q_next; /* chain */ struct address *q_alias; /* address this results from */ char *q_owner; /* owner of q_alias */ struct address *q_tchain; /* temporary use chain */ time_t q_timeout; /* timeout for this address */};typedef struct address ADDRESS;# define QDONTSEND 000001 /* don't send to this address */# define QBADADDR 000002 /* this address is verified bad */# define QGOODUID 000004 /* the q_uid q_gid fields are good */# define QPRIMARY 000010 /* set from argv */# define QQUEUEUP 000020 /* queue for later transmission */# define QSENT 000040 /* has been successfully delivered */# define QNOTREMOTE 000100 /* not an address for remote forwarding */# define QSELFREF 000200 /* this address references itself */# define QVERIFIED 000400 /* verified, but not expanded */# define QREPORT 001000 /* report this address in return message */# define QBOGUSSHELL 002000 /* this entry has an invalid shell listed */# define QUNSAFEADDR 004000 /* address aquired through an unsafe path */# define NULLADDR ((ADDRESS *) NULL)/*** Mailer definition structure.** Every mailer known to the system is declared in this** structure. It defines the pathname of the mailer, some** flags associated with it, and the argument vector to** pass to it. The flags are defined in conf.c**** The argument vector is expanded before actual use. All** words except the first are passed through the macro** processor.*/struct mailer{ char *m_name; /* symbolic name of this mailer */ char *m_mailer; /* pathname of the mailer to use */ BITMAP m_flags; /* status flags, see below */ short m_mno; /* mailer number internally */ char **m_argv; /* template argument vector */ short m_sh_rwset; /* rewrite set: sender header addresses */ short m_se_rwset; /* rewrite set: sender envelope addresses */ short m_rh_rwset; /* rewrite set: recipient header addresses */ short m_re_rwset; /* rewrite set: recipient envelope addresses */ char *m_eol; /* end of line string */ long m_maxsize; /* size limit on message to this mailer */ int m_linelimit; /* max # characters per line */ char *m_execdir; /* directory to chdir to before execv */};typedef struct mailer MAILER;/* bits for m_flags */# define M_ESMTP 'a' /* run Extended SMTP protocol */# define M_BLANKEND 'b' /* ensure blank line at end of message */# define M_NOCOMMENT 'c' /* don't include comment part of address */# define M_CANONICAL 'C' /* make addresses canonical "u@dom" */ /* 'D' /* CF: include Date: */# define M_EXPENSIVE 'e' /* it costs to use this mailer.... */# define M_ESCFROM 'E' /* escape From lines to >From */# define M_FOPT 'f' /* mailer takes picky -f flag */ /* 'F' /* CF: include From: or Resent-From: */# define M_NO_NULL_FROM 'g' /* sender of errors should be $g */# define M_HST_UPPER 'h' /* preserve host case distinction */# define M_PREHEAD 'H' /* MAIL11V3: preview headers */# define M_INTERNAL 'I' /* SMTP to another sendmail site */# define M_LOCALMAILER 'l' /* delivery is to this host */# define M_LIMITS 'L' /* must enforce SMTP line limits */# define M_MUSER 'm' /* can handle multiple users at once */ /* 'M' /* CF: include Message-Id: */# define M_NHDR 'n' /* don't insert From line */# define M_MANYSTATUS 'N' /* MAIL11V3: DATA returns multi-status */# define M_FROMPATH 'p' /* use reverse-path in MAIL FROM: */ /* 'P' /* CF: include Return-Path: */# define M_ROPT 'r' /* mailer takes picky -r flag */# define M_SECURE_PORT 'R' /* try to send on a reserved TCP port */# define M_STRIPQ 's' /* strip quote chars from user/host */# define M_RESTR 'S' /* must be daemon to execute */# define M_USR_UPPER 'u' /* preserve user case distinction */# define M_UGLYUUCP 'U' /* this wants an ugly UUCP from line */ /* 'V' /* UIUC: !-relativize all addresses */ /* 'x' /* CF: include Full-Name: */# define M_XDOT 'X' /* use hidden-dot algorithm */# define M_7BITS '7' /* use 7-bit path */EXTERN MAILER *Mailer[MAXMAILERS+1];EXTERN MAILER *LocalMailer; /* ptr to local mailer */EXTERN MAILER *ProgMailer; /* ptr to program mailer */EXTERN MAILER *FileMailer; /* ptr to *file* mailer */EXTERN MAILER *InclMailer; /* ptr to *include* mailer *//*** Header structure.** This structure is used internally to store header items.*/struct header{ char *h_field; /* the name of the field */ char *h_value; /* the value of that field */ struct header *h_link; /* the next header */ u_short h_flags; /* status bits, see below */ BITMAP h_mflags; /* m_flags bits needed */};typedef struct header HDR;/*** Header information structure.** Defined in conf.c, this struct declares the header fields** that have some magic meaning.*/struct hdrinfo{ char *hi_field; /* the name of the field */ u_short hi_flags; /* status bits, see below */};extern struct hdrinfo HdrInfo[];/* bits for h_flags and hi_flags */# define H_EOH 00001 /* this field terminates header */# define H_RCPT 00002 /* contains recipient addresses */# define H_DEFAULT 00004 /* if another value is found, drop this */# define H_RESENT 00010 /* this address is a "Resent-..." address */# define H_CHECK 00020 /* check h_mflags against m_flags */# define H_ACHECK 00040 /* ditto, but always (not just default) */# define H_FORCE 00100 /* force this field, even if default */# define H_TRACE 00200 /* this field contains trace information */# define H_FROM 00400 /* this is a from-type field */# define H_VALID 01000 /* this field has a validated value */# define H_RECEIPTTO 02000 /* this field has return receipt info */# define H_ERRORSTO 04000 /* this field has error address info *//*** Information about currently open connections to mailers, or to** hosts that we have looked up recently.*/# define MCI struct mailer_con_infoMCI{ short mci_flags; /* flag bits, see below */ short mci_errno; /* error number on last connection */ short mci_herrno; /* h_errno from last DNS lookup */ short mci_exitstat; /* exit status from last connection */ short mci_state; /* SMTP state */ long mci_maxsize; /* max size this server will accept */ FILE *mci_in; /* input side of connection */ FILE *mci_out; /* output side of connection */ int mci_pid; /* process id of subordinate proc */ char *mci_phase; /* SMTP phase string */ struct mailer *mci_mailer; /* ptr to the mailer for this conn */ char *mci_host; /* host name */ time_t mci_lastuse; /* last usage time */};/* flag bits */#define MCIF_VALID 000001 /* this entry is valid */#define MCIF_TEMP 000002 /* don't cache this connection */#define MCIF_CACHED 000004 /* currently in open cache */#define MCIF_ESMTP 000010 /* this host speaks ESMTP */#define MCIF_EXPN 000020 /* EXPN command supported */#define MCIF_SIZE 000040 /* SIZE option supported */#define MCIF_8BITMIME 000100 /* BODY=8BITMIME supported */#define MCIF_7BIT 000200 /* strip this message to 7 bits */#define MCIF_MULTSTAT 000400 /* MAIL11V3: handles MULT status *//* states */#define MCIS_CLOSED 0 /* no traffic on this connection */#define MCIS_OPENING 1 /* sending initial protocol */#define MCIS_OPEN 2 /* open, initial protocol sent */#define MCIS_ACTIVE 3 /* message being sent */#define MCIS_QUITING 4 /* running quit protocol */#define MCIS_SSD 5 /* service shutting down */#define MCIS_ERROR 6 /* I/O error on connection *//*** Envelope structure.** This structure defines the message itself. There is usually** only one of these -- for the message that we originally read** and which is our primary interest -- but other envelopes can** be generated during processing. For example, error messages** will have their own envelope.*/# define ENVELOPE struct envelopeENVELOPE
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -