comparison src/route.c @ 15:f671821d8222

code beautifying; 0 -> \0 if appropriate
author meillo@marmaro.de
date Thu, 06 Nov 2008 09:18:38 +0100
parents 26e34ae9a3e3
children a80ebfa16cd5
comparison
equal deleted inserted replaced
14:a8f3424347dc 15:f671821d8222
14 You should have received a copy of the GNU General Public License 14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software 15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */ 17 */
18 18
19 #include <fnmatch.h>
20
19 #include "masqmail.h" 21 #include "masqmail.h"
20 #include <fnmatch.h>
21 22
22 msgout_perhost* 23 msgout_perhost*
23 create_msgout_perhost(gchar * host) 24 create_msgout_perhost(gchar * host)
24 { 25 {
25 msgout_perhost *mo_ph = g_malloc(sizeof(msgout_perhost)); 26 msgout_perhost *mo_ph = g_malloc(sizeof(msgout_perhost));
83 hdr_node->data = new_hdr; 84 hdr_node->data = new_hdr;
84 /* we need this list only to carefully free the extra headers: */ 85 /* we need this list only to carefully free the extra headers: */
85 DEBUG(6) debugf("header = %s\n", new_hdr->header); 86 DEBUG(6) debugf("header = %s\n", new_hdr->header);
86 msgout->xtra_hdr_list = g_list_append(msgout->xtra_hdr_list, new_hdr); 87 msgout->xtra_hdr_list = g_list_append(msgout->xtra_hdr_list, new_hdr);
87 } else { 88 } else {
88 logwrite(LOG_ALERT, "error in set_address_header_domain(%s, %s)\n", new_hdr->value, route->set_h_from_domain); 89 logwrite(LOG_ALERT, "error in set_address_header_domain(%s, %s)\n",
90 new_hdr->value, route->set_h_from_domain);
89 } 91 }
90 } 92 }
91 } 93 }
92 } 94 }
93 } 95 }
168 foreach(msgout->hdr_list, hdr_node) { 170 foreach(msgout->hdr_list, hdr_node) {
169 header *hdr = (header *) (hdr_node->data); 171 header *hdr = (header *) (hdr_node->data);
170 if (hdr->id == HEAD_SENDER) { 172 if (hdr->id == HEAD_SENDER) {
171 header *new_hdr; 173 header *new_hdr;
172 174
173 new_hdr = create_header(HEAD_SENDER, "Sender: %s@%s\n", msgout->return_path->local_part, msgout->return_path->domain); 175 new_hdr = create_header(HEAD_SENDER, "Sender: %s@%s\n",
176 msgout->return_path->local_part, msgout->return_path->domain);
174 hdr_node->data = new_hdr; 177 hdr_node->data = new_hdr;
175 /* we need this list only to carefully free the extra headers: */ 178 /* we need this list only to carefully free the extra headers: */
176 msgout->xtra_hdr_list = g_list_append(msgout->xtra_hdr_list, new_hdr); 179 msgout->xtra_hdr_list = g_list_append(msgout->xtra_hdr_list, new_hdr);
177 } 180 }
178 } 181 }
320 address *rcpt = (address *) (node->data); 323 address *rcpt = (address *) (node->data);
321 debugf("rcpt for routed delivery: <%s@%s>\n", rcpt->local_part, rcpt->domain); 324 debugf("rcpt for routed delivery: <%s@%s>\n", rcpt->local_part, rcpt->domain);
322 } 325 }
323 } 326 }
324 327
325 /* rewrite return path 328 /* rewrite return path if there is a table, use that
326 if there is a table, use that
327 if an address is found and if it has a domain, use that 329 if an address is found and if it has a domain, use that
328 */ 330 */
329 if (route->map_return_path_addresses) { 331 if (route->map_return_path_addresses) {
330 address *ret_path = NULL; 332 address *ret_path = NULL;
331 DEBUG(5) debugf("looking up %s in map_return_path_addresses\n", msg->return_path->local_part); 333 DEBUG(5) debugf("looking up %s in map_return_path_addresses\n", msg->return_path->local_part);
380 } 382 }
381 if (mo_ph_node != NULL) { 383 if (mo_ph_node != NULL) {
382 /* there is already a rcpt for this host */ 384 /* there is already a rcpt for this host */
383 msg_out *msgout_last = (msg_out *) ((g_list_last(mo_ph->msgout_list))->data); 385 msg_out *msgout_last = (msg_out *) ((g_list_last(mo_ph->msgout_list))->data);
384 if (msgout_last->msg == msgout->msg) { 386 if (msgout_last->msg == msgout->msg) {
385 /* if it is also the same message, it must be the last one 387 /* if it is also the same message, it must be the last one appended
386 appended to mo_ph->msgout_list (since outer loop goes through 388 to mo_ph->msgout_list (since outer loop goes through msgout_list) */
387 msgout_list) */
388 msgout_last->rcpt_list = g_list_append(msgout_last->rcpt_list, rcpt); 389 msgout_last->rcpt_list = g_list_append(msgout_last->rcpt_list, rcpt);
389 } else { 390 } else {
390 /* if not, we append a new msgout */ 391 /* if not, we append a new msgout */
391 /* make a copy of msgout */ 392 /* make a copy of msgout */
392 msgout_new = create_msg_out(msgout->msg); 393 msgout_new = create_msg_out(msgout->msg);