|
|
1.1 root 1: /*
2: **
3: ** Defs.h: header file for rmail/smail.
4: **
5: ** Configuration options for rmail/smail.
6: ** default configuration is:
7: ** full domain name is 'hostname.uucp' (get registered!)
8: ** path file is /usr/lib/uucp/paths.
9: ** no log, no record, use sendmail.
10: **
11: ** You can change these in the next few blocks.
12: **
13: */
14:
15: /*
16: ** @(#)defs.h 2.5 (smail) 9/15/87
17: */
18:
19: #ifndef VERSION
20: #define VERSION _version
21: #endif
22:
23: /* COHERENT is compiler a defined symbol. */
24: #ifdef COHERENT
25: #define off_t long
26: #define GETHOSTNAME
27: #define GETDOMAIN
28: #endif
29:
30: /* #define BSD if system is a Berkeley system */
31:
32: /* #define SENDMAIL "/usr/lib/sendmail" Turn off to use /bin/(l)mail only */
33:
34: #ifdef BSD
35: #define GETHOSTNAME /* use gethostname() */
36: #endif
37:
38: #ifndef GETHOSTNAME
39: #define UNAME /* use uname() */
40: #endif
41:
42: /* if defined, HOSTNAME overrides UNAME and GETHOSTNAME */
43: /* #define HOSTNAME "tsqali" literal name */
44:
45: /* #define HOSTDOMAIN "tsqali.mwc.com" overrides default HOSTNAME.MYDOM */
46:
47: /*
48: * .UUCP here is just for testing, GET REGISTERED in COM, EDU, US, etc.
49: * See INFO.REGISTRY for details.
50: */
51:
52: /* #define MYDOM "mwc.com" literal domain suffix */
53:
54: /*
55: * WARNING: DOMGATE is only for qualified gateways - use caution.
56: * If you don't fully understand it - don't use it!
57: * If you are not completely sure you need it - don't use it!
58: * If you are not prepared to handle all addresses to MYDOM - don't use it!
59: *
60: * if defined, DOMGATE (DOMain GATEway) will cause addresses of the form
61: *
62: * user@MYDOM or MYDOM!user
63: *
64: * (with and without the leading '.' on MYDOM)
65: * to be seen treated simply 'user' - a purely local address.
66: * Then, it is left to the aliasing code to map it back to a
67: * non-local address if necessary.
68: */
69:
70: /* #define DOMGATE Act as Domain Gateway */
71:
72: /*
73: * HIDDENHOSTS allows hosts that serve as domain gateways to hide
74: * the subdomains beneath them. Mail that originates at any of
75: * the hosts in the subdomain will appear to come from the gateway host.
76: * Hence, mail from
77: *
78: * anything.hostdomain!user
79: *
80: * will appear to come from
81: *
82: * hostdomain!user
83: *
84: * A consequence is that return mail to hostdomain!user would need to
85: * be forwarded to the proper subdomain via aliases or other forwarding
86: * facilities.
87: *
88: * If you're using sendmail, then if defined here,
89: * it should be used in ruleset 4 of the sendmail.cf, too.
90: */
91:
92: /*#define HIDDENHOSTS hide subdomains of hostdomain */
93:
94: /*
95: * Mail that would otherwise be undeliverable will be passed to the
96: * aliased SMARTHOST for potential delivery.
97: *
98: * Be sure that the host you specify in your pathalias input knows that you're
99: * using it as a relay, or you might upset somebody when they find out some
100: * other way. If you're using 'foovax' as your relay, and below you have
101: * #define SMARTHOST "smart-host", then the pathalias alias would be:
102: *
103: * smart-host = foovax
104: */
105:
106: #define SMARTHOST "smart-host" /* pathalias alias for relay host */
107:
108: /*
109: ** ALIAS and CASEALIAS are used only if SENDMAIL is NOT defined.
110: ** Sites using sendmail have to let sendmail do the aliasing.
111: ** LOWERLOGNAME maps all local login names into lower case. This
112: ** helps sites who have only upper case send mail to mixed case sites.
113: */
114:
115: #define ALIAS "/usr/lib/mail/aliases" /* location of mail aliases */
116: /*#define CASEALIAS make aliases case sensitive */
117: /*#define LOWERLOGNAME map local logins to lower case */
118:
119: /*
120: * define HOMEALIASES if you want each user to be able to specify
121: * aliases. It must begin with a "/" because this string will be
122: * appended to the value of $HOME.
123: * Added for MWC by La Monte Yarroll, [email protected].
124: */
125:
126: #define HOMEALIASES "/.aliases"
127:
128: /*
129: * defining FULLNAME means that Full Name resolution
130: * will be attempted when necessary.
131: *
132: * the Full Name information will be taken from a
133: * list of {Full Name, address} pairs.
134: * The names in the list must be sorted
135: * without regard to upper/lower case.
136: *
137: * defining DOT_REQD says that the user name must contain a '.' for
138: * the Full Name search to be done.
139: *
140: * All full name searches are case insensitive.
141: *
142: */
143:
144: #define FULLNAME "/usr/lib/mail/fullnames"
145: /* list of Full Name, address pairs */
146:
147: /*#define DOT_REQD Must be [email protected]
148: ** not just [email protected]
149: */
150:
151: /*
152: ** PATHS is name of pathalias file. This is mandatory.
153: ** Define LOG if you want a log of mail. This can be handy for
154: ** debugging and traffic analysis.
155: ** Define RECORD for a copy of all mail. This uses much time and
156: ** space and is only used for extreme debugging cases.
157: */
158:
159: #ifndef PATHS
160: #define PATHS "/usr/lib/mail/paths" /* location of the path database */
161: #endif
162:
163: #define LOG "/usr/spool/uucp/.Log/mail/mail" /* log of uucp mail */
164: /* #define RECORD "/log/mail.log" record of uucp mail */
165:
166: /*
167: ** Mailer options:
168: ** RMAIL is the command to invoke rmail on machine sys.
169: ** RARG is how to insulate metacharacters from RMAIL.
170: ** LMAIL is the command to invoke the local mail transfer agent.
171: ** LARG is how to insulate metacharacters from LMAIL.
172: ** RLARG is LARG with host! on the front - to pass a uux addr to sendmail.
173: ** SENDMAIL selects one of two sets of defines below for either
174: ** using sendmail or /bin/lmail.
175: */
176:
177: #ifndef UUX
178: #define UUX "/usr/bin/uux" /* location of uux command */
179: #endif
180:
181: #ifndef SMAIL
182: #define SMAIL "/bin/smail" /* location of smail command */
183: #endif
184:
185: /*
186: ** command used to retry failed mail, flag is used to set the routing level.
187: */
188: #define VFLAG ((debug == YES)?"-d":((debug == VERBOSE)?"-v":""))
189: #define RETRY(flag) "%s %s %s -f %s ", SMAIL, VFLAG, flag, spoolfile
190:
191: /*
192: ** use the -a if you have it. This sometimes helps failed mail and warning
193: ** messages get back to where the mail originated.
194: **
195: ** some versions of uux can't do '-a' - pick one of the next two definitions
196: */
197:
198: #define RMAIL(flags,from,sys) "%s -a%s %s - %s!rmail",UUX,from,flags,sys /* */
199: /*#define RMAIL(flags,from,sys) "%s %s - %s!rmail",UUX,flags,sys */
200:
201: #define RARG(user) " '(%s)'",user
202: #define RFROM(frm,now,host) "From %s %.24s remote from %s\n",frm,now,host
203:
204: #ifdef SENDMAIL
205:
206: #define HANDLE JUSTUUCP /* see HANDLE definition below */
207: #define ROUTING JUSTDOMAIN /* see ROUTING definition below */
208:
209: #define LMAIL(frm,sys) "%s -em -f%s",SENDMAIL,frm
210: #define LARG(user) " '%s'",postmaster(user)
211: #define RLARG(sys,frm) " '%s!%s'",sys,frm
212: #define LFROM(frm,now,host) "From %s %.24s\n",frm,now
213:
214: #else
215:
216: #define HANDLE ALL
217: #define ROUTING ALWAYS
218:
219: #ifdef BSD
220: #define LMAIL(frm,sys) "/bin/mail" /* BSD local delivery agent */
221: #else
222: #define LMAIL(frm,sys) "/bin/lmail" /* SV local delivery agent */
223: #endif
224:
225: #define LARG(user) " '%s'",postmaster(user)
226: #define RLARG(sys,frm) " '%s!%s'",sys,frm
227: #define LFROM(frm,now,host) "From %s %.24s\n",frm,now
228:
229: #endif
230:
231: /*
232: ** The following definitions affect the queueing algorithm for uux.
233: **
234: ** DEFQUEUE if defined the default is to queue uux mail
235: **
236: ** QUEUECOST remote mail with a cost of less than QUEUECOST
237: ** will be handed to uux for immediate delivery.
238: **
239: ** MAXNOQUEUE don't allow more than 'n' immediate delivery
240: ** jobs to be started on a single invocation of smail.
241: **
242: ** GETCOST if defined, the paths file will be searched for
243: ** each address to discover the cost of the route.
244: ** this allows informed decisions about whether to
245: ** use the queue flags when calling uux. The price
246: ** is in the overhead of a paths file search for
247: ** addresses that are not going to be routed.
248: */
249:
250: #define DEFQUEUE /* default is to queue uux jobs */
251:
252: #define QUEUECOST 100 /* deliver immediately if the cost
253: ** is DEDICATED+LOW or better
254: */
255:
256: #define DEFCOST QUEUECOST + 1 /* Default cost value. */
257:
258: #define MAXNOQUEUE 1 /* max UUX_NOQUEUE jobs */
259:
260: #define GETCOST /* search for cost */
261:
262: #define UUX_QUEUE "-r" /* uux flag for queueing */
263: #define UUX_NOQUEUE "" /* uux with immediate delivery */
264:
265: /*
266: ** Normally, all mail destined for the local host is delivered with a single
267: ** call to the local mailer, and all remote mail is delivered with one call
268: ** to the remote mailer for each remote host. This kind of 'batching' saves
269: ** on the cpu overhead.
270: **
271: ** MAXCLEN is used to limit the length of commands that are exec'd by smail.
272: ** This is done to keep other program's buffers from overflowing, or to
273: ** allow for less intelligent commands which can take only one argument
274: ** at a time (e.g., 4.1 /bin/mail). To disable the batching, set MAXCLEN
275: ** a small value (like 0).
276: */
277:
278: #define MAXCLEN 512 /* longest command allowed (approx.)
279: * this is to keep other's buffers
280: ** from overflowing
281: */
282:
283: /* GATEWAY_NAME should only be used on gateway machines into the .ATT.COM
284: ** domain. Since mail will appear to come from att.ATT.COM, there is no
285: ** way of knowing WHICH gateway it came from. deliver.c was changed
286: ** such that the GATEWAY_NAME was placed in the headers in a non-dangerous
287: ** place so that it could be determined which gateway was used.
288: ** If smail is not being run on a gateway, don't use this definition,
289: **
290: ** T. G. Thompson Thu Apr 7 13:47:36 EDT 1988
291: */
292: /* #define GATEWAY_NAME "att-ih" gateway name other than "att" */
293:
294:
295:
296: /*
297: ** PLEASE DON'T TOUCH THE REST
298: */
299:
300: #define SMLBUF 512 /* small buffer (handle one item) */
301: #define BIGBUF 4096 /* handle lots of items */
302:
303: #define MAXPATH 32 /* number of elements in ! path */
304: #define MAXDOMS 16 /* number of subdomains in . domain */
305: #define MAXARGS 500 /* number of arguments */
306: #define WS " \t" /* white space for paths file */
307: #ifndef NULL
308: #define NULL 0
309: #endif
310:
311: #define DEBUG if (debug==YES) (void) printf
312: #define ADVISE if (debug!=NO) (void) printf
313: #define error(stat,msg,a) { (void) fprintf(stderr, msg, a); exit(stat); }
314: #define lower(c) ( isupper(c) ? c-'A'+'a' : c )
315:
316:
317: enum eform { /* format of addresses */
318: ERROR, /* bad or invalidated format */
319: LOCAL, /* just a local name */
320: DOMAIN, /* user@domain or domain!user */
321: UUCP, /* host!address */
322: ROUTE, /* intermediate form - to be routed */
323: SENT /* sent to a mailer on a previous pass */
324: };
325:
326: enum ehandle { /* what addresses can we handle? (don't kick to LMAIL) */
327: ALL, /* UUCP and DOMAIN addresses */
328: JUSTUUCP, /* UUCP only; set by -l */
329: NONE /* all mail is LOCAL; set by -L */
330: };
331:
332: enum erouting { /* when to route A!B!C!D */
333: JUSTDOMAIN, /* route A if A is a domain */
334: ALWAYS, /* route A always; set by -r */
335: REROUTE /* route C, B, or A (whichever works); set by -R */
336: };
337:
338: enum edebug { /* debug modes */
339: NO, /* normal deliver */
340: VERBOSE, /* talk alot */
341: YES /* talk and don't deliver */
342: };
343:
344: #ifdef BSD
345:
346: #include <strings.h>
347: #include <sysexits.h>
348:
349: #else
350:
351: #include <string.h>
352: #include "sysexits.h"
353: #define index strchr
354: #define rindex strrchr
355:
356: #endif
357: extern void exit(), perror();
358: extern unsigned sleep();
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.