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