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