10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*13093SRoger.Faulkner@Oracle.COM * Common Development and Distribution License (the "License"). 6*13093SRoger.Faulkner@Oracle.COM * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 21*13093SRoger.Faulkner@Oracle.COM 22373Sceastha /* 23*13093SRoger.Faulkner@Oracle.COM * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved. 24373Sceastha */ 25373Sceastha 260Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 270Sstevel@tonic-gate /* All Rights Reserved */ 280Sstevel@tonic-gate 290Sstevel@tonic-gate #ifndef _MAIL_H 300Sstevel@tonic-gate #define _MAIL_H 310Sstevel@tonic-gate 320Sstevel@tonic-gate /* 330Sstevel@tonic-gate * All global externs defined here. All variables are initialized 340Sstevel@tonic-gate * in init.c 350Sstevel@tonic-gate * 360Sstevel@tonic-gate * !!!!!IF YOU CHANGE (OR ADD) IT HERE, DO IT THERE ALSO !!!!!!!! 370Sstevel@tonic-gate * 380Sstevel@tonic-gate */ 390Sstevel@tonic-gate #include <errno.h> 400Sstevel@tonic-gate #include <fcntl.h> 410Sstevel@tonic-gate #include <stdio.h> 420Sstevel@tonic-gate #include <ctype.h> 430Sstevel@tonic-gate #include <sys/types.h> 440Sstevel@tonic-gate #include <errno.h> 450Sstevel@tonic-gate #include <pwd.h> 460Sstevel@tonic-gate #include <signal.h> 470Sstevel@tonic-gate #include <string.h> 480Sstevel@tonic-gate #include <grp.h> 490Sstevel@tonic-gate /* The following is a kludge to allow for inconsistent header files in SVR4 */ 500Sstevel@tonic-gate #define _CLOCK_T 510Sstevel@tonic-gate #include <time.h> 520Sstevel@tonic-gate #include <sys/stat.h> 530Sstevel@tonic-gate #include <setjmp.h> 540Sstevel@tonic-gate #include <sys/utsname.h> 550Sstevel@tonic-gate #include <limits.h> 560Sstevel@tonic-gate 570Sstevel@tonic-gate #ifdef SVR3 580Sstevel@tonic-gate struct utimbuf { 590Sstevel@tonic-gate time_t actime; 600Sstevel@tonic-gate time_t modtime; 610Sstevel@tonic-gate }; 620Sstevel@tonic-gate #else 630Sstevel@tonic-gate # include <utime.h> 640Sstevel@tonic-gate #endif 650Sstevel@tonic-gate #include "libmail.h" 660Sstevel@tonic-gate 670Sstevel@tonic-gate /* The following typedefs must be used in SVR4 */ 680Sstevel@tonic-gate #ifdef SVR3 690Sstevel@tonic-gate # ifndef sun 700Sstevel@tonic-gate typedef int gid_t; 710Sstevel@tonic-gate typedef int uid_t; 720Sstevel@tonic-gate # endif 730Sstevel@tonic-gate typedef int pid_t; 740Sstevel@tonic-gate #endif 750Sstevel@tonic-gate 760Sstevel@tonic-gate #define CHILD 0 770Sstevel@tonic-gate #define SAME 0 780Sstevel@tonic-gate 790Sstevel@tonic-gate #define BELL 07 800Sstevel@tonic-gate 810Sstevel@tonic-gate # define PIPER "/usr/lib/mail/mail_pipe" 820Sstevel@tonic-gate 830Sstevel@tonic-gate #define SENDMAIL "/usr/lib/sendmail" 840Sstevel@tonic-gate 850Sstevel@tonic-gate #define CERROR -1 860Sstevel@tonic-gate #define CSUCCESS 0 870Sstevel@tonic-gate 880Sstevel@tonic-gate #define TRUE 1 890Sstevel@tonic-gate #define FALSE 0 900Sstevel@tonic-gate 910Sstevel@tonic-gate #define HEAD 1 920Sstevel@tonic-gate #define TAIL 0 930Sstevel@tonic-gate 940Sstevel@tonic-gate #define REAL 1 950Sstevel@tonic-gate #define DEFAULT 0 960Sstevel@tonic-gate 970Sstevel@tonic-gate /* findSurg() return values */ 980Sstevel@tonic-gate #define NOMATCH -1 990Sstevel@tonic-gate #define DELIVER 0 1000Sstevel@tonic-gate #define POSTDELIVER 1 1010Sstevel@tonic-gate #define DENY 2 1020Sstevel@tonic-gate #define TRANSLATE 3 1030Sstevel@tonic-gate 1040Sstevel@tonic-gate /* sendsurg() return values */ 1050Sstevel@tonic-gate #define FAILURE 0 1060Sstevel@tonic-gate #define CONTINUE 1 1070Sstevel@tonic-gate #define SUCCESS 2 1080Sstevel@tonic-gate /* TRANSLATE 3 */ 1090Sstevel@tonic-gate 1100Sstevel@tonic-gate #define HDRSIZ 1024 /* maximum length of header line */ 1110Sstevel@tonic-gate 1120Sstevel@tonic-gate #define E_FLGE 1 /* flge error */ 1130Sstevel@tonic-gate #define E_FLGE_OM 2 /* flgE error, mail present but already accessed */ 1140Sstevel@tonic-gate #define E_REMOTE 1 /* unknown remote */ 1150Sstevel@tonic-gate #define E_FILE 2 /* file error */ 1160Sstevel@tonic-gate #define E_SPACE 3 /* no space */ 1170Sstevel@tonic-gate #define E_FRWD 4 /* cannot forward */ 1180Sstevel@tonic-gate #define E_SYNTAX 5 /* syntax error */ 1190Sstevel@tonic-gate #define E_FRWL 6 /* forwarding loop */ 1200Sstevel@tonic-gate #define E_SNDR 7 /* invalid sender */ 1210Sstevel@tonic-gate #define E_USER 8 /* invalid user */ 1220Sstevel@tonic-gate #define E_FROM 9 /* too many From lines */ 1230Sstevel@tonic-gate #define E_PERM 10 /* bad permissions */ 1240Sstevel@tonic-gate #define E_MBOX 11 /* mbox problem */ 1250Sstevel@tonic-gate #define E_TMP 12 /* temporary file problem */ 1260Sstevel@tonic-gate #define E_DEAD 13 /* Cannot create dead.letter */ 1270Sstevel@tonic-gate #define E_UNBND 14 /* Unbounded forwarding */ 1280Sstevel@tonic-gate #define E_LOCK 15 /* cannot create lock file */ 1290Sstevel@tonic-gate #define E_GROUP 16 /* no group id of 'mail' */ 1300Sstevel@tonic-gate #define E_MEM 17 /* malloc failure */ 1310Sstevel@tonic-gate #define E_FORK 18 /* could not fork */ 1320Sstevel@tonic-gate #define E_PIPE 19 /* could not pipe */ 1330Sstevel@tonic-gate #define E_OWNR 20 /* invoker does not own mailfile */ 1340Sstevel@tonic-gate #define E_DENY 21 /* permission denied by mailsurr file */ 1350Sstevel@tonic-gate #define E_SURG 22 /* surrogate command failed - rc != 0 || 99 */ 1360Sstevel@tonic-gate 1370Sstevel@tonic-gate #define H_AFWDCNT 1 /* "Auto-Forward-Count:" */ 1380Sstevel@tonic-gate #define H_AFWDFROM 2 /* "Auto-Forwarded-From:" */ 1390Sstevel@tonic-gate #define H_CLEN 3 /* "Content-Length:" */ 1400Sstevel@tonic-gate #define H_CTYPE 4 /* "Content-Type:" */ 1410Sstevel@tonic-gate #define H_DATE 5 /* "Date:" */ 1420Sstevel@tonic-gate #define H_DEFOPTS 6 /* "Default-Options:" */ 1430Sstevel@tonic-gate #define H_EOH 7 /* "End-of-Header:" */ 1440Sstevel@tonic-gate #define H_FROM 8 /* "From " */ 1450Sstevel@tonic-gate #define H_FROM1 9 /* ">From " */ 1460Sstevel@tonic-gate #define H_FROM2 10 /* "From: " */ 1470Sstevel@tonic-gate #define H_MIMEVERS 11 /* "MIME-Version:" */ 1480Sstevel@tonic-gate #define H_MTSID 12 /* "MTS-Message-ID:" */ 1490Sstevel@tonic-gate #define H_MTYPE 13 /* "Message-Type:" */ 1500Sstevel@tonic-gate #define H_MVERS 14 /* "Message-Version:" */ 1510Sstevel@tonic-gate #define H_MSVC 15 /* "Message-Service:" */ 1520Sstevel@tonic-gate #define H_RECEIVED 16 /* "Received:" */ 1530Sstevel@tonic-gate #define H_RVERS 17 /* "Report-Version:" */ 1540Sstevel@tonic-gate #define H_SUBJ 18 /* "Subject:" */ 1550Sstevel@tonic-gate #define H_TO 19 /* "To:" */ 1560Sstevel@tonic-gate #define H_TCOPY 20 /* ">To:" */ 1570Sstevel@tonic-gate #define H_TROPTS 21 /* "Transport-Options:" */ 1580Sstevel@tonic-gate #define H_UAID 22 /* "UA-Content-ID:" */ 1590Sstevel@tonic-gate #define H_DAFWDFROM 23 /* Hold A-F-F when sending Del. Notf. */ 1600Sstevel@tonic-gate #define H_DTCOPY 24 /* Hold ">To:" when sending Del. Notf.*/ 1610Sstevel@tonic-gate #define H_DRECEIVED 25 /* Hold Rcvd: when sending Del. Notf.*/ 1620Sstevel@tonic-gate #define H_CONT 26 /* Continuation of previous line */ 1630Sstevel@tonic-gate #define H_NAMEVALUE 27 /* unrecognized "name: value" hdr line*/ 1640Sstevel@tonic-gate 1650Sstevel@tonic-gate /* MTA Transport Options */ 1660Sstevel@tonic-gate #define DELIVERY 001 1670Sstevel@tonic-gate #define NODELIVERY 002 1680Sstevel@tonic-gate #define REPORT 010 1690Sstevel@tonic-gate #define RETURN 020 1700Sstevel@tonic-gate #define IGNORE 040 1710Sstevel@tonic-gate 1720Sstevel@tonic-gate /* 1730Sstevel@tonic-gate copylet flags 1740Sstevel@tonic-gate */ 1750Sstevel@tonic-gate #define REMOTE 1 /* remote mail, add rmtmsg */ 1760Sstevel@tonic-gate #define ORDINARY 2 1770Sstevel@tonic-gate #define ZAP 3 /* zap header and trailing empty line */ 1780Sstevel@tonic-gate #define FORWARD 4 1790Sstevel@tonic-gate #define TTY 5 /* suppress binary to tty */ 1800Sstevel@tonic-gate 1810Sstevel@tonic-gate #define LSIZE (2*BUFSIZ) /* maximum size of a line */ 1820Sstevel@tonic-gate #define MAXLET 1000 /* maximum number of letters */ 1830Sstevel@tonic-gate #define FROMLEVELS 20 /* maxium number of forwards */ 1840Sstevel@tonic-gate #ifdef FILENAME_MAX 1850Sstevel@tonic-gate # define MAXFILENAME FILENAME_MAX /* max length of a filename */ 1860Sstevel@tonic-gate #else 1870Sstevel@tonic-gate # define MAXFILENAME 512 /* max length of a filename */ 1880Sstevel@tonic-gate #endif 1890Sstevel@tonic-gate #define DEADPERM 0600 /* permissions of dead.letter */ 1900Sstevel@tonic-gate 1910Sstevel@tonic-gate #ifndef MFMODE 1920Sstevel@tonic-gate #define MFMODE 0660 /* create mode for `/var/mail' files */ 1930Sstevel@tonic-gate #endif 1940Sstevel@tonic-gate 1950Sstevel@tonic-gate #define A_OK 0 /* return value for access */ 1960Sstevel@tonic-gate #define A_EXECUTE 1 1970Sstevel@tonic-gate #define A_EXIST 0 /* access check for existence */ 1980Sstevel@tonic-gate #define A_WRITE 2 /* access check for write permission */ 1990Sstevel@tonic-gate #define A_READ 4 /* access check for read permission */ 2000Sstevel@tonic-gate 2010Sstevel@tonic-gate # define MAILSURR "/etc/mail/mailsurr" 2020Sstevel@tonic-gate # define MAILCNFG "/etc/mail/mailcnfg" 2030Sstevel@tonic-gate 2040Sstevel@tonic-gate struct hdr { 2050Sstevel@tonic-gate char *tag; 2060Sstevel@tonic-gate int default_display; 2070Sstevel@tonic-gate }; 2080Sstevel@tonic-gate 2090Sstevel@tonic-gate struct hdrs { 2100Sstevel@tonic-gate struct hdrs *next; 2110Sstevel@tonic-gate struct hdrs *prev; 2120Sstevel@tonic-gate struct hdrs *cont; /* Continuation lines */ 2130Sstevel@tonic-gate char value[HDRSIZ+1]; 2140Sstevel@tonic-gate }; 2150Sstevel@tonic-gate 2160Sstevel@tonic-gate struct hdrlines { 2170Sstevel@tonic-gate struct hdrs *head; 2180Sstevel@tonic-gate struct hdrs *tail; 2190Sstevel@tonic-gate }; 2200Sstevel@tonic-gate 2210Sstevel@tonic-gate typedef struct recip { 2220Sstevel@tonic-gate struct recip *next; 2230Sstevel@tonic-gate char *name; 2240Sstevel@tonic-gate } recip; 2250Sstevel@tonic-gate 2260Sstevel@tonic-gate typedef struct reciplist { 2270Sstevel@tonic-gate recip *last_recip; 2280Sstevel@tonic-gate recip recip_list; 2290Sstevel@tonic-gate } reciplist; 2300Sstevel@tonic-gate 2310Sstevel@tonic-gate struct let { 2320Sstevel@tonic-gate long adr; /* offset in mailfile of letter n */ 2330Sstevel@tonic-gate char change; /* disposition status of letter n */ 2340Sstevel@tonic-gate char text; /* 1 ==> text content, 0 ==> binary content. 2350Sstevel@tonic-gate * This is determined INDEPENDENTLY of what 2360Sstevel@tonic-gate * the Content-type, if present, says... 2370Sstevel@tonic-gate */ 2380Sstevel@tonic-gate }; 2390Sstevel@tonic-gate 2400Sstevel@tonic-gate typedef enum t_surrtype 2410Sstevel@tonic-gate { 2420Sstevel@tonic-gate t_eof, t_transport = '<', 2430Sstevel@tonic-gate t_accept = 'a', t_deny = 'd', 2440Sstevel@tonic-gate t_translate = 't', t_postprocess = '>' 2450Sstevel@tonic-gate } t_surrtype; 2460Sstevel@tonic-gate 2470Sstevel@tonic-gate typedef struct t_surrfile 2480Sstevel@tonic-gate { 2490Sstevel@tonic-gate /* originator's regular expression */ 2500Sstevel@tonic-gate string *orig_pattern; 2510Sstevel@tonic-gate char *orig_regex; 2520Sstevel@tonic-gate int orig_reglen; 2530Sstevel@tonic-gate int orig_nbra; 2540Sstevel@tonic-gate 2550Sstevel@tonic-gate /* recipient's regular expression */ 2560Sstevel@tonic-gate string *recip_pattern; 2570Sstevel@tonic-gate char *recip_regex; 2580Sstevel@tonic-gate int recip_reglen; 2590Sstevel@tonic-gate int recip_nbra; 2600Sstevel@tonic-gate 2610Sstevel@tonic-gate /* the type of the command string */ 2620Sstevel@tonic-gate t_surrtype surr_type; 2630Sstevel@tonic-gate 2640Sstevel@tonic-gate int batchsize; /* transport translate postprocess */ 2650Sstevel@tonic-gate char *statlist; /* transport */ 2660Sstevel@tonic-gate string *cmd_left; /* transport translate postprocess */ 2670Sstevel@tonic-gate string *cmd_right; /* transport translate postprocess */ 2680Sstevel@tonic-gate int fullyresolved; /* translate */ 2690Sstevel@tonic-gate } t_surrfile; 2700Sstevel@tonic-gate 271634Sdp #include <stdlib.h> 272634Sdp #include <unistd.h> 2730Sstevel@tonic-gate 2740Sstevel@tonic-gate extern void Dout(char *subname, int level, char *fmt, ...); 2750Sstevel@tonic-gate extern void Tout(char *subname, char *msg, ...); 2760Sstevel@tonic-gate extern int add_recip(reciplist *plist, char *name, int checkdups); 2770Sstevel@tonic-gate extern char *altcompile(const char *instring, char *expbuf, char *endbuf); 2780Sstevel@tonic-gate extern int areforwarding(char *mailfile); 2790Sstevel@tonic-gate extern void cat(char*, char*, char*); 2800Sstevel@tonic-gate extern int ckdlivopts(int tcopy_hdr, int *svopts); 2810Sstevel@tonic-gate extern void cksaved(char *user); 2820Sstevel@tonic-gate extern int cksurg_rc(int surr_num, int rc); 2830Sstevel@tonic-gate extern void clr_hinfo(void); 2840Sstevel@tonic-gate extern void clrhdr(int hdrtype); 2850Sstevel@tonic-gate extern void cmdexpand(int letnum, string *instr, string *outstr, char **lbraslist, char **lbraelist); 2860Sstevel@tonic-gate extern void copyback(void); 2870Sstevel@tonic-gate extern int copylet(int letnum, FILE *f, int type); 2880Sstevel@tonic-gate extern void copymt(FILE *f1, FILE *f2); 2890Sstevel@tonic-gate extern void createmf(uid_t uid, char *file); 2900Sstevel@tonic-gate extern void del_reciplist (reciplist *list); 2910Sstevel@tonic-gate extern void delete(int); 2920Sstevel@tonic-gate extern void doFopt(void); 293373Sceastha extern void done(int) __NORETURN; 2940Sstevel@tonic-gate extern void sig_done(int); 2950Sstevel@tonic-gate extern FILE *doopen(char *file, char *type, int errnum); 2960Sstevel@tonic-gate extern int dowait(pid_t pidval); 2970Sstevel@tonic-gate extern void dumpaff(int type, int htype, int *didafflines, int *suppress, FILE *f); 2980Sstevel@tonic-gate extern void dumprcv(int type, int htype, int *didrcvlines, int *suppress, FILE *f); 2990Sstevel@tonic-gate extern void errmsg(int error_value, char *error_message); 3000Sstevel@tonic-gate extern int findSurg(int letnum, string *execbuf, int flag, int *psurr_num, int *paccept, string *lorig, string *lrecipname); 3010Sstevel@tonic-gate extern void gendeliv(FILE *fp, int rc, char *name); 3020Sstevel@tonic-gate extern int getcomment(char *s, char *q); 3030Sstevel@tonic-gate extern int gethead(int current, int all); 304*13093SRoger.Faulkner@Oracle.COM extern int getaline(char *ptr2line, int max, FILE *f); 3050Sstevel@tonic-gate extern int getnumbr(char *s); 3060Sstevel@tonic-gate extern int getsurr(FILE *fp, string *buf, int firstfield); 3070Sstevel@tonic-gate extern void goback(int letnum); 3080Sstevel@tonic-gate extern int init(void); 3090Sstevel@tonic-gate extern void initsurrfile(void); 3100Sstevel@tonic-gate extern int isheader(char *lp, int *ctfp); 3110Sstevel@tonic-gate extern int isit(char *lp, int type); 3120Sstevel@tonic-gate extern int islocal(char *user, uid_t *puid); 3130Sstevel@tonic-gate extern int istext(unsigned char *s, int size); 3140Sstevel@tonic-gate extern int legal(char *file); 3150Sstevel@tonic-gate extern void lock(char *user); 316373Sceastha extern void madd_recip(reciplist *plist, char *name, int checkdups); 3170Sstevel@tonic-gate extern char *mailcompile(string *pattern, int *retlen, int *retnbra); 3180Sstevel@tonic-gate extern void mkdead(void); 3190Sstevel@tonic-gate extern void mktmp(void); 3200Sstevel@tonic-gate extern void mta_ercode(FILE *outfile); 3210Sstevel@tonic-gate extern void new_reciplist (reciplist *list); 3220Sstevel@tonic-gate extern int notme(char *fto, char *myname); 3230Sstevel@tonic-gate extern int parse(int argc, char **argv); 3240Sstevel@tonic-gate extern int pckaffspot(void); 3250Sstevel@tonic-gate extern int pckrcvspot(void); 3260Sstevel@tonic-gate extern void pickFrom(char *lineptr); 3270Sstevel@tonic-gate extern int pipletr(int letter, char *command, int cltype); 3280Sstevel@tonic-gate extern void poplist (int hdrtype, int where); 3290Sstevel@tonic-gate extern int printhdr (int type, int hdrtype, struct hdrs *hptr, FILE *fp); 3300Sstevel@tonic-gate extern void printmail(void); 3310Sstevel@tonic-gate extern void pushlist(int hdrtype, int where, char *s, int contflg); 3320Sstevel@tonic-gate extern void savdead(void); 3330Sstevel@tonic-gate extern void savehdrs(char *s, int hdrtype); 3340Sstevel@tonic-gate extern int sel_disp (int type, int hdrtype, char *s); 3350Sstevel@tonic-gate extern int sendlist(reciplist *list, int letnum, int level); 3360Sstevel@tonic-gate extern void sendmail(int argc, char **argv); 3370Sstevel@tonic-gate extern int sendsurg(reciplist *plist, int letnum, int flag, int local); 3380Sstevel@tonic-gate extern void setletr(int letter, int status); 3390Sstevel@tonic-gate extern void (*setsig(int i, void(*f)()))(); 3400Sstevel@tonic-gate extern void setsurg_bt(string *st, int *pbatchsize, int *presolved); 3410Sstevel@tonic-gate extern char *setsurg_rc(string *st, int defreal, int *pbatchsize); 3420Sstevel@tonic-gate extern char **setup_exec(char*); 3430Sstevel@tonic-gate extern void stamp(void); 3440Sstevel@tonic-gate extern int systm(char *s); 3450Sstevel@tonic-gate extern void tmperr(void); 3460Sstevel@tonic-gate extern string *tokdef(string *fld, string *tok, char *name); 3470Sstevel@tonic-gate extern int translate(reciplist *plist, char *cmdstr, char *origname); 3480Sstevel@tonic-gate extern void unlock(void); 3490Sstevel@tonic-gate extern int validmsg(int); 3500Sstevel@tonic-gate extern int wtmpf(char *str, int length); 3510Sstevel@tonic-gate 3520Sstevel@tonic-gate extern int ac; /* argument list count */ 3530Sstevel@tonic-gate extern char **av; /* argument list */ 3540Sstevel@tonic-gate extern int affbytecnt; /* Total bytes of Auto-Fwd. info in msg. */ 3550Sstevel@tonic-gate extern int affcnt; /* Number of Auto-Fwd.-From: lines in msg. */ 3560Sstevel@tonic-gate extern int Daffbytecnt; /* Hold affbytecnt when sending Deliv. Notif. */ 3570Sstevel@tonic-gate extern int Daffcnt; /* Hold affcnt when sending Deliv. Notif. */ 3580Sstevel@tonic-gate extern char binmsg[]; 3590Sstevel@tonic-gate extern int changed; /* > 0 says mailfile has changed */ 3600Sstevel@tonic-gate extern char datestring[60]; 3610Sstevel@tonic-gate extern char dbgfname[20]; /* name of file for debugging output */ 3620Sstevel@tonic-gate extern FILE *dbgfp; /* FILE* for debugging output */ 3630Sstevel@tonic-gate extern char dead[]; /* name of dead.letter */ 3640Sstevel@tonic-gate extern int debug; /* Controls debugging level. 0 ==> no debugging */ 3650Sstevel@tonic-gate extern int delflg; 3660Sstevel@tonic-gate extern int dflag; /* 1 says returning unsendable mail */ 3670Sstevel@tonic-gate extern char *errlist[]; 3680Sstevel@tonic-gate extern int error; /* Local value for error */ 3690Sstevel@tonic-gate extern char *failsafe; /* $FAILSAFE */ 3700Sstevel@tonic-gate extern int file_size; 3710Sstevel@tonic-gate extern int flge; /* 1 ==> 'e' option specified */ 3720Sstevel@tonic-gate extern int flgE; /* 1 ==> 'E' option specified */ 3730Sstevel@tonic-gate extern int flgF; /* 1 ==> Installing/Removing Forwarding */ 3740Sstevel@tonic-gate extern int flgf; /* 1 ==> 'f' option specified */ 3750Sstevel@tonic-gate extern int flgh; /* 1 ==> 'h' option specified */ 3760Sstevel@tonic-gate extern int flgm; 3770Sstevel@tonic-gate extern int flgp; /* 1 ==> 'p' option specified */ 3780Sstevel@tonic-gate extern int flgP; /* 1 ==> 'P' option specified */ 3790Sstevel@tonic-gate extern int flgr; /* 1 ==> 'r' option -- print in fifo order */ 3800Sstevel@tonic-gate extern int flgt; /* 1 ==> 't' option -- add To: line to letter */ 3810Sstevel@tonic-gate extern int flgT; /* 1 ==> 'T' option specified */ 3820Sstevel@tonic-gate extern int flgw; /* 1 ==> 'w' option specified */ 3830Sstevel@tonic-gate extern int fnuhdrtype; /* type of first non-UNIX header line */ 3840Sstevel@tonic-gate extern char forwmsg[]; /* " forwarded by %s" */ 3850Sstevel@tonic-gate extern char frwlmsg[]; /* "Forwarding loop detected in mailfile" */ 3860Sstevel@tonic-gate extern char fromS[1024]; /* stored here by sendmail for sendsurg */ 3870Sstevel@tonic-gate extern char fromU[1024]; /* stored here by sendmail for sendsurg */ 3880Sstevel@tonic-gate extern char frwrd[]; /* forwarding sentinel */ 3890Sstevel@tonic-gate extern char fwdFrom[1024]; 3900Sstevel@tonic-gate extern int goerr; /* counts parsing errors */ 3910Sstevel@tonic-gate extern struct group *grpptr; /* pointer to struct group */ 3920Sstevel@tonic-gate extern struct hdrlines hdrlines[H_CONT]; 3930Sstevel@tonic-gate extern struct hdr header[]; /* H_* #define's used to index into array */ 3940Sstevel@tonic-gate extern char *help[]; 3950Sstevel@tonic-gate extern char *hmbox; /* pointer to $HOME/mbox */ 3960Sstevel@tonic-gate extern char *hmdead; /* pointer to $HOME/dead.letter */ 3970Sstevel@tonic-gate extern char *home; /* pointer to $HOME */ 3980Sstevel@tonic-gate extern time_t iop; 3990Sstevel@tonic-gate extern int interactive; /* 1 says user is interactive */ 4000Sstevel@tonic-gate extern int ismail; /* default to program=mail */ 4010Sstevel@tonic-gate extern int deliverflag; /* -d flag, bypass sendmail and go to mbox */ 4020Sstevel@tonic-gate extern int fromflag; /* -f from_user while sending */ 4030Sstevel@tonic-gate extern int keepdbgfile; /* does debug file get deleted at end? */ 4040Sstevel@tonic-gate extern struct let let[MAXLET]; 4050Sstevel@tonic-gate extern char *lettmp; /* pointer to tmp filename */ 4060Sstevel@tonic-gate extern char lfil[MAXFILENAME]; 4070Sstevel@tonic-gate extern char line[LSIZE]; /* holds a line of a letter in many places */ 4080Sstevel@tonic-gate extern char *mailfile; /* pointer to mailfile */ 4090Sstevel@tonic-gate extern char mailcnfg[]; /* /etc/mail/mailcnfg */ 4100Sstevel@tonic-gate extern char maildir[]; /* directory for mail files */ 4110Sstevel@tonic-gate extern gid_t mailgrp; /* numeric id of group 'mail' */ 4120Sstevel@tonic-gate extern char mailsave[]; /* dir for save files */ 4130Sstevel@tonic-gate extern char *mailsurr; /* surrogate file name */ 4140Sstevel@tonic-gate extern FILE *malf; /* File pointer for mailfile */ 4150Sstevel@tonic-gate extern int maxerr; /* largest value of error */ 4160Sstevel@tonic-gate extern char mbox[]; /* name for mbox */ 4170Sstevel@tonic-gate extern uid_t mf_uid; /* uid of user's mailfile */ 4180Sstevel@tonic-gate extern gid_t mf_gid; /* gid of user's mailfile */ 4190Sstevel@tonic-gate extern char *msgtype; 4200Sstevel@tonic-gate extern char my_name[1024]; /* user's name who invoked this command */ 4210Sstevel@tonic-gate extern char from_user[1024];/* name of user mail's from, used w/ -f */ 4220Sstevel@tonic-gate extern uid_t my_euid; /* user's euid */ 4230Sstevel@tonic-gate extern gid_t my_egid; /* user's egid */ 4240Sstevel@tonic-gate extern uid_t my_uid; /* user's uid */ 4250Sstevel@tonic-gate extern gid_t my_gid; /* user's gid */ 4260Sstevel@tonic-gate extern int nlet; /* current number of letters in mailfile */ 4270Sstevel@tonic-gate extern int onlet; /* number of letters in mailfile at startup*/ 4280Sstevel@tonic-gate extern int optcnt; /* Number of options specified */ 4290Sstevel@tonic-gate extern int orig_aff; /* orig. msg. contained H_AFWDFROM lines */ 4300Sstevel@tonic-gate extern int orig_dbglvl; /* argument to -x invocation option */ 4310Sstevel@tonic-gate extern int orig_rcv; /* orig. msg. contained H_RECEIVED lines */ 4320Sstevel@tonic-gate extern int orig_tcopy; /* orig. msg. contained H_TCOPY lines */ 4330Sstevel@tonic-gate extern struct passwd *pwd; /* holds passwd entry for this user */ 4340Sstevel@tonic-gate extern int pflg; /* binary message display override flag */ 4350Sstevel@tonic-gate extern int Pflg; /* Selective display flag; 1 ==> display all */ 4360Sstevel@tonic-gate extern char *program; /* program name */ 4370Sstevel@tonic-gate extern int rcvbytecnt; /* Total bytes of Received: info in msg. */ 4380Sstevel@tonic-gate extern int Drcvbytecnt; /* Hold rcvbytecnt when sending Del. Notif. */ 4390Sstevel@tonic-gate extern char *recipname; /* full recipient name/address */ 4400Sstevel@tonic-gate extern int replying; /* 1 says we are replying to a letter */ 4410Sstevel@tonic-gate extern char RFC822datestring[60];/* Date in RFC822 date format */ 4420Sstevel@tonic-gate extern char rmtmsg[]; /* "remote from %s" */ 4430Sstevel@tonic-gate extern char Rpath[1024]; /* return path to sender of message */ 4440Sstevel@tonic-gate extern char rtrnmsg[]; /* "UNDELIVERABLE MAIL being returned by %s" */ 4450Sstevel@tonic-gate extern int sav_errno; 4460Sstevel@tonic-gate extern char savefile[MAXFILENAME]; /* holds filename of save file */ 4470Sstevel@tonic-gate extern void (*saveint)(int); 4480Sstevel@tonic-gate extern char *seldisp[]; 4490Sstevel@tonic-gate extern int sending; /* TRUE==>sending mail; FALSE==>printing mail */ 4500Sstevel@tonic-gate extern char m_sendto[1024]; 4510Sstevel@tonic-gate extern jmp_buf sjbuf; 4520Sstevel@tonic-gate extern int surg_rc; /* exit code of surrogate command */ 4530Sstevel@tonic-gate extern t_surrfile *surrfile; /* the compiled surrogate file */ 4540Sstevel@tonic-gate extern int surr_len; /* # entries in surrogate file */ 4550Sstevel@tonic-gate extern char *SURRcmdstr; /* save in case of FAILURE */ 4560Sstevel@tonic-gate extern FILE *SURRerrfile; /* stderr from surrogate in case of failure */ 4570Sstevel@tonic-gate extern char *thissys; /* Holds name of the system we are on */ 4580Sstevel@tonic-gate extern FILE *tmpf; /* file pointer for temporary files */ 4590Sstevel@tonic-gate extern mode_t umsave; 4600Sstevel@tonic-gate extern struct utsname utsn; 4610Sstevel@tonic-gate extern struct utimbuf *utimep; 4620Sstevel@tonic-gate extern char uval[1024]; 4630Sstevel@tonic-gate 4640Sstevel@tonic-gate #ifdef NOTDEF 4650Sstevel@tonic-gate #ifdef sun 4660Sstevel@tonic-gate #define _NFILE getdtablesize() 4670Sstevel@tonic-gate #endif 4680Sstevel@tonic-gate #endif /* NOTDEF */ 4690Sstevel@tonic-gate 4700Sstevel@tonic-gate #endif /* _MAIL_H */ 471