27c478bdstevel@tonic-gate * CDDL HEADER START
37c478bdstevel@tonic-gate *
47c478bdstevel@tonic-gate * The contents of this file are subject to the terms of the
523a1cceRoger A. Faulkner * Common Development and Distribution License (the "License").
623a1cceRoger A. Faulkner * You may not use this file except in compliance with the License.
77c478bdstevel@tonic-gate *
87c478bdstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bdstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
107c478bdstevel@tonic-gate * See the License for the specific language governing permissions
117c478bdstevel@tonic-gate * and limitations under the License.
127c478bdstevel@tonic-gate *
137c478bdstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
147c478bdstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bdstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
167c478bdstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
177c478bdstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bdstevel@tonic-gate *
197c478bdstevel@tonic-gate * CDDL HEADER END
207c478bdstevel@tonic-gate */
2123a1cceRoger A. Faulkner
2323a1cceRoger A. Faulkner * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
247c478bdstevel@tonic-gate */
26b7d62afceastha/*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
27b7d62afceastha/*	  All Rights Reserved  	*/
297c478bdstevel@tonic-gate#ifndef _MAIL_H
307c478bdstevel@tonic-gate#define	_MAIL_H
327c478bdstevel@tonic-gate /*
337c478bdstevel@tonic-gate  * All global externs defined here. All variables are initialized
347c478bdstevel@tonic-gate  * in init.c
357c478bdstevel@tonic-gate  *
367c478bdstevel@tonic-gate  * !!!!!IF YOU CHANGE (OR ADD) IT HERE, DO IT THERE ALSO !!!!!!!!
377c478bdstevel@tonic-gate  *
387c478bdstevel@tonic-gate  */
397c478bdstevel@tonic-gate#include	<errno.h>
407c478bdstevel@tonic-gate#include	<fcntl.h>
417c478bdstevel@tonic-gate#include	<stdio.h>
427c478bdstevel@tonic-gate#include	<ctype.h>
437c478bdstevel@tonic-gate#include	<sys/types.h>
447c478bdstevel@tonic-gate#include	<errno.h>
457c478bdstevel@tonic-gate#include	<pwd.h>
467c478bdstevel@tonic-gate#include	<signal.h>
477c478bdstevel@tonic-gate#include	<string.h>
487c478bdstevel@tonic-gate#include	<grp.h>
497c478bdstevel@tonic-gate/* The following is a kludge to allow for inconsistent header files in SVR4 */
507c478bdstevel@tonic-gate#define		_CLOCK_T
517c478bdstevel@tonic-gate#include	<time.h>
527c478bdstevel@tonic-gate#include	<sys/stat.h>
537c478bdstevel@tonic-gate#include	<setjmp.h>
547c478bdstevel@tonic-gate#include	<sys/utsname.h>
557c478bdstevel@tonic-gate#include        <limits.h>
577c478bdstevel@tonic-gate#ifdef SVR3
587c478bdstevel@tonic-gate   struct utimbuf {
597c478bdstevel@tonic-gate	time_t	actime;
607c478bdstevel@tonic-gate	time_t	modtime;
617c478bdstevel@tonic-gate   };
637c478bdstevel@tonic-gate#  include	<utime.h>
657c478bdstevel@tonic-gate#include	"libmail.h"
677c478bdstevel@tonic-gate/* The following typedefs must be used in SVR4 */
687c478bdstevel@tonic-gate#ifdef SVR3
697c478bdstevel@tonic-gate# ifndef sun
707c478bdstevel@tonic-gatetypedef int gid_t;
717c478bdstevel@tonic-gatetypedef int uid_t;
727c478bdstevel@tonic-gate# endif
737c478bdstevel@tonic-gatetypedef int pid_t;
767c478bdstevel@tonic-gate#define CHILD		0
777c478bdstevel@tonic-gate#define SAME		0
797c478bdstevel@tonic-gate#define	BELL		07
817c478bdstevel@tonic-gate#   define	PIPER	"/usr/lib/mail/mail_pipe"
837c478bdstevel@tonic-gate#define SENDMAIL "/usr/lib/sendmail"
857c478bdstevel@tonic-gate#define CERROR		-1
867c478bdstevel@tonic-gate#define CSUCCESS	0
887c478bdstevel@tonic-gate#define TRUE	1
897c478bdstevel@tonic-gate#define FALSE	0
917c478bdstevel@tonic-gate#define	HEAD	1
927c478bdstevel@tonic-gate#define TAIL	0
947c478bdstevel@tonic-gate#define	REAL	1
957c478bdstevel@tonic-gate#define DEFAULT	0
977c478bdstevel@tonic-gate/* findSurg() return values */
987c478bdstevel@tonic-gate#define	NOMATCH		-1
997c478bdstevel@tonic-gate#define	DELIVER		0
1007c478bdstevel@tonic-gate#define	POSTDELIVER	1
1017c478bdstevel@tonic-gate#define	DENY		2
1027c478bdstevel@tonic-gate#define	TRANSLATE	3
1047c478bdstevel@tonic-gate/* sendsurg() return values */
1057c478bdstevel@tonic-gate#define	FAILURE		0
1067c478bdstevel@tonic-gate#define	CONTINUE	1
1077c478bdstevel@tonic-gate#define	SUCCESS		2
1087c478bdstevel@tonic-gate/*	TRANSLATE	3 */
1107c478bdstevel@tonic-gate#define	HDRSIZ	1024	/* maximum length of header line */
1127c478bdstevel@tonic-gate#define E_FLGE	1	/* flge error */
1137c478bdstevel@tonic-gate#define E_FLGE_OM 2	/* flgE error, mail present but already accessed */
1147c478bdstevel@tonic-gate#define	E_REMOTE 1	/* unknown remote */
1157c478bdstevel@tonic-gate#define E_FILE	2	/* file error */
1167c478bdstevel@tonic-gate#define E_SPACE	3	/* no space */
1177c478bdstevel@tonic-gate#define E_FRWD	4	/* cannot forward */
1187c478bdstevel@tonic-gate#define E_SYNTAX 5      /* syntax error */
1197c478bdstevel@tonic-gate#define E_FRWL	6	/* forwarding loop */
1207c478bdstevel@tonic-gate#define E_SNDR  7	/* invalid sender */
1217c478bdstevel@tonic-gate#define E_USER  8	/* invalid user */
1227c478bdstevel@tonic-gate#define E_FROM  9	/* too many From lines */
1237c478bdstevel@tonic-gate#define E_PERM  10 	/* bad permissions */
1247c478bdstevel@tonic-gate#define E_MBOX  11 	/* mbox problem */
1257c478bdstevel@tonic-gate#define E_TMP	12 	/* temporary file problem */
1267c478bdstevel@tonic-gate#define E_DEAD  13 	/* Cannot create dead.letter */
1277c478bdstevel@tonic-gate#define E_UNBND 14 	/* Unbounded forwarding */
1287c478bdstevel@tonic-gate#define E_LOCK  15 	/* cannot create lock file */
1297c478bdstevel@tonic-gate#define E_GROUP	16	/* no group id of 'mail' */
1307c478bdstevel@tonic-gate#define	E_MEM	17	/* malloc failure */
1317c478bdstevel@tonic-gate#define E_FORK	18	/* could not fork */
1327c478bdstevel@tonic-gate#define	E_PIPE	19	/* could not pipe */
1337c478bdstevel@tonic-gate#define	E_OWNR	20	/* invoker does not own mailfile */
1347c478bdstevel@tonic-gate#define	E_DENY	21	/* permission denied by mailsurr file */
1357c478bdstevel@tonic-gate#define E_SURG	22	/* surrogate command failed - rc != 0 || 99 */
1377c478bdstevel@tonic-gate#define	H_AFWDCNT		1	/* "Auto-Forward-Count:"  */
1387c478bdstevel@tonic-gate#define	H_AFWDFROM		2	/* "Auto-Forwarded-From:" */
1397c478bdstevel@tonic-gate#define	H_CLEN			3	/* "Content-Length:"      */
1407c478bdstevel@tonic-gate#define	H_CTYPE			4	/* "Content-Type:"        */
1417c478bdstevel@tonic-gate#define	H_DATE			5	/* "Date:" 		  */
1427c478bdstevel@tonic-gate#define	H_DEFOPTS		6	/* "Default-Options:" 	  */
1437c478bdstevel@tonic-gate#define	H_EOH			7	/* "End-of-Header:" 	  */
1447c478bdstevel@tonic-gate#define	H_FROM			8	/* "From " 		  */
1457c478bdstevel@tonic-gate#define	H_FROM1			9	/* ">From " 		  */
1467c478bdstevel@tonic-gate#define	H_FROM2			10	/* "From: " 		  */
1477c478bdstevel@tonic-gate#define	H_MIMEVERS		11	/* "MIME-Version:"        */
1487c478bdstevel@tonic-gate#define	H_MTSID			12	/* "MTS-Message-ID:" 	  */
1497c478bdstevel@tonic-gate#define	H_MTYPE			13	/* "Message-Type:" 	  */
1507c478bdstevel@tonic-gate#define	H_MVERS			14	/* "Message-Version:" 	  */
1517c478bdstevel@tonic-gate#define	H_MSVC			15	/* "Message-Service:" 	  */
1527c478bdstevel@tonic-gate#define	H_RECEIVED		16	/* "Received:"	 	  */
1537c478bdstevel@tonic-gate#define	H_RVERS			17	/* "Report-Version:" 	  */
1547c478bdstevel@tonic-gate#define	H_SUBJ			18	/* "Subject:" 		  */
1557c478bdstevel@tonic-gate#define	H_TO			19	/* "To:" 		  */
1567c478bdstevel@tonic-gate#define	H_TCOPY			20	/* ">To:" 		  */
1577c478bdstevel@tonic-gate#define	H_TROPTS		21	/* "Transport-Options:"   */
1587c478bdstevel@tonic-gate#define	H_UAID			22	/* "UA-Content-ID:"	  */
1597c478bdstevel@tonic-gate#define	H_DAFWDFROM		23	/* Hold A-F-F when sending Del. Notf. */
1607c478bdstevel@tonic-gate#define	H_DTCOPY		24	/* Hold ">To:" when sending Del. Notf.*/
1617c478bdstevel@tonic-gate#define	H_DRECEIVED		25	/* Hold Rcvd: when sending Del. Notf.*/
1627c478bdstevel@tonic-gate#define	H_CONT			26	/* Continuation of previous line */
1637c478bdstevel@tonic-gate#define	H_NAMEVALUE		27	/* unrecognized "name: value" hdr line*/
1657c478bdstevel@tonic-gate/* MTA Transport Options */
1667c478bdstevel@tonic-gate#define	DELIVERY	001
1677c478bdstevel@tonic-gate#define	NODELIVERY	002
1687c478bdstevel@tonic-gate#define	REPORT		010
1697c478bdstevel@tonic-gate#define	RETURN		020
1707c478bdstevel@tonic-gate#define	IGNORE		040
1737c478bdstevel@tonic-gate	copylet flags
1757c478bdstevel@tonic-gate#define	REMOTE		1		/* remote mail, add rmtmsg */
1767c478bdstevel@tonic-gate#define ORDINARY	2
1777c478bdstevel@tonic-gate#define ZAP		3		/* zap header and trailing empty line */
1787c478bdstevel@tonic-gate#define FORWARD		4
1797c478bdstevel@tonic-gate#define TTY		5		/* suppress binary to tty */
1817c478bdstevel@tonic-gate#define	LSIZE		(2*BUFSIZ)	/* maximum size of a line */
1827c478bdstevel@tonic-gate#define	MAXLET		1000		/* maximum number of letters */
1837c478bdstevel@tonic-gate#define FROMLEVELS	20		/* maxium number of forwards */
1847c478bdstevel@tonic-gate#ifdef FILENAME_MAX
1857c478bdstevel@tonic-gate# define MAXFILENAME	FILENAME_MAX	/* max length of a filename */
1877c478bdstevel@tonic-gate# define MAXFILENAME	512		/* max length of a filename */
1897c478bdstevel@tonic-gate#define DEADPERM	0600		/* permissions of dead.letter */
1917c478bdstevel@tonic-gate#ifndef	MFMODE
1927c478bdstevel@tonic-gate#define	MFMODE		0660		/* create mode for `/var/mail' files */
1957c478bdstevel@tonic-gate#define A_OK		0		/* return value for access */
1967c478bdstevel@tonic-gate#define A_EXECUTE	1
1977c478bdstevel@tonic-gate#define A_EXIST		0		/* access check for existence */
1987c478bdstevel@tonic-gate#define A_WRITE		2		/* access check for write permission */
1997c478bdstevel@tonic-gate#define A_READ		4		/* access check for read permission */
2017c478bdstevel@tonic-gate#  define MAILSURR "/etc/mail/mailsurr"
2027c478bdstevel@tonic-gate#  define MAILCNFG "/etc/mail/mailcnfg"
2047c478bdstevel@tonic-gatestruct hdr {
2057c478bdstevel@tonic-gate	char	*tag;
2067c478bdstevel@tonic-gate	int	default_display;
2097c478bdstevel@tonic-gatestruct hdrs {
2107c478bdstevel@tonic-gate	struct	hdrs	*next;
2117c478bdstevel@tonic-gate	struct	hdrs	*prev;
2127c478bdstevel@tonic-gate	struct	hdrs	*cont;	/* Continuation lines */
2137c478bdstevel@tonic-gate		char	value[HDRSIZ+1];
2167c478bdstevel@tonic-gatestruct hdrlines {
2177c478bdstevel@tonic-gate	struct	hdrs	*head;
2187c478bdstevel@tonic-gate	struct	hdrs	*tail;
2217c478bdstevel@tonic-gatetypedef struct recip {
2227c478bdstevel@tonic-gate	struct recip	*next;
2237c478bdstevel@tonic-gate	char		*name;
2247c478bdstevel@tonic-gate} recip;
2267c478bdstevel@tonic-gatetypedef struct reciplist {
2277c478bdstevel@tonic-gate	recip *last_recip;
2287c478bdstevel@tonic-gate	recip recip_list;
2297c478bdstevel@tonic-gate} reciplist;
2317c478bdstevel@tonic-gatestruct let {
2327c478bdstevel@tonic-gate	long	adr;		/* offset in mailfile of letter n */
2337c478bdstevel@tonic-gate	char	change;		/* disposition status of letter n */
2347c478bdstevel@tonic-gate	char	text;		/* 1 ==> text content, 0 ==> binary content.
2357c478bdstevel@tonic-gate				 * This is determined INDEPENDENTLY of what
2367c478bdstevel@tonic-gate				 * the Content-type, if present, says...
2377c478bdstevel@tonic-gate				 */
2407c478bdstevel@tonic-gatetypedef enum t_surrtype
2427c478bdstevel@tonic-gate    t_eof, t_transport = '<',
2437c478bdstevel@tonic-gate    t_accept = 'a', t_deny = 'd',
2447c478bdstevel@tonic-gate    t_translate = 't', t_postprocess = '>'
2457c478bdstevel@tonic-gate} t_surrtype;
2477c478bdstevel@tonic-gatetypedef struct t_surrfile
2497c478bdstevel@tonic-gate    /* originator's regular expression */
2507c478bdstevel@tonic-gate    string *orig_pattern;
2517c478bdstevel@tonic-gate    char *orig_regex;
2527c478bdstevel@tonic-gate    int orig_reglen;
2537c478bdstevel@tonic-gate    int orig_nbra;
2557c478bdstevel@tonic-gate    /* recipient's regular expression */
2567c478bdstevel@tonic-gate    string *recip_pattern;
2577c478bdstevel@tonic-gate    char *recip_regex;
2587c478bdstevel@tonic-gate    int recip_reglen;
2597c478bdstevel@tonic-gate    int recip_nbra;
2617c478bdstevel@tonic-gate    /* the type of the command string */
2627c478bdstevel@tonic-gate    t_surrtype surr_type;
2647c478bdstevel@tonic-gate    int batchsize;	/* transport	translate	postprocess */
2657c478bdstevel@tonic-gate    char *statlist;	/* transport				    */
2667c478bdstevel@tonic-gate    string *cmd_left;	/* transport	translate	postprocess */
2677c478bdstevel@tonic-gate    string *cmd_right;	/* transport	translate	postprocess */
2687c478bdstevel@tonic-gate    int fullyresolved;	/*		translate		    */
2697c478bdstevel@tonic-gate} t_surrfile;
271ace1a5fdp#include <stdlib.h>
272ace1a5fdp#include <unistd.h>
2747c478bdstevel@tonic-gateextern	void	Dout(char *subname, int level, char *fmt, ...);
2757c478bdstevel@tonic-gateextern	void	Tout(char *subname, char *msg, ...);
2767c478bdstevel@tonic-gateextern	int	add_recip(reciplist *plist, char *name, int checkdups);
2777c478bdstevel@tonic-gateextern	char	*altcompile(const char *instring, char *expbuf, char *endbuf);
2787c478bdstevel@tonic-gateextern	int	areforwarding(char *mailfile);
2797c478bdstevel@tonic-gateextern	void	cat(char*, char*, char*);
2807c478bdstevel@tonic-gateextern	int	ckdlivopts(int tcopy_hdr, int *svopts);
2817c478bdstevel@tonic-gateextern	void	cksaved(char *user);
2827c478bdstevel@tonic-gateextern	int	cksurg_rc(int surr_num, int rc);
2837c478bdstevel@tonic-gateextern	void	clr_hinfo(void);
2847c478bdstevel@tonic-gateextern	void	clrhdr(int hdrtype);
2857c478bdstevel@tonic-gateextern	void	cmdexpand(int letnum, string *instr, string *outstr, char **lbraslist, char **lbraelist);
2867c478bdstevel@tonic-gateextern	void	copyback(void);
2877c478bdstevel@tonic-gateextern	int	copylet(int letnum, FILE *f, int type);
2887c478bdstevel@tonic-gateextern	void	copymt(FILE *f1, FILE *f2);
2897c478bdstevel@tonic-gateextern	void	createmf(uid_t uid, char *file);
2907c478bdstevel@tonic-gateextern	void	del_reciplist (reciplist *list);
2917c478bdstevel@tonic-gateextern	void	delete(int);
2927c478bdstevel@tonic-gateextern	void	doFopt(void);
293b7d62afceasthaextern	void	done(int) __NORETURN;
2947c478bdstevel@tonic-gateextern	void	sig_done(int);
2957c478bdstevel@tonic-gateextern	FILE	*doopen(char *file, char *type, int errnum);
2967c478bdstevel@tonic-gateextern	int	dowait(pid_t pidval);
2977c478bdstevel@tonic-gateextern	void	dumpaff(int type, int htype, int *didafflines, int *suppress, FILE *f);
2987c478bdstevel@tonic-gateextern	void	dumprcv(int type, int htype, int *didrcvlines, int *suppress, FILE *f);
2997c478bdstevel@tonic-gateextern	void	errmsg(int error_value, char *error_message);
3007c478bdstevel@tonic-gateextern	int	findSurg(int letnum, string *execbuf, int flag, int *psurr_num, int *paccept, string *lorig, string *lrecipname);
3017c478bdstevel@tonic-gateextern	void	gendeliv(FILE *fp, int rc, char *name);
3027c478bdstevel@tonic-gateextern	int	getcomment(char *s, char *q);
3037c478bdstevel@tonic-gateextern	int	gethead(int	current, int all);
30423a1cceRoger A. Faulknerextern	int	getaline(char *ptr2line, int max, FILE *f);
3057c478bdstevel@tonic-gateextern	int	getnumbr(char *s);
3067c478bdstevel@tonic-gateextern	int	getsurr(FILE *fp, string *buf, int firstfield);
3077c478bdstevel@tonic-gateextern	void	goback(int letnum);
3087c478bdstevel@tonic-gateextern	int	init(void);
3097c478bdstevel@tonic-gateextern	void	initsurrfile(void);
3107c478bdstevel@tonic-gateextern	int	isheader(char *lp, int *ctfp);
3117c478bdstevel@tonic-gateextern	int	isit(char *lp, int type);
3127c478bdstevel@tonic-gateextern	int	islocal(char *user, uid_t *puid);
3137c478bdstevel@tonic-gateextern	int	istext(unsigned char *s, int size);
3147c478bdstevel@tonic-gateextern	int	legal(char *file);
3157c478bdstevel@tonic-gateextern	void	lock(char	*user);
316b7d62afceasthaextern	void	madd_recip(reciplist *plist, char *name, int checkdups);
3177c478bdstevel@tonic-gateextern	char	*mailcompile(string *pattern, int *retlen, int *retnbra);
3187c478bdstevel@tonic-gateextern	void	mkdead(void);
3197c478bdstevel@tonic-gateextern	void	mktmp(void);
3207c478bdstevel@tonic-gateextern	void	mta_ercode(FILE *outfile);
3217c478bdstevel@tonic-gateextern	void	new_reciplist (reciplist *list);
3227c478bdstevel@tonic-gateextern	int	notme(char *fto, char *myname);
3237c478bdstevel@tonic-gateextern	int	parse(int argc, char **argv);
3247c478bdstevel@tonic-gateextern	int	pckaffspot(void);
3257c478bdstevel@tonic-gateextern	int	pckrcvspot(void);
3267c478bdstevel@tonic-gateextern	void	pickFrom(char *lineptr);
3277c478bdstevel@tonic-gateextern	int	pipletr(int letter, char *command, int cltype);
3287c478bdstevel@tonic-gateextern	void	poplist (int hdrtype, int where);
3297c478bdstevel@tonic-gateextern	int	printhdr (int type, int hdrtype, struct hdrs *hptr, FILE *fp);
3307c478bdstevel@tonic-gateextern	void	printmail(void);
3317c478bdstevel@tonic-gateextern	void	pushlist(int hdrtype, int where, char *s, int contflg);
3327c478bdstevel@tonic-gateextern	void	savdead(void);
3337c478bdstevel@tonic-gateextern	void	savehdrs(char *s, int hdrtype);
3347c478bdstevel@tonic-gateextern	int	sel_disp (int type, int hdrtype, char *s);
3357c478bdstevel@tonic-gateextern	int	sendlist(reciplist *list, int letnum, int level);
3367c478bdstevel@tonic-gateextern	void	sendmail(int argc, char **argv);
3377c478bdstevel@tonic-gateextern	int	sendsurg(reciplist *plist, int  letnum, int flag, int local);
3387c478bdstevel@tonic-gateextern	void	setletr(int letter, int status);
3397c478bdstevel@tonic-gateextern	void	(*setsig(int i, void(*f)()))();
3407c478bdstevel@tonic-gateextern	void	setsurg_bt(string *st, int *pbatchsize, int *presolved);
3417c478bdstevel@tonic-gateextern	char	*setsurg_rc(string *st, int defreal, int *pbatchsize);
3427c478bdstevel@tonic-gateextern	char	**setup_exec(char*);
3437c478bdstevel@tonic-gateextern	void	stamp(void);
3447c478bdstevel@tonic-gateextern	int	systm(char *s);
3457c478bdstevel@tonic-gateextern	void	tmperr(void);
3467c478bdstevel@tonic-gateextern	string	*tokdef(string *fld, string *tok, char *name);
3477c478bdstevel@tonic-gateextern	int	translate(reciplist *plist, char *cmdstr, char *origname);
3487c478bdstevel@tonic-gateextern	void	unlock(void);
3497c478bdstevel@tonic-gateextern	int	validmsg(int);
3507c478bdstevel@tonic-gateextern	int	wtmpf(char *str, int length);
3527c478bdstevel@tonic-gateextern	int	ac;		/* argument list count */
3537c478bdstevel@tonic-gateextern	char	**av;		/* argument list */
3547c478bdstevel@tonic-gateextern	int	affbytecnt;     /* Total bytes of Auto-Fwd. info in msg. */
3557c478bdstevel@tonic-gateextern	int	affcnt;		/* Number of Auto-Fwd.-From: lines in msg. */
3567c478bdstevel@tonic-gateextern	int	Daffbytecnt;    /* Hold affbytecnt when sending Deliv. Notif. */
3577c478bdstevel@tonic-gateextern	int	Daffcnt;	/* Hold affcnt when sending Deliv. Notif. */
3587c478bdstevel@tonic-gateextern	char	binmsg[];
3597c478bdstevel@tonic-gateextern	int	changed;	/* > 0 says mailfile has changed */
3607c478bdstevel@tonic-gateextern	char	datestring[60];
3617c478bdstevel@tonic-gateextern	char	dbgfname[20];	/* name of file for debugging output */
3627c478bdstevel@tonic-gateextern	FILE	*dbgfp;		/* FILE* for debugging output */
3637c478bdstevel@tonic-gateextern	char	dead[];		/* name of dead.letter */
3647c478bdstevel@tonic-gateextern	int	debug;		/* Controls debugging level. 0 ==> no debugging */
3657c478bdstevel@tonic-gateextern	int	delflg;
3667c478bdstevel@tonic-gateextern	int	dflag;		/* 1 says returning unsendable mail */
3677c478bdstevel@tonic-gateextern	char	*errlist[];
3687c478bdstevel@tonic-gateextern	int	error;		/* Local value for error */
3697c478bdstevel@tonic-gateextern	char	*failsafe;	/* $FAILSAFE */
3707c478bdstevel@tonic-gateextern	int	file_size;
3717c478bdstevel@tonic-gateextern	int	flge;		/* 1 ==> 'e' option specified */
3727c478bdstevel@tonic-gateextern  int     flgE;		/* 1 ==> 'E' option specified */
3737c478bdstevel@tonic-gateextern	int	flgF;		/* 1 ==> Installing/Removing  Forwarding */
3747c478bdstevel@tonic-gateextern	int	flgf;		/* 1 ==> 'f' option specified */
3757c478bdstevel@tonic-gateextern	int	flgh;		/* 1 ==> 'h' option specified */
3767c478bdstevel@tonic-gateextern	int	flgm;
3777c478bdstevel@tonic-gateextern	int	flgp;		/* 1 ==> 'p' option specified */
3787c478bdstevel@tonic-gateextern	int	flgP;		/* 1 ==> 'P' option specified */
3797c478bdstevel@tonic-gateextern	int	flgr;		/* 1 ==> 'r' option -- print in fifo order */
3807c478bdstevel@tonic-gateextern	int	flgt;		/* 1 ==> 't' option -- add To: line to letter */
3817c478bdstevel@tonic-gateextern	int	flgT;		/* 1 ==> 'T' option specified */
3827c478bdstevel@tonic-gateextern	int	flgw;		/* 1 ==> 'w' option specified */
3837c478bdstevel@tonic-gateextern	int	fnuhdrtype;	/* type of first non-UNIX header line */
3847c478bdstevel@tonic-gateextern	char	forwmsg[];	/* " forwarded by %s" */
3857c478bdstevel@tonic-gateextern	char	frwlmsg[];	/* "Forwarding loop detected in mailfile" */
3867c478bdstevel@tonic-gateextern	char	fromS[1024];	/* stored here by sendmail for sendsurg */
3877c478bdstevel@tonic-gateextern	char	fromU[1024];	/* stored here by sendmail for sendsurg */
3887c478bdstevel@tonic-gateextern	char	frwrd[];	/* forwarding sentinel */
3897c478bdstevel@tonic-gateextern	char	fwdFrom[1024];
3907c478bdstevel@tonic-gateextern	int	goerr;		/* counts parsing errors */
3917c478bdstevel@tonic-gateextern	struct	group *grpptr;	/* pointer to struct group */
3927c478bdstevel@tonic-gateextern	struct hdrlines hdrlines[H_CONT];
3937c478bdstevel@tonic-gateextern	struct hdr header[];	/* H_* #define's used to index into array */
3947c478bdstevel@tonic-gateextern	char	*help[];
3957c478bdstevel@tonic-gateextern	char	*hmbox;		/* pointer to $HOME/mbox */
3967c478bdstevel@tonic-gateextern	char	*hmdead;	/* pointer to $HOME/dead.letter */
3977c478bdstevel@tonic-gateextern	char	*home;		/* pointer to $HOME */
3987c478bdstevel@tonic-gateextern	time_t	iop;
3997c478bdstevel@tonic-gateextern	int	interactive;	/* 1 says user is interactive */
4007c478bdstevel@tonic-gateextern	int	ismail;		/* default to program=mail */
4017c478bdstevel@tonic-gateextern  int     deliverflag;     /* -d flag, bypass sendmail and go to mbox */
4027c478bdstevel@tonic-gateextern  int     fromflag;       /* -f from_user while sending */
4037c478bdstevel@tonic-gateextern	int	keepdbgfile;	/* does debug file get deleted at end? */
4047c478bdstevel@tonic-gateextern	struct let let[MAXLET];
4057c478bdstevel@tonic-gateextern	char	*lettmp;	/* pointer to tmp filename */
4067c478bdstevel@tonic-gateextern	char	lfil[MAXFILENAME];
4077c478bdstevel@tonic-gateextern	char	line[LSIZE];	/* holds a line of a letter in many places */
4087c478bdstevel@tonic-gateextern	char	*mailfile;	/* pointer to mailfile */
4097c478bdstevel@tonic-gateextern	char	mailcnfg[];	/* /etc/mail/mailcnfg */
4107c478bdstevel@tonic-gateextern	char	maildir[];	/* directory for mail files */
4117c478bdstevel@tonic-gateextern	gid_t	mailgrp;	/* numeric id of group 'mail' */
4127c478bdstevel@tonic-gateextern	char	mailsave[];	/* dir for save files */
4137c478bdstevel@tonic-gateextern	char	*mailsurr;	/* surrogate file name */
4147c478bdstevel@tonic-gateextern	FILE	*malf;		/* File pointer for mailfile */
4157c478bdstevel@tonic-gateextern	int	maxerr;		/* largest value of error */
4167c478bdstevel@tonic-gateextern	char	mbox[];		/* name for mbox */
4177c478bdstevel@tonic-gateextern	uid_t	mf_uid;		/* uid of user's mailfile */
4187c478bdstevel@tonic-gateextern	gid_t	mf_gid;		/* gid of user's mailfile */
4197c478bdstevel@tonic-gateextern	char	*msgtype;
4207c478bdstevel@tonic-gateextern	char	my_name[1024];	/* user's name who invoked this command */
4217c478bdstevel@tonic-gateextern	char	from_user[1024];/* name of user mail's from, used w/ -f */
4227c478bdstevel@tonic-gateextern	uid_t	my_euid;	/* user's euid */
4237c478bdstevel@tonic-gateextern	gid_t	my_egid;	/* user's egid */
4247c478bdstevel@tonic-gateextern	uid_t	my_uid;		/* user's uid */
4257c478bdstevel@tonic-gateextern	gid_t	my_gid;		/* user's gid */
4267c478bdstevel@tonic-gateextern	int	nlet;		/* current number of letters in mailfile */
4277c478bdstevel@tonic-gateextern	int	onlet;		/* number of letters in mailfile at startup*/
4287c478bdstevel@tonic-gateextern	int	optcnt;		/* Number of options specified */
4297c478bdstevel@tonic-gateextern	int	orig_aff;	/* orig. msg. contained H_AFWDFROM lines */
4307c478bdstevel@tonic-gateextern	int	orig_dbglvl;	/* argument to -x invocation option */
4317c478bdstevel@tonic-gateextern	int	orig_rcv;	/* orig. msg. contained H_RECEIVED lines */
4327c478bdstevel@tonic-gateextern	int	orig_tcopy;	/* orig. msg. contained H_TCOPY lines */
4337c478bdstevel@tonic-gateextern	struct	passwd *pwd;	/* holds passwd entry for this user */
4347c478bdstevel@tonic-gateextern	int	pflg;		/* binary message display override flag */
4357c478bdstevel@tonic-gateextern	int	Pflg;		/* Selective display flag; 1 ==> display all */
4367c478bdstevel@tonic-gateextern	char	*program;	/* program name */
4377c478bdstevel@tonic-gateextern	int	rcvbytecnt;     /* Total bytes of Received: info in msg. */
4387c478bdstevel@tonic-gateextern	int	Drcvbytecnt;    /* Hold rcvbytecnt when sending Del. Notif. */
4397c478bdstevel@tonic-gateextern	char	*recipname;	/* full recipient name/address */
4407c478bdstevel@tonic-gateextern	int	replying;	/* 1 says we are replying to a letter */
4417c478bdstevel@tonic-gateextern	char	RFC822datestring[60];/* Date in RFC822 date format */
4427c478bdstevel@tonic-gateextern	char	rmtmsg[];	/* "remote from %s" */
4437c478bdstevel@tonic-gateextern	char	Rpath[1024];	/* return path to sender of message */
4447c478bdstevel@tonic-gateextern	char	rtrnmsg[];	/* "UNDELIVERABLE MAIL being returned by %s" */
4457c478bdstevel@tonic-gateextern	int	sav_errno;
4467c478bdstevel@tonic-gateextern	char	savefile[MAXFILENAME];	/* holds filename of save file */
4477c478bdstevel@tonic-gateextern	void	(*saveint)(int);
4487c478bdstevel@tonic-gateextern	char	*seldisp[];
4497c478bdstevel@tonic-gateextern	int	sending;	/* TRUE==>sending mail; FALSE==>printing mail */
4507c478bdstevel@tonic-gateextern	char	m_sendto[1024];
4517c478bdstevel@tonic-gateextern	jmp_buf	sjbuf;
4527c478bdstevel@tonic-gateextern	int	surg_rc;	/* exit code of surrogate command */
4537c478bdstevel@tonic-gateextern	t_surrfile *surrfile;	/* the compiled surrogate file */
4547c478bdstevel@tonic-gateextern	int	surr_len;	/* # entries in surrogate file */
4557c478bdstevel@tonic-gateextern	char	*SURRcmdstr;	/* save in case of FAILURE */
4567c478bdstevel@tonic-gateextern	FILE	*SURRerrfile;	/* stderr from surrogate in case of failure */
4577c478bdstevel@tonic-gateextern	char	*thissys;	/* Holds name of the system we are on */
4587c478bdstevel@tonic-gateextern	FILE	*tmpf;		/* file pointer for temporary files */
4597c478bdstevel@tonic-gateextern	mode_t	umsave;
4607c478bdstevel@tonic-gateextern	struct	utsname utsn;
4617c478bdstevel@tonic-gateextern	struct utimbuf *utimep;
4627c478bdstevel@tonic-gateextern	char	uval[1024];
4647c478bdstevel@tonic-gate#ifdef NOTDEF
4657c478bdstevel@tonic-gate#ifdef sun
4667c478bdstevel@tonic-gate#define _NFILE getdtablesize()
4687c478bdstevel@tonic-gate#endif /* NOTDEF */
4707c478bdstevel@tonic-gate#endif /* _MAIL_H */