xref: /titanic_44/usr/src/cmd/sendmail/include/sendmail/sendmail.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1 /*
2  * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
3  *	All rights reserved.
4  * Copyright (c) 1983, 1995-1997 Eric P. Allman.  All rights reserved.
5  * Copyright (c) 1988, 1993
6  *	The Regents of the University of California.  All rights reserved.
7  *
8  * By using this file, you agree to the terms and conditions set
9  * forth in the LICENSE file which can be found at the top level of
10  * the sendmail distribution.
11  *
12  *
13  *	$Id: sendmail.h,v 8.68 2002/07/01 22:18:53 gshapiro Exp $
14  */
15 
16 #pragma ident	"%Z%%M%	%I%	%E% SMI"
17 
18 /*
19 **  SENDMAIL.H -- Global definitions for sendmail.
20 */
21 
22 #include <stdio.h>
23 #include <sm/bitops.h>
24 #include <sm/io.h>
25 #include <sm/string.h>
26 #include "conf.h"
27 
28 /**********************************************************************
29 **  Table sizes, etc....
30 **	There shouldn't be much need to change these....
31 **********************************************************************/
32 #ifndef MAXMAILERS
33 # define MAXMAILERS	25	/* maximum mailers known to system */
34 #endif /* ! MAXMAILERS */
35 
36 /*
37 **  Flags passed to safefile/safedirpath.
38 */
39 
40 #define SFF_ANYFILE	0L		/* no special restrictions */
41 #define SFF_MUSTOWN	0x00000001L	/* user must own this file */
42 #define SFF_NOSLINK	0x00000002L	/* file cannot be a symbolic link */
43 #define SFF_ROOTOK	0x00000004L	/* ok for root to own this file */
44 #define SFF_RUNASREALUID 0x00000008L	/* if no ctladdr, run as real uid */
45 #define SFF_NOPATHCHECK	0x00000010L	/* don't bother checking dir path */
46 #define SFF_SETUIDOK	0x00000020L	/* set-user-ID files are ok */
47 #define SFF_CREAT	0x00000040L	/* ok to create file if necessary */
48 #define SFF_REGONLY	0x00000080L	/* regular files only */
49 #define SFF_SAFEDIRPATH	0x00000100L	/* no writable directories allowed */
50 #define SFF_NOHLINK	0x00000200L	/* file cannot have hard links */
51 #define SFF_NOWLINK	0x00000400L	/* links only in non-writable dirs */
52 #define SFF_NOGWFILES	0x00000800L	/* disallow world writable files */
53 #define SFF_NOWWFILES	0x00001000L	/* disallow group writable files */
54 #define SFF_OPENASROOT	0x00002000L	/* open as root instead of real user */
55 #define SFF_NOLOCK	0x00004000L	/* don't lock the file */
56 #define SFF_NOGRFILES	0x00008000L	/* disallow g readable files */
57 #define SFF_NOWRFILES	0x00010000L	/* disallow o readable files */
58 #define SFF_NOTEXCL	0x00020000L	/* creates don't need to be exclusive */
59 #define SFF_EXECOK	0x00040000L	/* executable files are ok (E_SM_ISEXEC) */
60 #define SFF_NBLOCK	0x00080000L	/* use a non-blocking lock */
61 #define SFF_NORFILES	(SFF_NOGRFILES|SFF_NOWRFILES)
62 
63 /* pseudo-flags */
64 #define SFF_NOLINK	(SFF_NOHLINK|SFF_NOSLINK)
65 
66 /* functions */
67 extern int	safefile __P((char *, UID_T, GID_T, char *, long, int, struct stat *));
68 extern int	safedirpath __P((char *, UID_T, GID_T, char *, long, int, int));
69 extern int	safeopen __P((char *, int, int, long));
70 extern SM_FILE_T*safefopen __P((char *, int, int, long));
71 extern int	dfopen __P((char *, int, int, long));
72 extern bool	filechanged __P((char *, int, struct stat *));
73 
74 /*
75 **  DontBlameSendmail options
76 **
77 **	Hopefully nobody uses these.
78 */
79 
80 #define DBS_SAFE					0
81 #define DBS_ASSUMESAFECHOWN				1
82 #define DBS_GROUPWRITABLEDIRPATHSAFE			2
83 #define DBS_GROUPWRITABLEFORWARDFILESAFE		3
84 #define DBS_GROUPWRITABLEINCLUDEFILESAFE		4
85 #define DBS_GROUPWRITABLEALIASFILE			5
86 #define DBS_WORLDWRITABLEALIASFILE			6
87 #define DBS_FORWARDFILEINUNSAFEDIRPATH			7
88 #define DBS_MAPINUNSAFEDIRPATH				8
89 #define DBS_LINKEDALIASFILEINWRITABLEDIR		9
90 #define DBS_LINKEDCLASSFILEINWRITABLEDIR		10
91 #define DBS_LINKEDFORWARDFILEINWRITABLEDIR		11
92 #define DBS_LINKEDINCLUDEFILEINWRITABLEDIR		12
93 #define DBS_LINKEDMAPINWRITABLEDIR			13
94 #define DBS_LINKEDSERVICESWITCHFILEINWRITABLEDIR	14
95 #define DBS_FILEDELIVERYTOHARDLINK			15
96 #define DBS_FILEDELIVERYTOSYMLINK			16
97 #define DBS_WRITEMAPTOHARDLINK				17
98 #define DBS_WRITEMAPTOSYMLINK				18
99 #define DBS_WRITESTATSTOHARDLINK			19
100 #define DBS_WRITESTATSTOSYMLINK				20
101 #define DBS_FORWARDFILEINGROUPWRITABLEDIRPATH		21
102 #define DBS_INCLUDEFILEINGROUPWRITABLEDIRPATH		22
103 #define DBS_CLASSFILEINUNSAFEDIRPATH			23
104 #define DBS_ERRORHEADERINUNSAFEDIRPATH			24
105 #define DBS_HELPFILEINUNSAFEDIRPATH			25
106 #define DBS_FORWARDFILEINUNSAFEDIRPATHSAFE		26
107 #define DBS_INCLUDEFILEINUNSAFEDIRPATHSAFE		27
108 #define DBS_RUNPROGRAMINUNSAFEDIRPATH			28
109 #define DBS_RUNWRITABLEPROGRAM				29
110 #define DBS_INCLUDEFILEINUNSAFEDIRPATH			30
111 #define DBS_NONROOTSAFEADDR				31
112 #define DBS_TRUSTSTICKYBIT				32
113 #define DBS_DONTWARNFORWARDFILEINUNSAFEDIRPATH		33
114 #define DBS_INSUFFICIENTENTROPY				34
115 #define DBS_GROUPREADABLESASLDBFILE			35
116 #define DBS_GROUPWRITABLESASLDBFILE			36
117 #define DBS_GROUPWRITABLEFORWARDFILE			37
118 #define DBS_GROUPWRITABLEINCLUDEFILE			38
119 #define DBS_WORLDWRITABLEFORWARDFILE			39
120 #define DBS_WORLDWRITABLEINCLUDEFILE			40
121 #define DBS_GROUPREADABLEKEYFILE			41
122 #if _FFR_GROUPREADABLEAUTHINFOFILE
123 # define DBS_GROUPREADABLEAUTHINFOFILE			42
124 #endif /* _FFR_GROUPREADABLEAUTHINFOFILE */
125 
126 /* struct defining such things */
127 struct dbsval
128 {
129 	char		*dbs_name;	/* name of DontBlameSendmail flag */
130 	unsigned char	dbs_flag;	/* numeric level */
131 };
132 
133 /* Flags for submitmode */
134 #define SUBMIT_UNKNOWN	0x0000	/* unknown agent type */
135 #define SUBMIT_MTA	0x0001	/* act like a message transfer agent */
136 #define SUBMIT_MSA	0x0002	/* act like a message submission agent */
137 
138