Mercurial > masqmail
annotate src/route.c @ 434:f2a7271746d1 default tip
Removes Freshmeat.net from the docs
The site, which was later renamed to freecode.com, is no longer
maintained (contains only a static copy).
author | markus schnalke <meillo@marmaro.de> |
---|---|
date | Sat, 07 Feb 2015 11:45:07 +0100 |
parents | 5593964ec779 |
children |
rev | line source |
---|---|
367
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
1 /* |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
2 ** MasqMail |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
3 ** Copyright (C) 1999-2001 Oliver Kurth |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
4 ** Copyright (C) 2010 markus schnalke <meillo@marmaro.de> |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
5 ** |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
6 ** This program is free software; you can redistribute it and/or modify |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
7 ** it under the terms of the GNU General Public License as published by |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
8 ** the Free Software Foundation; either version 2 of the License, or |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
9 ** (at your option) any later version. |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
10 ** |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
11 ** This program is distributed in the hope that it will be useful, |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
14 ** GNU General Public License for more details. |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
15 ** |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
16 ** You should have received a copy of the GNU General Public License |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
17 ** along with this program; if not, write to the Free Software |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
18 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
0 | 19 */ |
20 | |
15 | 21 #include <fnmatch.h> |
22 | |
0 | 23 #include "masqmail.h" |
24 | |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
25 msgout_perhost* |
366
41958685480d
Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents:
355
diff
changeset
|
26 create_msgout_perhost(gchar *host) |
0 | 27 { |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
28 msgout_perhost *mo_ph = g_malloc(sizeof(msgout_perhost)); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
29 if (mo_ph) { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
30 mo_ph->host = g_strdup(host); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
31 mo_ph->msgout_list = NULL; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
32 } |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
33 return mo_ph; |
0 | 34 } |
35 | |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
36 void |
366
41958685480d
Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents:
355
diff
changeset
|
37 destroy_msgout_perhost(msgout_perhost *mo_ph) |
0 | 38 { |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
39 GList *mo_node; |
0 | 40 |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
41 foreach(mo_ph->msgout_list, mo_node) { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
42 msg_out *mo = (msg_out *) (mo_node->data); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
43 /* the rcpt_list is owned by the msgout's, but not the rcpt's themselves */ |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
44 g_list_free(mo->rcpt_list); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
45 g_free(mo); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
46 } |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
47 g_list_free(mo_ph->msgout_list); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
48 g_free(mo_ph); |
0 | 49 } |
50 | |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
51 void |
366
41958685480d
Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents:
355
diff
changeset
|
52 rewrite_headers(msg_out *msgout, connect_route *route) |
0 | 53 { |
367
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
54 /* |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
55 ** if set_h_from_domain is set, replace domain in all |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
56 ** From: headers. |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
57 */ |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
58 msgout->hdr_list = g_list_copy(msgout->msg->hdr_list); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
59 |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
60 /* map from addresses */ |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
61 if (route->map_h_from_addresses != NULL) { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
62 GList *hdr_node; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
63 foreach(msgout->hdr_list, hdr_node) { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
64 header *hdr = (header *) (hdr_node->data); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
65 if (hdr->id == HEAD_FROM) { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
66 header *new_hdr = copy_header(hdr); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
67 if (map_address_header(new_hdr, route->map_h_from_addresses)) { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
68 hdr_node->data = new_hdr; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
69 /* we need this list only to carefully free the extra headers: */ |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
70 msgout->xtra_hdr_list = g_list_append(msgout->xtra_hdr_list, new_hdr); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
71 } else |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
72 g_free(new_hdr); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
73 } |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
74 } |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
75 } else { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
76 /* replace from domain */ |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
77 if (route->set_h_from_domain != NULL) { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
78 GList *hdr_node; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
79 |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
80 foreach(msgout->hdr_list, hdr_node) { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
81 header *hdr = (header *) (hdr_node->data); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
82 if (hdr->id == HEAD_FROM) { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
83 header *new_hdr = copy_header(hdr); |
0 | 84 |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
85 DEBUG(5) debugf("setting From: domain to %s\n", route->set_h_from_domain); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
86 if (set_address_header_domain(new_hdr, route->set_h_from_domain)) { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
87 hdr_node->data = new_hdr; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
88 /* we need this list only to carefully free the extra headers: */ |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
89 DEBUG(6) debugf("header = %s\n", new_hdr->header); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
90 msgout->xtra_hdr_list = g_list_append(msgout->xtra_hdr_list, new_hdr); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
91 } else { |
15 | 92 logwrite(LOG_ALERT, "error in set_address_header_domain(%s, %s)\n", |
93 new_hdr->value, route->set_h_from_domain); | |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
94 } |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
95 } |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
96 } |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
97 } |
0 | 98 } |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
99 |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
100 /* map reply-to addresses */ |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
101 if (route->map_h_reply_to_addresses != NULL) { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
102 GList *hdr_node; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
103 foreach(msgout->hdr_list, hdr_node) { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
104 header *hdr = (header *) (hdr_node->data); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
105 if (hdr->id == HEAD_REPLY_TO) { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
106 header *new_hdr = copy_header(hdr); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
107 if (map_address_header |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
108 (new_hdr, route->map_h_reply_to_addresses)) { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
109 hdr_node->data = new_hdr; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
110 /* we need this list only to carefully free the extra headers: */ |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
111 msgout->xtra_hdr_list = g_list_append(msgout->xtra_hdr_list, new_hdr); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
112 } else |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
113 g_free(new_hdr); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
114 } |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
115 } |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
116 } else { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
117 /* replace Reply-to domain */ |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
118 if (route->set_h_reply_to_domain != NULL) { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
119 GList *hdr_node; |
0 | 120 |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
121 foreach(msgout->hdr_list, hdr_node) { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
122 header *hdr = (header *) (hdr_node->data); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
123 if (hdr->id == HEAD_REPLY_TO) { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
124 header *new_hdr = copy_header(hdr); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
125 |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
126 set_address_header_domain(new_hdr, route-> set_h_reply_to_domain); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
127 hdr_node->data = new_hdr; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
128 /* we need this list only to carefully free the extra headers: */ |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
129 msgout->xtra_hdr_list = g_list_append(msgout->xtra_hdr_list, new_hdr); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
130 } |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
131 } |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
132 } |
0 | 133 } |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
134 |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
135 /* map Mail-Followup-To addresses */ |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
136 if (route->map_h_mail_followup_to_addresses != NULL) { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
137 GList *hdr_node; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
138 foreach(msgout->hdr_list, hdr_node) { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
139 header *hdr = (header *) (hdr_node->data); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
140 if (strncasecmp(hdr->header, "Mail-Followup-To", 16) == 0) { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
141 header *new_hdr = copy_header(hdr); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
142 if (map_address_header(new_hdr, route->map_h_mail_followup_to_addresses)) { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
143 hdr_node->data = new_hdr; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
144 /* we need this list only to carefully free the extra headers: */ |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
145 msgout->xtra_hdr_list = g_list_append(msgout->xtra_hdr_list, new_hdr); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
146 } else |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
147 g_free(new_hdr); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
148 } |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
149 } |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
150 } |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
151 |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
152 /* set Sender: domain to return_path->domain */ |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
153 if (route->expand_h_sender_domain) { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
154 GList *hdr_node; |
0 | 155 |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
156 foreach(msgout->hdr_list, hdr_node) { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
157 header *hdr = (header *) (hdr_node->data); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
158 if (hdr->id == HEAD_SENDER) { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
159 header *new_hdr = copy_header(hdr); |
0 | 160 |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
161 set_address_header_domain(new_hdr, msgout->return_path->domain); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
162 hdr_node->data = new_hdr; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
163 /* we need this list only to carefully free the extra headers: */ |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
164 msgout->xtra_hdr_list = g_list_append(msgout->xtra_hdr_list, new_hdr); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
165 } |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
166 } |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
167 } |
0 | 168 |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
169 /* set Sender: domain to return_path->domain */ |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
170 if (route->expand_h_sender_address) { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
171 GList *hdr_node; |
0 | 172 |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
173 foreach(msgout->hdr_list, hdr_node) { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
174 header *hdr = (header *) (hdr_node->data); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
175 if (hdr->id == HEAD_SENDER) { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
176 header *new_hdr; |
0 | 177 |
15 | 178 new_hdr = create_header(HEAD_SENDER, "Sender: %s@%s\n", |
179 msgout->return_path->local_part, msgout->return_path->domain); | |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
180 hdr_node->data = new_hdr; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
181 /* we need this list only to carefully free the extra headers: */ |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
182 msgout->xtra_hdr_list = g_list_append(msgout->xtra_hdr_list, new_hdr); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
183 } |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
184 } |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
185 } |
0 | 186 |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
187 if (msgout->xtra_hdr_list == NULL) { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
188 /* nothing was changed */ |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
189 g_list_free(msgout->hdr_list); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
190 msgout->hdr_list = NULL; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
191 } |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
192 DEBUG(5) debugf("rewrite_headers() returning\n"); |
0 | 193 } |
194 | |
237
5f9f3a65032e
refactoring: new function split_rcpts() replaces two others
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
195 /* |
367
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
196 ** Split a recipient list into the three groups: |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
197 ** - local recipients |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
198 ** - those maching the patterns |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
199 ** - those not matching the patterns |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
200 ** If patterns is NULL: only splitting between local and others is done. |
237
5f9f3a65032e
refactoring: new function split_rcpts() replaces two others
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
201 */ |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
202 void |
367
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
203 split_rcpts(GList *rcpt_list, GList *patterns, GList **rl_local, |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
204 GList **rl_matching, GList **rl_others) |
0 | 205 { |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
206 GList *rcpt_node; |
373
4cab237ce923
Fixed bug in matching of allowed recipients.
markus schnalke <meillo@marmaro.de>
parents:
367
diff
changeset
|
207 GList *pat_node = NULL; |
237
5f9f3a65032e
refactoring: new function split_rcpts() replaces two others
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
208 address *rcpt = NULL; |
0 | 209 |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
210 if (rcpt_list == NULL) |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
211 return; |
0 | 212 |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
213 foreach(rcpt_list, rcpt_node) { |
237
5f9f3a65032e
refactoring: new function split_rcpts() replaces two others
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
214 rcpt = (address *) (rcpt_node->data); |
373
4cab237ce923
Fixed bug in matching of allowed recipients.
markus schnalke <meillo@marmaro.de>
parents:
367
diff
changeset
|
215 pat_node = NULL; |
0 | 216 |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
217 if (addr_is_local(rcpt)) { |
237
5f9f3a65032e
refactoring: new function split_rcpts() replaces two others
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
218 if (rl_local) |
5f9f3a65032e
refactoring: new function split_rcpts() replaces two others
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
219 *rl_local = g_list_append(*rl_local, rcpt); |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
220 } else { |
367
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
221 /* |
373
4cab237ce923
Fixed bug in matching of allowed recipients.
markus schnalke <meillo@marmaro.de>
parents:
367
diff
changeset
|
222 ** if patterns is NULL, pat_node will be NULL, |
367
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
223 ** hence all non-locals are put to others |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
224 */ |
373
4cab237ce923
Fixed bug in matching of allowed recipients.
markus schnalke <meillo@marmaro.de>
parents:
367
diff
changeset
|
225 foreach(patterns, pat_node) { |
4cab237ce923
Fixed bug in matching of allowed recipients.
markus schnalke <meillo@marmaro.de>
parents:
367
diff
changeset
|
226 address *pat = (address *) (pat_node->data); |
4cab237ce923
Fixed bug in matching of allowed recipients.
markus schnalke <meillo@marmaro.de>
parents:
367
diff
changeset
|
227 if (fnmatch(pat->domain, rcpt->domain, FNM_CASEFOLD)==0 && fnmatch(pat->local_part, rcpt->local_part, 0)==0) { /* TODO: match local_part caseless? */ |
237
5f9f3a65032e
refactoring: new function split_rcpts() replaces two others
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
228 break; |
373
4cab237ce923
Fixed bug in matching of allowed recipients.
markus schnalke <meillo@marmaro.de>
parents:
367
diff
changeset
|
229 } |
237
5f9f3a65032e
refactoring: new function split_rcpts() replaces two others
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
230 } |
373
4cab237ce923
Fixed bug in matching of allowed recipients.
markus schnalke <meillo@marmaro.de>
parents:
367
diff
changeset
|
231 if (pat_node) { |
355
ddb7b3fd3d08
found further appearences of ``localnet'' in the code
markus schnalke <meillo@marmaro.de>
parents:
345
diff
changeset
|
232 if (rl_matching) |
ddb7b3fd3d08
found further appearences of ``localnet'' in the code
markus schnalke <meillo@marmaro.de>
parents:
345
diff
changeset
|
233 *rl_matching = g_list_append(*rl_matching, rcpt); |
237
5f9f3a65032e
refactoring: new function split_rcpts() replaces two others
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
234 } else { |
5f9f3a65032e
refactoring: new function split_rcpts() replaces two others
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
235 if (rl_others) |
5f9f3a65032e
refactoring: new function split_rcpts() replaces two others
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
236 *rl_others = g_list_append(*rl_others, rcpt); |
5f9f3a65032e
refactoring: new function split_rcpts() replaces two others
markus schnalke <meillo@marmaro.de>
parents:
114
diff
changeset
|
237 } |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
238 } |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
239 } |
0 | 240 } |
241 | |
345
257ffce6c1cd
added local_rcpts() and remote_rcpts() for later use
markus schnalke <meillo@marmaro.de>
parents:
317
diff
changeset
|
242 /* |
367
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
243 ** Return a new list of the local rcpts in the rcpt_list |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
244 ** TODO: This function is almost exactly the same as remote_rcpts(). Merge? |
345
257ffce6c1cd
added local_rcpts() and remote_rcpts() for later use
markus schnalke <meillo@marmaro.de>
parents:
317
diff
changeset
|
245 */ |
257ffce6c1cd
added local_rcpts() and remote_rcpts() for later use
markus schnalke <meillo@marmaro.de>
parents:
317
diff
changeset
|
246 GList* |
366
41958685480d
Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents:
355
diff
changeset
|
247 local_rcpts(GList *rcpt_list) |
345
257ffce6c1cd
added local_rcpts() and remote_rcpts() for later use
markus schnalke <meillo@marmaro.de>
parents:
317
diff
changeset
|
248 { |
257ffce6c1cd
added local_rcpts() and remote_rcpts() for later use
markus schnalke <meillo@marmaro.de>
parents:
317
diff
changeset
|
249 GList *rcpt_node; |
257ffce6c1cd
added local_rcpts() and remote_rcpts() for later use
markus schnalke <meillo@marmaro.de>
parents:
317
diff
changeset
|
250 GList *local_rcpts = NULL; |
257ffce6c1cd
added local_rcpts() and remote_rcpts() for later use
markus schnalke <meillo@marmaro.de>
parents:
317
diff
changeset
|
251 address *rcpt = NULL; |
257ffce6c1cd
added local_rcpts() and remote_rcpts() for later use
markus schnalke <meillo@marmaro.de>
parents:
317
diff
changeset
|
252 |
257ffce6c1cd
added local_rcpts() and remote_rcpts() for later use
markus schnalke <meillo@marmaro.de>
parents:
317
diff
changeset
|
253 if (!rcpt_list) { |
257ffce6c1cd
added local_rcpts() and remote_rcpts() for later use
markus schnalke <meillo@marmaro.de>
parents:
317
diff
changeset
|
254 return NULL; |
257ffce6c1cd
added local_rcpts() and remote_rcpts() for later use
markus schnalke <meillo@marmaro.de>
parents:
317
diff
changeset
|
255 } |
257ffce6c1cd
added local_rcpts() and remote_rcpts() for later use
markus schnalke <meillo@marmaro.de>
parents:
317
diff
changeset
|
256 foreach(rcpt_list, rcpt_node) { |
257ffce6c1cd
added local_rcpts() and remote_rcpts() for later use
markus schnalke <meillo@marmaro.de>
parents:
317
diff
changeset
|
257 rcpt = (address *) (rcpt_node->data); |
257ffce6c1cd
added local_rcpts() and remote_rcpts() for later use
markus schnalke <meillo@marmaro.de>
parents:
317
diff
changeset
|
258 if (addr_is_local(rcpt)) { |
257ffce6c1cd
added local_rcpts() and remote_rcpts() for later use
markus schnalke <meillo@marmaro.de>
parents:
317
diff
changeset
|
259 local_rcpts = g_list_append(local_rcpts, rcpt); |
257ffce6c1cd
added local_rcpts() and remote_rcpts() for later use
markus schnalke <meillo@marmaro.de>
parents:
317
diff
changeset
|
260 } |
257ffce6c1cd
added local_rcpts() and remote_rcpts() for later use
markus schnalke <meillo@marmaro.de>
parents:
317
diff
changeset
|
261 } |
257ffce6c1cd
added local_rcpts() and remote_rcpts() for later use
markus schnalke <meillo@marmaro.de>
parents:
317
diff
changeset
|
262 return local_rcpts; |
257ffce6c1cd
added local_rcpts() and remote_rcpts() for later use
markus schnalke <meillo@marmaro.de>
parents:
317
diff
changeset
|
263 } |
257ffce6c1cd
added local_rcpts() and remote_rcpts() for later use
markus schnalke <meillo@marmaro.de>
parents:
317
diff
changeset
|
264 |
257ffce6c1cd
added local_rcpts() and remote_rcpts() for later use
markus schnalke <meillo@marmaro.de>
parents:
317
diff
changeset
|
265 /* |
367
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
266 ** Return a new list of non-local rcpts in the rcpt_list |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
267 ** TODO: This function is almost exactly the same as local_rcpts(). Merge? |
345
257ffce6c1cd
added local_rcpts() and remote_rcpts() for later use
markus schnalke <meillo@marmaro.de>
parents:
317
diff
changeset
|
268 */ |
257ffce6c1cd
added local_rcpts() and remote_rcpts() for later use
markus schnalke <meillo@marmaro.de>
parents:
317
diff
changeset
|
269 GList* |
366
41958685480d
Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents:
355
diff
changeset
|
270 remote_rcpts(GList *rcpt_list) |
345
257ffce6c1cd
added local_rcpts() and remote_rcpts() for later use
markus schnalke <meillo@marmaro.de>
parents:
317
diff
changeset
|
271 { |
257ffce6c1cd
added local_rcpts() and remote_rcpts() for later use
markus schnalke <meillo@marmaro.de>
parents:
317
diff
changeset
|
272 GList *rcpt_node; |
257ffce6c1cd
added local_rcpts() and remote_rcpts() for later use
markus schnalke <meillo@marmaro.de>
parents:
317
diff
changeset
|
273 GList *remote_rcpts = NULL; |
257ffce6c1cd
added local_rcpts() and remote_rcpts() for later use
markus schnalke <meillo@marmaro.de>
parents:
317
diff
changeset
|
274 address *rcpt = NULL; |
257ffce6c1cd
added local_rcpts() and remote_rcpts() for later use
markus schnalke <meillo@marmaro.de>
parents:
317
diff
changeset
|
275 |
257ffce6c1cd
added local_rcpts() and remote_rcpts() for later use
markus schnalke <meillo@marmaro.de>
parents:
317
diff
changeset
|
276 if (!rcpt_list) { |
257ffce6c1cd
added local_rcpts() and remote_rcpts() for later use
markus schnalke <meillo@marmaro.de>
parents:
317
diff
changeset
|
277 return NULL; |
257ffce6c1cd
added local_rcpts() and remote_rcpts() for later use
markus schnalke <meillo@marmaro.de>
parents:
317
diff
changeset
|
278 } |
257ffce6c1cd
added local_rcpts() and remote_rcpts() for later use
markus schnalke <meillo@marmaro.de>
parents:
317
diff
changeset
|
279 foreach(rcpt_list, rcpt_node) { |
257ffce6c1cd
added local_rcpts() and remote_rcpts() for later use
markus schnalke <meillo@marmaro.de>
parents:
317
diff
changeset
|
280 rcpt = (address *) (rcpt_node->data); |
257ffce6c1cd
added local_rcpts() and remote_rcpts() for later use
markus schnalke <meillo@marmaro.de>
parents:
317
diff
changeset
|
281 if (!addr_is_local(rcpt)) { |
257ffce6c1cd
added local_rcpts() and remote_rcpts() for later use
markus schnalke <meillo@marmaro.de>
parents:
317
diff
changeset
|
282 remote_rcpts = g_list_append(remote_rcpts, rcpt); |
257ffce6c1cd
added local_rcpts() and remote_rcpts() for later use
markus schnalke <meillo@marmaro.de>
parents:
317
diff
changeset
|
283 } |
257ffce6c1cd
added local_rcpts() and remote_rcpts() for later use
markus schnalke <meillo@marmaro.de>
parents:
317
diff
changeset
|
284 } |
257ffce6c1cd
added local_rcpts() and remote_rcpts() for later use
markus schnalke <meillo@marmaro.de>
parents:
317
diff
changeset
|
285 return remote_rcpts; |
257ffce6c1cd
added local_rcpts() and remote_rcpts() for later use
markus schnalke <meillo@marmaro.de>
parents:
317
diff
changeset
|
286 } |
257ffce6c1cd
added local_rcpts() and remote_rcpts() for later use
markus schnalke <meillo@marmaro.de>
parents:
317
diff
changeset
|
287 |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
288 static gint |
317
55b7bde95d37
reworked allowed and denied addrs for routes
meillo@marmaro.de
parents:
241
diff
changeset
|
289 _g_list_addrcmp(gconstpointer pattern, gconstpointer addr) |
0 | 290 { |
317
55b7bde95d37
reworked allowed and denied addrs for routes
meillo@marmaro.de
parents:
241
diff
changeset
|
291 int res; |
366
41958685480d
Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents:
355
diff
changeset
|
292 address *patternaddr = (address*) pattern; |
41958685480d
Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents:
355
diff
changeset
|
293 address *stringaddr = (address*) addr; |
317
55b7bde95d37
reworked allowed and denied addrs for routes
meillo@marmaro.de
parents:
241
diff
changeset
|
294 |
55b7bde95d37
reworked allowed and denied addrs for routes
meillo@marmaro.de
parents:
241
diff
changeset
|
295 DEBUG(6) debugf("_g_list_addrcmp: pattern `%s' `%s' on string `%s' `%s'\n", |
55b7bde95d37
reworked allowed and denied addrs for routes
meillo@marmaro.de
parents:
241
diff
changeset
|
296 patternaddr->local_part, patternaddr->domain, |
55b7bde95d37
reworked allowed and denied addrs for routes
meillo@marmaro.de
parents:
241
diff
changeset
|
297 stringaddr->local_part, stringaddr->domain); |
55b7bde95d37
reworked allowed and denied addrs for routes
meillo@marmaro.de
parents:
241
diff
changeset
|
298 /* TODO: check if we should match here dependent on caseless_matching */ |
55b7bde95d37
reworked allowed and denied addrs for routes
meillo@marmaro.de
parents:
241
diff
changeset
|
299 res = fnmatch(patternaddr->local_part, stringaddr->local_part, 0); |
55b7bde95d37
reworked allowed and denied addrs for routes
meillo@marmaro.de
parents:
241
diff
changeset
|
300 if (res != 0) { |
55b7bde95d37
reworked allowed and denied addrs for routes
meillo@marmaro.de
parents:
241
diff
changeset
|
301 DEBUG(6) debugf("_g_list_addrcmp: ... failed on local_part\n"); |
55b7bde95d37
reworked allowed and denied addrs for routes
meillo@marmaro.de
parents:
241
diff
changeset
|
302 return res; |
55b7bde95d37
reworked allowed and denied addrs for routes
meillo@marmaro.de
parents:
241
diff
changeset
|
303 } |
55b7bde95d37
reworked allowed and denied addrs for routes
meillo@marmaro.de
parents:
241
diff
changeset
|
304 res = fnmatch(patternaddr->domain, stringaddr->domain, FNM_CASEFOLD); |
55b7bde95d37
reworked allowed and denied addrs for routes
meillo@marmaro.de
parents:
241
diff
changeset
|
305 DEBUG(6) debugf("_g_list_addrcmp: ... %s\n", (res==0) ? "matched" : "failed on domain"); |
55b7bde95d37
reworked allowed and denied addrs for routes
meillo@marmaro.de
parents:
241
diff
changeset
|
306 return res; |
0 | 307 } |
308 | |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
309 gboolean |
366
41958685480d
Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents:
355
diff
changeset
|
310 route_sender_is_allowed(connect_route *route, address *ret_path) |
0 | 311 { |
317
55b7bde95d37
reworked allowed and denied addrs for routes
meillo@marmaro.de
parents:
241
diff
changeset
|
312 if (route->denied_senders && g_list_find_custom(route->denied_senders, ret_path, _g_list_addrcmp)) { |
55b7bde95d37
reworked allowed and denied addrs for routes
meillo@marmaro.de
parents:
241
diff
changeset
|
313 return FALSE; |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
314 } |
317
55b7bde95d37
reworked allowed and denied addrs for routes
meillo@marmaro.de
parents:
241
diff
changeset
|
315 if (route->allowed_senders) { |
55b7bde95d37
reworked allowed and denied addrs for routes
meillo@marmaro.de
parents:
241
diff
changeset
|
316 if (g_list_find_custom(route->allowed_senders, ret_path, _g_list_addrcmp)) { |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
317 return TRUE; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
318 } else { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
319 return FALSE; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
320 } |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
321 } |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
322 return TRUE; |
0 | 323 } |
324 | |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
325 /* |
367
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
326 ** Make lists of matching/not matching rcpts. |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
327 ** Local domains are NOT regared here, these should be sorted out previously |
0 | 328 */ |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
329 void |
366
41958685480d
Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents:
355
diff
changeset
|
330 route_split_rcpts(connect_route *route, GList *rcpt_list, GList **p_rcpt_list, GList **p_non_rcpt_list) |
0 | 331 { |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
332 GList *tmp_list = NULL; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
333 /* sort out those domains that can be sent over this connection: */ |
317
55b7bde95d37
reworked allowed and denied addrs for routes
meillo@marmaro.de
parents:
241
diff
changeset
|
334 if (route->allowed_recipients) { |
55b7bde95d37
reworked allowed and denied addrs for routes
meillo@marmaro.de
parents:
241
diff
changeset
|
335 DEBUG(5) debugf("testing for route->allowed_recipients\n"); |
55b7bde95d37
reworked allowed and denied addrs for routes
meillo@marmaro.de
parents:
241
diff
changeset
|
336 split_rcpts(rcpt_list, route->allowed_recipients, NULL, &tmp_list, p_non_rcpt_list); |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
337 } else { |
317
55b7bde95d37
reworked allowed and denied addrs for routes
meillo@marmaro.de
parents:
241
diff
changeset
|
338 DEBUG(5) debugf("route->allowed_recipients == NULL\n"); |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
339 tmp_list = g_list_copy(rcpt_list); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
340 } |
0 | 341 |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
342 /* sort out those domains that cannot be sent over this connection: */ |
317
55b7bde95d37
reworked allowed and denied addrs for routes
meillo@marmaro.de
parents:
241
diff
changeset
|
343 split_rcpts(tmp_list, route->denied_recipients, NULL, p_non_rcpt_list, p_rcpt_list); |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
344 g_list_free(tmp_list); |
0 | 345 } |
346 | |
429
5593964ec779
Added route conditions based on the From header
markus schnalke <meillo@marmaro.de>
parents:
373
diff
changeset
|
347 gboolean |
5593964ec779
Added route conditions based on the From header
markus schnalke <meillo@marmaro.de>
parents:
373
diff
changeset
|
348 route_from_hdr_is_allowed(connect_route *route, char *from_hdr) |
5593964ec779
Added route conditions based on the From header
markus schnalke <meillo@marmaro.de>
parents:
373
diff
changeset
|
349 { |
5593964ec779
Added route conditions based on the From header
markus schnalke <meillo@marmaro.de>
parents:
373
diff
changeset
|
350 address *addr = create_address_qualified(from_hdr, FALSE, |
5593964ec779
Added route conditions based on the From header
markus schnalke <meillo@marmaro.de>
parents:
373
diff
changeset
|
351 conf.host_name); |
5593964ec779
Added route conditions based on the From header
markus schnalke <meillo@marmaro.de>
parents:
373
diff
changeset
|
352 if (route->denied_from_hdrs && g_list_find_custom(route->denied_from_hdrs, addr, _g_list_addrcmp)) { |
5593964ec779
Added route conditions based on the From header
markus schnalke <meillo@marmaro.de>
parents:
373
diff
changeset
|
353 return FALSE; |
5593964ec779
Added route conditions based on the From header
markus schnalke <meillo@marmaro.de>
parents:
373
diff
changeset
|
354 } |
5593964ec779
Added route conditions based on the From header
markus schnalke <meillo@marmaro.de>
parents:
373
diff
changeset
|
355 if (route->allowed_from_hdrs) { |
5593964ec779
Added route conditions based on the From header
markus schnalke <meillo@marmaro.de>
parents:
373
diff
changeset
|
356 if (g_list_find_custom(route->allowed_from_hdrs, addr, |
5593964ec779
Added route conditions based on the From header
markus schnalke <meillo@marmaro.de>
parents:
373
diff
changeset
|
357 _g_list_addrcmp)) { |
5593964ec779
Added route conditions based on the From header
markus schnalke <meillo@marmaro.de>
parents:
373
diff
changeset
|
358 return TRUE; |
5593964ec779
Added route conditions based on the From header
markus schnalke <meillo@marmaro.de>
parents:
373
diff
changeset
|
359 } else { |
5593964ec779
Added route conditions based on the From header
markus schnalke <meillo@marmaro.de>
parents:
373
diff
changeset
|
360 return FALSE; |
5593964ec779
Added route conditions based on the From header
markus schnalke <meillo@marmaro.de>
parents:
373
diff
changeset
|
361 } |
5593964ec779
Added route conditions based on the From header
markus schnalke <meillo@marmaro.de>
parents:
373
diff
changeset
|
362 } |
5593964ec779
Added route conditions based on the From header
markus schnalke <meillo@marmaro.de>
parents:
373
diff
changeset
|
363 return TRUE; |
5593964ec779
Added route conditions based on the From header
markus schnalke <meillo@marmaro.de>
parents:
373
diff
changeset
|
364 } |
5593964ec779
Added route conditions based on the From header
markus schnalke <meillo@marmaro.de>
parents:
373
diff
changeset
|
365 |
5593964ec779
Added route conditions based on the From header
markus schnalke <meillo@marmaro.de>
parents:
373
diff
changeset
|
366 |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
367 msg_out* |
366
41958685480d
Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents:
355
diff
changeset
|
368 route_prepare_msgout(connect_route *route, msg_out *msgout) |
0 | 369 { |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
370 message *msg = msgout->msg; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
371 GList *rcpt_list = msgout->rcpt_list; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
372 |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
373 if (rcpt_list != NULL) { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
374 /* found a few */ |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
375 DEBUG(5) { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
376 GList *node; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
377 debugf("rcpts for routed delivery, route = %s, id = %s\n", route->name, msg->uid); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
378 foreach(rcpt_list, node) { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
379 address *rcpt = (address *) (node->data); |
114 | 380 debugf(" rcpt for routed delivery: <%s@%s>\n", |
381 rcpt->local_part, rcpt->domain); | |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
382 } |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
383 } |
0 | 384 |
367
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
385 /* |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
386 ** rewrite return path if there is a table, use that |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
387 ** if an address is found and if it has a domain, use that |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
388 */ |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
389 if (route->map_return_path_addresses) { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
390 address *ret_path = NULL; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
391 DEBUG(5) debugf("looking up %s in map_return_path_addresses\n", msg->return_path->local_part); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
392 ret_path = (address *) table_find_fnmatch(route->map_return_path_addresses, msg->return_path->local_part); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
393 if (ret_path) { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
394 DEBUG(5) debugf("found <%s@%s>\n", ret_path->local_part, ret_path->domain); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
395 if (ret_path->domain == NULL) |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
396 ret_path->domain = route->set_return_path_domain |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
397 ? route->set_return_path_domain |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
398 : msg->return_path->domain; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
399 msgout->return_path = copy_address(ret_path); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
400 } |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
401 } |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
402 if (msgout->return_path == NULL) { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
403 DEBUG(5) debugf("setting return path to %s\n", route->set_return_path_domain); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
404 msgout->return_path = copy_modify_address(msg->return_path, NULL, route->set_return_path_domain); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
405 } |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
406 rewrite_headers(msgout, route); |
0 | 407 |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
408 return msgout; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
409 } |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
410 return NULL; |
0 | 411 } |
412 | |
367
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
413 /* |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
414 ** put msgout's is msgout_list into bins (msgout_perhost structs) for each |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
415 ** host. Used if there is no mail_host. |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
416 ** route param is not used, we leave it here because that may change. |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
417 */ |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
418 GList* |
366
41958685480d
Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents:
355
diff
changeset
|
419 route_msgout_list(connect_route *route, GList *msgout_list) |
0 | 420 { |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
421 GList *mo_ph_list = NULL; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
422 GList *msgout_node; |
0 | 423 |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
424 foreach(msgout_list, msgout_node) { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
425 msg_out *msgout = (msg_out *) (msgout_node->data); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
426 msg_out *msgout_new; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
427 GList *rcpt_list = msgout->rcpt_list; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
428 GList *rcpt_node; |
0 | 429 |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
430 foreach(rcpt_list, rcpt_node) { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
431 address *rcpt = rcpt_node->data; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
432 msgout_perhost *mo_ph = NULL; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
433 GList *mo_ph_node = NULL; |
0 | 434 |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
435 /* search host in mo_ph_list */ |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
436 foreach(mo_ph_list, mo_ph_node) { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
437 mo_ph = (msgout_perhost *) (mo_ph_node->data); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
438 if (strcasecmp(mo_ph->host, rcpt->domain) == 0) |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
439 break; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
440 } |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
441 if (mo_ph_node != NULL) { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
442 /* there is already a rcpt for this host */ |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
443 msg_out *msgout_last = (msg_out *) ((g_list_last(mo_ph->msgout_list))->data); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
444 if (msgout_last->msg == msgout->msg) { |
367
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
445 /* |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
446 ** if it is also the same message, |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
447 ** it must be the last one |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
448 ** appended to mo_ph->msgout_list |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
449 ** (since outer loop goes through |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
450 ** msgout_list) |
b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents:
366
diff
changeset
|
451 */ |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
452 msgout_last->rcpt_list = g_list_append(msgout_last->rcpt_list, rcpt); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
453 } else { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
454 /* if not, we append a new msgout */ |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
455 /* make a copy of msgout */ |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
456 msgout_new = create_msg_out(msgout->msg); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
457 msgout_new->return_path = msgout->return_path; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
458 msgout_new->hdr_list = msgout->hdr_list; |
0 | 459 |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
460 /* append our rcpt to it */ |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
461 /* It is the 1st rcpt for this msg to this host, therefore we safely give NULL */ |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
462 msgout_new->rcpt_list = g_list_append(NULL, rcpt); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
463 mo_ph->msgout_list = g_list_append(mo_ph->msgout_list, msgout_new); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
464 } |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
465 } else { |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
466 /* this rcpt to goes to another host */ |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
467 mo_ph = create_msgout_perhost(rcpt->domain); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
468 mo_ph_list = g_list_append(mo_ph_list, mo_ph); |
0 | 469 |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
470 /* make a copy of msgout */ |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
471 msgout_new = create_msg_out(msgout->msg); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
472 msgout_new->return_path = msgout->return_path; |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
473 msgout_new->hdr_list = msgout->hdr_list; |
0 | 474 |
10
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
475 /* append our rcpt to it */ |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
476 /* It is the 1st rcpt for this msg to this host, therefore we safely give NULL */ |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
477 msgout_new->rcpt_list = g_list_append(NULL, rcpt); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
478 mo_ph->msgout_list = g_list_append(mo_ph->msgout_list, msgout_new); |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
479 } /* if mo_ph != NULL */ |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
480 } /* foreach(rcpt_list, ... */ |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
481 } /* foreach(msgout_list, ... */ |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
482 |
26e34ae9a3e3
changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents:
0
diff
changeset
|
483 return mo_ph_list; |
0 | 484 } |