|
|
1.1 root 1: #include <stdio.h>
2: #include "mail.h"
3: #include "string.h"
4: #include "message.h"
5: #include "dest.h"
6:
7: /*
8: * Translate the last component of the sender address. If the translation
9: * yields the same address, replace the sender with its last component.
10: */
11: extern int
12: gateway(mp)
13: message *mp;
14: {
15: char *base;
16: dest *dp=NULL;
17: static FILE *fp;
18: extern dest *up_bind();
19: char *sp;
20: char system[128];
21: extern char *thissys;
22:
23: /* first remove all systems equivalent to us */
24: for (base = s_to_c(mp->sender); *base;){
25: sp = strchr(base, '!');
26: if(sp==NULL)
27: break;
28: *sp = '\0';
29: if(lookup(base, "equivlist", &fp, 0, 0)==1){
30: /* found or us, forget this system */
31: *sp='!';
32: base=sp+1;
33: } else {
34: /* no files or system is not found, and not us */
35: *sp='!';
36: break;
37: }
38: }
39:
40: /* punt if this is not a compound address */
41: sp = strrchr(base, '!');
42: if (sp==NULL)
43: goto rebuild;
44: sp++;
45:
46: /* bind the address to a command */
47: d_insert(&dp, d_new(s_copy(sp)));
48: dp->authorized = 1;
49: dp = up_bind(dp, mp, 0);
50:
51: /* punt if translation did not succeed or resulted in multiple targets */
52: if (dp==NULL || dp->next!=dp || dp->status!=d_pipe)
53: goto rebuild;
54:
55: /* punt if the translation didn't result in the original address */
56: if (strcmp(s_to_c(dp->addr), base)!=0)
57: goto rebuild;
58: base=sp;
59: rebuild:
60: if(base!=s_to_c(mp->sender))
61: mp->sender = s_copy(base);
62: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.