Commit | Line | Data |
---|---|---|
b3cbe40f | 1 | # include <pwd.h> |
96faada8 | 2 | # include "sendmail.h" |
916b3375 | 3 | |
b3cbe40f | 4 | /* |
96faada8 | 5 | ** CONF.C -- Sendmail Configuration Tables. |
b3cbe40f EA |
6 | ** |
7 | ** Defines the configuration of this installation. | |
8 | ** | |
cb590f52 | 9 | ** Compilation Flags: |
cb590f52 EA |
10 | ** V6 -- running on a version 6 system. This determines |
11 | ** whether to define certain routines between | |
12 | ** the two systems. If you are running a funny | |
13 | ** system, e.g., V6 with long tty names, this | |
14 | ** should be checked carefully. | |
b3cbe40f | 15 | ** |
cb590f52 | 16 | ** Configuration Variables: |
1a12c7d6 EA |
17 | ** HdrInfo -- a table describing well-known header fields. |
18 | ** Each entry has the field name and some flags, | |
df960d9b | 19 | ** which are described in sendmail.h. |
74c5fe7c EA |
20 | ** StdTimezone -- name of local timezone in standard time |
21 | ** (V6 only). | |
22 | ** DstTimezone -- name of local timezone in daylight savings | |
23 | ** time (V6 only). | |
9c6d4c70 EA |
24 | ** |
25 | ** Notes: | |
26 | ** I have tried to put almost all the reasonable | |
27 | ** configuration information into the configuration | |
28 | ** file read at runtime. My intent is that anything | |
29 | ** here is a function of the version of UNIX you | |
30 | ** are running, or is really static -- for example | |
31 | ** the headers are a superset of widely used | |
32 | ** protocols. If you find yourself playing with | |
33 | ** this file too much, you may be making a mistake! | |
b3cbe40f EA |
34 | */ |
35 | ||
36 | ||
37 | ||
38 | ||
74c5fe7c | 39 | static char SccsId[] = "@(#)conf.c 3.28 %G%"; |
cb590f52 EA |
40 | |
41 | ||
cb590f52 | 42 | # include <whoami.h> /* definitions of machine id's at berkeley */ |
b3cbe40f | 43 | |
1a12c7d6 EA |
44 | |
45 | /* | |
46 | ** Header info table | |
355a2a04 | 47 | ** Final (null) entry contains the flags used for any other field. |
df960d9b EA |
48 | ** |
49 | ** Not all of these are actually handled specially by sendmail | |
50 | ** at this time. They are included as placeholders, to let | |
51 | ** you know that "someday" I intend to have sendmail do | |
52 | ** something with them. | |
1a12c7d6 EA |
53 | */ |
54 | ||
55 | struct hdrinfo HdrInfo[] = | |
56 | { | |
df960d9b EA |
57 | "date", H_CHECK, M_NEEDDATE, |
58 | "from", H_CHECK, M_NEEDFROM, | |
02b6245d | 59 | "original-from", H_ACHECK, 0, /* internal */ |
df960d9b EA |
60 | "sender", 0, 0, |
61 | "full-name", H_ACHECK, M_FULLNAME, | |
a502a3e7 EA |
62 | "to", H_ADDR, 0, |
63 | "cc", H_ADDR, 0, | |
64 | "bcc", H_ADDR|H_ACHECK, 0, | |
df960d9b EA |
65 | "message-id", H_CHECK, M_MSGID, |
66 | "message", H_EOH, 0, | |
67 | "text", H_EOH, 0, | |
68 | "posted-date", 0, 0, | |
69 | "return-receipt-to", 0, 0, | |
7add9668 EA |
70 | "received-date", H_CHECK, M_LOCAL, |
71 | "received-from", H_CHECK, M_LOCAL, | |
df960d9b EA |
72 | "precedence", 0, 0, |
73 | "via", H_FORCE, 0, | |
74 | NULL, 0, 0, | |
1a12c7d6 | 75 | }; |
15b28570 EA |
76 | |
77 | ||
78 | /* | |
79 | ** ARPANET error message numbers. | |
80 | */ | |
81 | ||
82 | # ifdef NEWFTP | |
83 | /* these are almost all unchecked */ | |
84 | char Arpa_Info[] = "010"; /* arbitrary info: this is WRONG! */ | |
85 | char Arpa_Enter[] = "354"; /* start mail input */ | |
86 | char Arpa_Mmsg[] = "250"; /* mail successful (MAIL cmd) */ | |
87 | char Arpa_Fmsg[] = "250"; /* mail successful (MLFL cmd) */ | |
88 | char Arpa_Syserr[] = "450"; /* some (transient) system error */ | |
89 | char Arpa_Usrerr[] = "550"; /* some (fatal) user error */ | |
90 | # else NEWFTP | |
91 | char Arpa_Info[] = "050"; /* arbitrary info */ | |
92 | char Arpa_Enter[] = "350"; /* start mail input */ | |
93 | char Arpa_Mmsg[] = "256"; /* mail successful (MAIL cmd) */ | |
94 | char Arpa_Fmsg[] = "250"; /* mail successful (MLFL cmd) */ | |
95 | char Arpa_Syserr[] = "455"; /* some (transient) system error */ | |
96 | char Arpa_Usrerr[] = "450"; /* some (fatal) user error */ | |
97 | # endif NEWFTP | |
4e1f4d4b EA |
98 | |
99 | ||
100 | ||
101 | ||
102 | ||
103 | /* | |
104 | ** Location of system files/databases/etc. | |
105 | */ | |
106 | ||
107 | char *AliasFile = "/usr/lib/aliases"; /* alias file */ | |
108 | char *ConfFile = "/usr/lib/sendmail.cf"; /* runtime configuration */ | |
109 | char *StatFile = "/usr/eric/mailstats"; /* statistics summary */ | |
74c5fe7c EA |
110 | |
111 | ||
112 | ||
113 | /* | |
114 | ** V6 system configuration. | |
115 | */ | |
116 | ||
117 | # ifdef V6 | |
118 | char *StdTimezone = "PST"; /* std time timezone */ | |
119 | char *DstTimezone = "PDT"; /* daylight time timezone */ | |
120 | # endif V6 | |
b3cbe40f EA |
121 | \f |
122 | # ifdef V6 | |
123 | /* | |
14e42c2b | 124 | ** TTYNAME -- return name of terminal. |
b3cbe40f EA |
125 | ** |
126 | ** Parameters: | |
14e42c2b | 127 | ** fd -- file descriptor to check. |
b3cbe40f EA |
128 | ** |
129 | ** Returns: | |
14e42c2b EA |
130 | ** pointer to full path of tty. |
131 | ** NULL if no tty. | |
b3cbe40f EA |
132 | ** |
133 | ** Side Effects: | |
134 | ** none. | |
b3cbe40f EA |
135 | */ |
136 | ||
b3cbe40f | 137 | char * |
14e42c2b EA |
138 | ttyname(fd) |
139 | int fd; | |
b3cbe40f | 140 | { |
14e42c2b | 141 | register char tn; |
b3cbe40f | 142 | static char pathn[] = "/dev/ttyx"; |
b3cbe40f EA |
143 | |
144 | /* compute the pathname of the controlling tty */ | |
14e42c2b | 145 | if ((tn = ttyn(fd)) == NULL) |
b3cbe40f EA |
146 | { |
147 | errno = 0; | |
148 | return (NULL); | |
149 | } | |
14e42c2b | 150 | pathn[8] = tn; |
b3cbe40f EA |
151 | return (pathn); |
152 | } | |
153 | \f/* | |
154 | ** FDOPEN -- Open a stdio file given an open file descriptor. | |
155 | ** | |
156 | ** This is included here because it is standard in v7, but we | |
157 | ** need it in v6. | |
158 | ** | |
159 | ** Algorithm: | |
160 | ** Open /dev/null to create a descriptor. | |
161 | ** Close that descriptor. | |
162 | ** Copy the existing fd into the descriptor. | |
163 | ** | |
164 | ** Parameters: | |
165 | ** fd -- the open file descriptor. | |
166 | ** type -- "r", "w", or whatever. | |
167 | ** | |
168 | ** Returns: | |
169 | ** The file descriptor it creates. | |
170 | ** | |
171 | ** Side Effects: | |
172 | ** none | |
173 | ** | |
b3cbe40f EA |
174 | ** Called By: |
175 | ** deliver | |
176 | ** | |
177 | ** Notes: | |
178 | ** The mode of fd must match "type". | |
179 | */ | |
180 | ||
181 | FILE * | |
182 | fdopen(fd, type) | |
183 | int fd; | |
184 | char *type; | |
185 | { | |
186 | register FILE *f; | |
187 | ||
188 | f = fopen("/dev/null", type); | |
29871fef | 189 | (void) close(fileno(f)); |
b3cbe40f EA |
190 | fileno(f) = fd; |
191 | return (f); | |
192 | } | |
193 | \f/* | |
194 | ** INDEX -- Return pointer to character in string | |
195 | ** | |
196 | ** For V7 compatibility. | |
197 | ** | |
198 | ** Parameters: | |
199 | ** s -- a string to scan. | |
200 | ** c -- a character to look for. | |
201 | ** | |
202 | ** Returns: | |
203 | ** If c is in s, returns the address of the first | |
204 | ** instance of c in s. | |
205 | ** NULL if c is not in s. | |
206 | ** | |
207 | ** Side Effects: | |
208 | ** none. | |
b3cbe40f EA |
209 | */ |
210 | ||
211 | index(s, c) | |
212 | register char *s; | |
213 | register char c; | |
214 | { | |
215 | while (*s != '\0') | |
216 | { | |
217 | if (*s++ == c) | |
218 | return (--s); | |
219 | } | |
220 | return (NULL); | |
221 | } | |
222 | # endif V6 | |
14e42c2b EA |
223 | \f/* |
224 | ** TTYPATH -- Get the path of the user's tty | |
b3cbe40f EA |
225 | ** |
226 | ** Returns the pathname of the user's tty. Returns NULL if | |
227 | ** the user is not logged in or if s/he has write permission | |
228 | ** denied. | |
229 | ** | |
230 | ** Parameters: | |
231 | ** none | |
232 | ** | |
233 | ** Returns: | |
234 | ** pathname of the user's tty. | |
235 | ** NULL if not logged in or write permission denied. | |
236 | ** | |
237 | ** Side Effects: | |
238 | ** none. | |
239 | ** | |
240 | ** WARNING: | |
241 | ** Return value is in a local buffer. | |
242 | ** | |
b3cbe40f EA |
243 | ** Called By: |
244 | ** savemail | |
b3cbe40f EA |
245 | */ |
246 | ||
b3cbe40f EA |
247 | # include <sys/stat.h> |
248 | ||
249 | char * | |
250 | ttypath() | |
251 | { | |
252 | struct stat stbuf; | |
253 | register char *pathn; | |
b3cbe40f | 254 | extern char *ttyname(); |
29871fef | 255 | extern char *getlogin(); |
b3cbe40f EA |
256 | |
257 | /* compute the pathname of the controlling tty */ | |
258 | if ((pathn = ttyname(2)) == NULL && (pathn = ttyname(1)) == NULL && (pathn = ttyname(0)) == NULL) | |
259 | { | |
260 | errno = 0; | |
261 | return (NULL); | |
262 | } | |
263 | ||
264 | /* see if we have write permission */ | |
a530c75f | 265 | if (stat(pathn, &stbuf) < 0 || !bitset(02, stbuf.st_mode)) |
b3cbe40f EA |
266 | { |
267 | errno = 0; | |
268 | return (NULL); | |
269 | } | |
270 | ||
271 | /* see if the user is logged in */ | |
272 | if (getlogin() == NULL) | |
273 | return (NULL); | |
274 | ||
275 | /* looks good */ | |
276 | return (pathn); | |
277 | } | |
a530c75f EA |
278 | \f/* |
279 | ** CHECKCOMPAT -- check for From and To person compatible. | |
280 | ** | |
281 | ** This routine can be supplied on a per-installation basis | |
282 | ** to determine whether a person is allowed to send a message. | |
283 | ** This allows restriction of certain types of internet | |
284 | ** forwarding or registration of users. | |
285 | ** | |
286 | ** If the hosts are found to be incompatible, an error | |
287 | ** message should be given using "usrerr" and FALSE should | |
288 | ** be returned. | |
289 | ** | |
46b14b48 EA |
290 | ** 'NoReturn' can be set to suppress the return-to-sender |
291 | ** function; this should be done on huge messages. | |
292 | ** | |
a530c75f EA |
293 | ** Parameters: |
294 | ** to -- the person being sent to. | |
295 | ** | |
296 | ** Returns: | |
297 | ** TRUE -- ok to send. | |
298 | ** FALSE -- not ok. | |
299 | ** | |
300 | ** Side Effects: | |
301 | ** none (unless you include the usrerr stuff) | |
302 | */ | |
303 | ||
304 | bool | |
305 | checkcompat(to) | |
306 | register ADDRESS *to; | |
307 | { | |
46b14b48 EA |
308 | if (to->q_mailer != MN_LOCAL && MsgSize > 100000) |
309 | { | |
310 | usrerr("Message exceeds 100000 bytes"); | |
311 | NoReturn++; | |
312 | return (FALSE); | |
313 | } | |
a530c75f EA |
314 | return (TRUE); |
315 | } |