annotate src/deliver.c @ 388:aa40710f09fe

Refactoring and code layouting.
author markus schnalke <meillo@marmaro.de>
date Sat, 18 Feb 2012 13:37:40 +0100
parents a408411ff8df
children 7954b82040b3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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-2002 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) 2008, 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
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
19 */
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
20
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
21 #include <fnmatch.h>
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
22 #include <sysexits.h>
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
23 #include <netdb.h>
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
24
15
f671821d8222 code beautifying; 0 -> \0 if appropriate
meillo@marmaro.de
parents: 12
diff changeset
25 #include "masqmail.h"
f671821d8222 code beautifying; 0 -> \0 if appropriate
meillo@marmaro.de
parents: 12
diff changeset
26 #include "smtp_out.h"
f671821d8222 code beautifying; 0 -> \0 if appropriate
meillo@marmaro.de
parents: 12
diff changeset
27
367
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
28 /*
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
29 ** collect failed/defered rcpts for failure/warning messages
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
30 ** returns TRUE if either there are no failures or a failure message has
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
31 ** been successfully sent
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
32 */
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
33 gboolean
366
41958685480d Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents: 354
diff changeset
34 delivery_failures(message *msg, GList *rcpt_list, gchar *err_fmt, ...)
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
35 {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
36 gboolean ok_fail = TRUE, ok_warn = TRUE;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
37 time_t now = time(NULL);
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
38
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
39 GList *failed_list = NULL, *defered_list = NULL, *rcpt_node;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
40 va_list args;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
41 va_start(args, err_fmt);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
42
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
43 foreach(rcpt_list, rcpt_node) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
44 address *rcpt = (address *) (rcpt_node->data);
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
45
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
46 if (addr_is_defered(rcpt)) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
47 if ((now - msg->received_time) >= conf.max_defer_time) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
48 addr_mark_failed(rcpt);
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
49 } else {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
50 defered_list = g_list_prepend(defered_list, rcpt);
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
51 }
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
52 }
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
53 if (addr_is_failed(rcpt)) {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
54 failed_list = g_list_prepend(failed_list, rcpt);
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
55 }
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
56 }
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
57 if (failed_list) {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
58 ok_fail = fail_msg(msg, conf.errmsg_file, failed_list, err_fmt, args);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
59 g_list_free(failed_list);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
60 }
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
61 if (defered_list) {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
62 ok_warn = warn_msg(msg, conf.warnmsg_file, defered_list, err_fmt, args);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
63 g_list_free(defered_list);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
64 }
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
65 va_end(args);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
66 return ok_fail && ok_warn;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
67 }
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
68
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
69 static gint
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
70 _g_list_strcasecmp(gconstpointer a, gconstpointer b)
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
71 {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
72 return (gint) strcasecmp(a, b);
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
73 }
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
74
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
75 gboolean
366
41958685480d Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents: 354
diff changeset
76 deliver_local_mbox(message *msg, GList *hdr_list, address *rcpt, address *env_addr)
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
77 {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
78 DEBUG(1) debugf("attempting to deliver %s with mbox\n", msg->uid);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
79 if (append_file(msg, hdr_list, rcpt->local_part)) {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
80 if (env_addr != rcpt) {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
81 logwrite(LOG_NOTICE, "%s => %s@%s <%s@%s> with mbox\n", msg->uid, rcpt->local_part, rcpt->domain, env_addr->local_part, env_addr->domain);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
82 } else {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
83 logwrite(LOG_NOTICE, "%s => <%s@%s> with mbox\n", msg->uid, rcpt->local_part, rcpt->domain);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
84 }
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
85 addr_mark_delivered(rcpt);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
86 return TRUE;
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
87 }
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
88
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
89 /* prevents 'Resource temporarily unavailable (11)' */
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
90 if (errno != EAGAIN) {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
91 addr_mark_failed(rcpt);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
92 } else {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
93 addr_mark_defered(rcpt);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
94 }
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
95 return FALSE;
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
96 }
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
97
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
98 gboolean
366
41958685480d Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents: 354
diff changeset
99 deliver_local_pipe(message *msg, GList *hdr_list, address *rcpt, address *env_addr)
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
100 {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
101 guint flags;
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
102
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
103 DEBUG(1) debugf("attempting to deliver %s with pipe\n", msg->uid);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
104
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
105 flags = (conf.pipe_fromline) ? MSGSTR_FROMLINE : 0;
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
106 flags |= (conf.pipe_fromhack) ? MSGSTR_FROMHACK : 0;
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
107 if (pipe_out(msg, hdr_list, rcpt, &(rcpt->local_part[1]), flags)) {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
108 logwrite(LOG_NOTICE, "%s => %s <%s@%s> with pipe\n",
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
109 msg->uid, rcpt->local_part, env_addr->local_part, env_addr->domain);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
110 addr_mark_delivered(rcpt);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
111 return TRUE;
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
112 }
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
113
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
114 if ((errno != (1024 + EX_TEMPFAIL)) && (errno != EAGAIN)) {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
115 addr_mark_failed(rcpt);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
116 } else {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
117 addr_mark_defered(rcpt);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
118 /* has no effect yet, except that mail remains in spool */
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
119 }
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
120 return FALSE;
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
121 }
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
122
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
123 gboolean
366
41958685480d Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents: 354
diff changeset
124 deliver_local_mda(message *msg, GList *hdr_list, address *rcpt, address *env_addr)
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
125 {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
126 gboolean ok = FALSE;
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
127 gchar *cmd = g_malloc(256);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
128 GList *var_table = var_table_rcpt(var_table_msg(NULL, msg), rcpt);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
129 guint flags;
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
130
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
131 DEBUG(1) debugf("attempting to deliver %s with mda\n", msg->uid);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
132
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
133 if (!expand(var_table, conf.mda, cmd, 256)) {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
134 logwrite(LOG_ALERT, "could not expand string %s\n", conf.mda);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
135 destroy_table(var_table);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
136 return FALSE;
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
137 }
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
138
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
139 flags = (conf.mda_fromline) ? MSGSTR_FROMLINE : 0;
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
140 flags |= (conf.mda_fromhack) ? MSGSTR_FROMHACK : 0;
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
141 if (pipe_out(msg, hdr_list, rcpt, cmd, flags)) {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
142 logwrite(LOG_NOTICE, "%s => %s@%s with mda (cmd = '%s')\n",
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
143 msg->uid, rcpt->local_part, rcpt->domain, cmd);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
144 addr_mark_delivered(rcpt);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
145 ok = TRUE;
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
146 } else if ((errno != (1024 + EX_TEMPFAIL)) && (errno != EAGAIN)) {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
147 addr_mark_failed(rcpt);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
148 } else {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
149 addr_mark_defered(rcpt);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
150 /* has no effect yet, except that mail remains in spool */
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
151 }
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
152
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
153 destroy_table(var_table);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
154 return ok;
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
155 }
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
156
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
157 gboolean
366
41958685480d Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents: 354
diff changeset
158 deliver_local(msg_out *msgout)
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
159 {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
160 message *msg = msgout->msg;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
161 GList *rcpt_list = msgout->rcpt_list;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
162 GList *rcpt_node;
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
163 gboolean ok = FALSE, flag = FALSE, ok_fail = FALSE;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
164
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
165 DEBUG(5) debugf("deliver_local entered\n");
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
166
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
167 flag = (msg->data_list == NULL);
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
168 if (flag && !spool_read_data(msg)) {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
169 logwrite(LOG_ALERT, "could not open data spool file for %s\n", msg->uid);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
170 return FALSE;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
171 }
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
172
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
173 for (rcpt_node = g_list_first(rcpt_list); rcpt_node; rcpt_node = g_list_next(rcpt_node)) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
174 GList *hdr_list;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
175 address *rcpt = (address *) (rcpt_node->data);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
176 address *env_addr = addr_find_ancestor(rcpt);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
177 address *ret_path = msg->return_path;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
178 header *retpath_hdr, *envto_hdr;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
179
367
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
180 /*
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
181 ** we need a private copy of the hdr list because we add
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
182 ** headers here that belong to the rcpt only. g_list_copy
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
183 ** copies only the nodes, so it is safe to g_list_free it
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
184 */
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
185 hdr_list = g_list_copy(msg->hdr_list);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
186 retpath_hdr = create_header(HEAD_ENVELOPE_TO, "Envelope-to: %s\n", addr_string(env_addr));
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
187 envto_hdr = create_header(HEAD_RETURN_PATH, "Return-path: %s\n", addr_string(ret_path));
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
188
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
189 hdr_list = g_list_prepend(hdr_list, envto_hdr);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
190 hdr_list = g_list_prepend(hdr_list, retpath_hdr);
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 if (rcpt->local_part[0] == '|') {
367
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
193 /*
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
194 ** probably for expanded aliases, but why not done
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
195 ** like with the mda? //meillo 2010-12-06
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
196 */
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
197 if (deliver_local_pipe(msg, hdr_list, rcpt, env_addr)) {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
198 ok = TRUE;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
199 }
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
200 } else {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
201 /* figure out which mailbox type should be used for this user */
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
202 gchar *user = rcpt->local_part;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
203 gchar *mbox_type = conf.mbox_default;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
204
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
205 if (g_list_find_custom (conf.mbox_users, user, _g_list_strcasecmp)) {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
206 mbox_type = "mbox";
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
207 } else if (g_list_find_custom (conf.mda_users, user, _g_list_strcasecmp)) {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
208 mbox_type = "mda";
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
209 }
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
210
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
211 if (strcmp(mbox_type, "mbox") == 0) {
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
212 if (deliver_local_mbox(msg, hdr_list, rcpt, env_addr)) {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
213 ok = TRUE;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
214 }
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
215 } else if (strcmp(mbox_type, "mda") == 0) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
216 if (conf.mda) {
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
217 if (deliver_local_mda(msg, hdr_list, rcpt, env_addr)) {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
218 ok = TRUE;
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
219 }
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
220 } else {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
221 logwrite(LOG_ALERT, "mbox type is mda, but no mda command given in configuration\n");
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
222 }
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
223
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
224 } else {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
225 logwrite(LOG_ALERT, "unknown mbox type '%s'\n", mbox_type);
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
226 }
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
227 }
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
228
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
229 destroy_header(retpath_hdr);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
230 destroy_header(envto_hdr);
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
231
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
232 g_list_free(hdr_list);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
233 }
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
234 ok_fail = delivery_failures(msg, rcpt_list, "%s (%d)", ext_strerror(errno), errno);
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
235
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
236 if (flag) {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
237 msg_free_data(msg);
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
238 }
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
239 if (ok || ok_fail) {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
240 deliver_finish(msgout);
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
241 }
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
242
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
243 return ok;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
244 }
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
245
367
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
246 /*
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
247 ** make a list of rcpt's of a message that are local
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
248 ** return a new copy of the list
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
249 */
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
250 void
367
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
251 msg_rcptlist_local(GList *rcpt_list, GList **p_local_list,
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
252 GList **p_nonlocal_list)
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
253 {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
254 GList *rcpt_node;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
255
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
256 foreach(rcpt_list, rcpt_node) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
257 address *rcpt = (address *) (rcpt_node->data);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
258 GList *dom_node;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
259
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
260 DEBUG(5) debugf("checking address %s\n", rcpt->address);
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
261
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
262 /* search for local host list: */
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
263 foreach(conf.local_hosts, dom_node) {
375
3f923f97563b local_hosts now understands glob patterns like `*example.org'.
markus schnalke <meillo@marmaro.de>
parents: 374
diff changeset
264 if (fnmatch(dom_node->data, rcpt->domain, FNM_CASEFOLD)==0) {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
265 *p_local_list = g_list_append(*p_local_list, rcpt);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
266 DEBUG(5) debugf("<%s@%s> is local\n", rcpt->local_part, rcpt->domain);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
267 break;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
268 } else {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
269 *p_nonlocal_list = g_list_append(*p_nonlocal_list, rcpt);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
270 }
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
271 }
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
272 }
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
273 }
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
274
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
275 gboolean
370
d86d7b4b8995 Broke long lines.
markus schnalke <meillo@marmaro.de>
parents: 367
diff changeset
276 deliver_msglist_host_pipe(connect_route *route, GList *msgout_list,
d86d7b4b8995 Broke long lines.
markus schnalke <meillo@marmaro.de>
parents: 367
diff changeset
277 gchar *host, GList *res_list)
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
278 {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
279 gboolean ok = TRUE;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
280 GList *msgout_node;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
281
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
282 DEBUG(5) debugf("deliver_msglist_host_pipe entered\n");
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
283
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
284 foreach(msgout_list, msgout_node) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
285 msg_out *msgout = (msg_out *) (msgout_node->data);
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
286 gboolean flag, ok_fail = FALSE;
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
287 message *msg = msgout->msg;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
288 GList *rcpt_node, *rcpt_list = msgout->rcpt_list;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
289
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
290 DEBUG(1) debugf("attempting to deliver %s with pipe\n", msg->uid);
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
291
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
292 flag = (msg->data_list == NULL);
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
293 if (flag && !spool_read_data(msg)) {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
294 logwrite(LOG_ALERT, "could not open data spool file for %s\n", msg->uid);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
295 continue;
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
296 }
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
297
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
298 ok = FALSE;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
299 foreach(rcpt_list, rcpt_node) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
300 address *rcpt = (address *) (rcpt_node->data);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
301 gchar *cmd = g_malloc(256);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
302 GList *var_table = var_table_rcpt(var_table_msg(NULL, msg), rcpt);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
303
321
412385b57dc4 refactoring
meillo@marmaro.de
parents: 317
diff changeset
304 DEBUG(1) debugf("attempting to deliver %s to %s@%s with pipe\n",
412385b57dc4 refactoring
meillo@marmaro.de
parents: 317
diff changeset
305 msg->uid, rcpt->local_part, rcpt->domain);
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
306
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
307 if (!expand(var_table, route->pipe, cmd, 256)) {
321
412385b57dc4 refactoring
meillo@marmaro.de
parents: 317
diff changeset
308 logwrite(LOG_ALERT, "could not expand string `%s'\n", route->pipe);
412385b57dc4 refactoring
meillo@marmaro.de
parents: 317
diff changeset
309 destroy_table(var_table);
412385b57dc4 refactoring
meillo@marmaro.de
parents: 317
diff changeset
310 continue;
412385b57dc4 refactoring
meillo@marmaro.de
parents: 317
diff changeset
311 }
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
312
321
412385b57dc4 refactoring
meillo@marmaro.de
parents: 317
diff changeset
313 if (pipe_out(msg, msg->hdr_list, rcpt, cmd, (route->pipe_fromline ? MSGSTR_FROMLINE : 0)
412385b57dc4 refactoring
meillo@marmaro.de
parents: 317
diff changeset
314 | (route->pipe_fromhack ? MSGSTR_FROMHACK : 0))) {
412385b57dc4 refactoring
meillo@marmaro.de
parents: 317
diff changeset
315 logwrite(LOG_NOTICE, "%s => %s@%s with pipe (cmd = '%s')\n",
412385b57dc4 refactoring
meillo@marmaro.de
parents: 317
diff changeset
316 msg->uid, rcpt->local_part, rcpt->domain, cmd);
412385b57dc4 refactoring
meillo@marmaro.de
parents: 317
diff changeset
317 addr_mark_delivered(rcpt);
412385b57dc4 refactoring
meillo@marmaro.de
parents: 317
diff changeset
318 ok = TRUE;
412385b57dc4 refactoring
meillo@marmaro.de
parents: 317
diff changeset
319 } else {
412385b57dc4 refactoring
meillo@marmaro.de
parents: 317
diff changeset
320 logwrite(LOG_ALERT, "pipe_out '%s' failed\n", route->pipe);
412385b57dc4 refactoring
meillo@marmaro.de
parents: 317
diff changeset
321
412385b57dc4 refactoring
meillo@marmaro.de
parents: 317
diff changeset
322 if (route->connect_error_fail) {
412385b57dc4 refactoring
meillo@marmaro.de
parents: 317
diff changeset
323 addr_mark_failed(rcpt);
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
324 } else {
321
412385b57dc4 refactoring
meillo@marmaro.de
parents: 317
diff changeset
325 addr_mark_defered(rcpt);
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
326 }
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
327 }
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
328
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
329 destroy_table(var_table);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
330 }
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
331 ok_fail = delivery_failures(msg, rcpt_list, "%s", strerror(errno));
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
332
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
333 if (flag) {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
334 msg_free_data(msg);
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
335 }
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
336 if (ok || ok_fail) {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
337 deliver_finish(msgout);
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
338 }
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
339 }
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
340
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
341 return ok;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
342 }
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
343
367
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
344 /*
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
345 ** deliver list of messages to one host and finishes them if the message was
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
346 ** delivered to at least one rcpt.
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
347 ** Returns TRUE if at least one msg was delivered to at least one rcpt.
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
348 */
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
349 gboolean
367
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
350 deliver_msglist_host_smtp(connect_route *route, GList *msgout_list,
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
351 gchar *host, GList *res_list)
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
352 {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
353 gboolean ok = FALSE;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
354 GList *msgout_node;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
355 smtp_base *psb;
178
91f8ee6514f5 removed `remote_port' config option
meillo@marmaro.de
parents: 114
diff changeset
356 gint port = 25;
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
357
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
358 /* paranoid check: */
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
359 if (!msgout_list) {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
360 logwrite(LOG_ALERT, "Ooops: empty list of messages in deliver_msglist_host()\n");
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
361 return FALSE;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
362 }
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
363
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
364 if (!host) {
179
3190e6864452 added comments to deliver.c (stuff to check)
meillo@marmaro.de
parents: 178
diff changeset
365 /* XXX: what if mail_host isn't set? Is this possible? */
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
366 host = route->mail_host->address;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
367 port = route->mail_host->port;
178
91f8ee6514f5 removed `remote_port' config option
meillo@marmaro.de
parents: 114
diff changeset
368 }
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
369
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
370 if (route->wrapper) {
372
b0708fac99dd Fixed a problem with psb->remote_host, introduced in changeset 412385b57dc4
markus schnalke <meillo@marmaro.de>
parents: 370
diff changeset
371 psb = smtp_out_open_child(route->wrapper);
b0708fac99dd Fixed a problem with psb->remote_host, introduced in changeset 412385b57dc4
markus schnalke <meillo@marmaro.de>
parents: 370
diff changeset
372 if (psb) {
b0708fac99dd Fixed a problem with psb->remote_host, introduced in changeset 412385b57dc4
markus schnalke <meillo@marmaro.de>
parents: 370
diff changeset
373 psb->remote_host = host;
b0708fac99dd Fixed a problem with psb->remote_host, introduced in changeset 412385b57dc4
markus schnalke <meillo@marmaro.de>
parents: 370
diff changeset
374 }
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
375 } else {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
376 psb = smtp_out_open(host, port, res_list);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
377 }
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
378
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
379 if (!psb) {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
380 /* smtp_out_open() failed */
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
381 foreach(msgout_list, msgout_node) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
382 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
383 GList *rcpt_node;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
384
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
385 for (rcpt_node = g_list_first(msgout->rcpt_list);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
386 rcpt_node;
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
387 rcpt_node = g_list_next(rcpt_node)) {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
388 address *rcpt = (address *) (rcpt_node->data);
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
389 gboolean ret = FALSE;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
390
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
391 addr_unmark_delivered(rcpt);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
392 if (route->connect_error_fail) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
393 addr_mark_failed(rcpt);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
394 } else {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
395 addr_mark_defered(rcpt);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
396 }
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
397 if (route->wrapper) {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
398 ret = delivery_failures(msgout->msg, msgout->rcpt_list, "could not open wrapper:\n\t%s", strerror(errno));
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
399 } else {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
400 ret = delivery_failures(msgout->msg, msgout->rcpt_list, "could not open connection to %s:%d :\n\t%s", host, port, h_errno != 0 ? hstrerror(h_errno) : strerror(errno));
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
401 }
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
402 if (ret) {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
403 deliver_finish(msgout);
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
404 }
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
405 }
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
406 }
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
407 return ok;
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
408 }
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
409
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
410 set_heloname(psb, route->helo_name ? route->helo_name : conf.host_name, route->do_correct_helo);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
411
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
412 #ifdef ENABLE_AUTH
321
412385b57dc4 refactoring
meillo@marmaro.de
parents: 317
diff changeset
413 if (route->auth_name && route->auth_login && route->auth_secret) {
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
414 set_auth(psb, route->auth_name, route->auth_login, route->auth_secret);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
415 }
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
416 #endif
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
417 if (!smtp_out_init(psb, route->instant_helo)) {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
418 /* smtp_out_init() failed */
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
419 if ((psb->error==smtp_fail) || (psb->error==smtp_trylater) || (psb->error==smtp_syntax)) {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
420 smtp_out_quit(psb);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
421
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
422 foreach(msgout_list, msgout_node) {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
423 msg_out *msgout = (msg_out *) (msgout_node->data);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
424 smtp_out_mark_rcpts(psb, msgout->rcpt_list);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
425
374
a96bb42f597d Improved log/debug messages.
markus schnalke <meillo@marmaro.de>
parents: 372
diff changeset
426 if (delivery_failures(msgout->msg, msgout->rcpt_list, "while connected with %s, the server replied\n\t%s", (route->wrapper) ? "<wrapper>" : host, psb->buffer)) {
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
427 deliver_finish(msgout);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
428 }
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
429 }
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
430 }
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
431 destroy_smtpbase(psb);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
432 return ok;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
433 }
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
434
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
435 if (!route->do_pipelining) {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
436 psb->use_pipelining = FALSE;
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
437 }
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
438
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
439 foreach(msgout_list, msgout_node) {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
440 msg_out *msgout = (msg_out *) (msgout_node->data);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
441 gboolean flag, ok_msg = FALSE, ok_fail = FALSE;
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
442 message *msg = msgout->msg;
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
443
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
444 /* we may have to read the data at this point and remember if we did */
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
445 flag = (msg->data_list == NULL);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
446 if (flag && !spool_read_data(msg)) {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
447 logwrite(LOG_ALERT, "could not open data spool file %s\n", msg->uid);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
448 break;
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
449 }
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
450
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
451 smtp_out_msg(psb, msg, msgout->return_path, msgout->rcpt_list, msgout->hdr_list);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
452
374
a96bb42f597d Improved log/debug messages.
markus schnalke <meillo@marmaro.de>
parents: 372
diff changeset
453 ok_fail = delivery_failures(msg, msgout->rcpt_list, "while connected with %s, the server replied\n\t%s", (route->wrapper) ? "<wrapper>" : host, psb->buffer);
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
454
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
455 if ((psb->error == smtp_eof) || (psb->error == smtp_timeout)) {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
456 /* connection lost */
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
457 break;
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
458 } else if (psb->error != smtp_ok) {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
459 if (g_list_next(msgout_node) && !smtp_out_rset(psb)) {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
460 break;
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
461 }
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
462 }
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
463 ok_msg = (psb->error == smtp_ok);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
464
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
465 if (flag) {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
466 msg_free_data(msg);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
467 }
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
468 if (ok_msg) {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
469 ok = TRUE;
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
470 }
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
471 if (ok_msg || ok_fail) {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
472 deliver_finish(msgout);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
473 }
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
474 }
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
475 if (psb->error == smtp_ok || (psb->error == smtp_fail)
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
476 || (psb->error == smtp_trylater) || (psb->error == smtp_syntax)) {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
477 smtp_out_quit(psb);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
478 }
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
479 destroy_smtpbase(psb);
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
480 return ok;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
481 }
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
482
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
483 gboolean
370
d86d7b4b8995 Broke long lines.
markus schnalke <meillo@marmaro.de>
parents: 367
diff changeset
484 deliver_msglist_host(connect_route *route, GList *msgout_list, gchar *host,
d86d7b4b8995 Broke long lines.
markus schnalke <meillo@marmaro.de>
parents: 367
diff changeset
485 GList *res_list)
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
486 {
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
487
311
e230bcd0f1c6 removed protocol option from route config
meillo@marmaro.de
parents: 310
diff changeset
488 if (route->pipe) {
e230bcd0f1c6 removed protocol option from route config
meillo@marmaro.de
parents: 310
diff changeset
489 DEBUG(5) debugf("with pipe\n");
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
490 return deliver_msglist_host_pipe(route, msgout_list, host, res_list);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
491 } else {
311
e230bcd0f1c6 removed protocol option from route config
meillo@marmaro.de
parents: 310
diff changeset
492 DEBUG(5) debugf("with smtp\n");
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
493 return deliver_msglist_host_smtp(route, msgout_list, host, res_list);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
494 }
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
495 }
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
496
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
497 /*
367
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
498 ** delivers messages in msgout_list using route
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
499 */
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
500 gboolean
366
41958685480d Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents: 354
diff changeset
501 deliver_route_msgout_list(connect_route *route, GList *msgout_list)
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
502 {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
503 gboolean ok = FALSE;
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
504 GList *mo_ph_list;
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
505 GList *mo_ph_node;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
506
15
f671821d8222 code beautifying; 0 -> \0 if appropriate
meillo@marmaro.de
parents: 12
diff changeset
507 DEBUG(5) debugf("deliver_route_msgout_list entered, route->name = %s\n", route->name);
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
508
179
3190e6864452 added comments to deliver.c (stuff to check)
meillo@marmaro.de
parents: 178
diff changeset
509 if (route->mail_host) {
3190e6864452 added comments to deliver.c (stuff to check)
meillo@marmaro.de
parents: 178
diff changeset
510 /* this is easy... deliver everything to a smart host for relay */
370
d86d7b4b8995 Broke long lines.
markus schnalke <meillo@marmaro.de>
parents: 367
diff changeset
511 return deliver_msglist_host(route, msgout_list, NULL,
d86d7b4b8995 Broke long lines.
markus schnalke <meillo@marmaro.de>
parents: 367
diff changeset
512 route->resolve_list);
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
513 }
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
514
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
515 /* this is not easy... */
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
516
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
517 mo_ph_list = route_msgout_list(route, msgout_list);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
518 /* okay, now we have ordered our messages by the hosts. */
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
519 if (!mo_ph_list) {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
520 return FALSE;
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
521 }
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
522
367
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
523 /*
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
524 ** TODO: It would be nice to be able to fork for each host.
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
525 ** We cannot do that yet because of complications with finishing the
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
526 ** messages. Threads could be a solution because they use the same
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
527 ** memory. But we are not thread safe yet...
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
528 */
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
529 foreach(mo_ph_list, mo_ph_node) {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
530 msgout_perhost *mo_ph = (msgout_perhost *) (mo_ph_node->data);
370
d86d7b4b8995 Broke long lines.
markus schnalke <meillo@marmaro.de>
parents: 367
diff changeset
531 if (deliver_msglist_host(route, mo_ph->msgout_list,
d86d7b4b8995 Broke long lines.
markus schnalke <meillo@marmaro.de>
parents: 367
diff changeset
532 mo_ph->host, route->resolve_list)) {
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
533 ok = TRUE;
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
534 }
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
535 destroy_msgout_perhost(mo_ph);
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
536 }
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
537 g_list_free(mo_ph_list);
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
538 return ok;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
539 }
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
540
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
541 /*
367
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
542 ** calls route_prepare_msg()
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
543 ** delivers messages in msg_list using route by calling
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
544 ** deliver_route_msgout_list()
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
545 */
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
546 gboolean
366
41958685480d Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents: 354
diff changeset
547 deliver_route_msg_list(connect_route *route, GList *msgout_list)
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
548 {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
549 GList *msgout_list_deliver = NULL;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
550 GList *msgout_node;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
551 gboolean ok = TRUE;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
552
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
553 DEBUG(6) debugf("deliver_route_msg_list()\n");
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
554
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
555 foreach(msgout_list, msgout_node) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
556 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
557 msg_out *msgout_cloned = clone_msg_out(msgout);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
558 GList *rcpt_list_non_delivered = NULL;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
559 GList *rcpt_node;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
560
367
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
561 /*
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
562 ** we have to delete already delivered rcpt's because a
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
563 ** previous route may have delivered to it
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
564 */
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
565 foreach(msgout_cloned->rcpt_list, rcpt_node) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
566 address *rcpt = (address *) (rcpt_node->data);
367
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
567 /*
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
568 ** failed addresses already have been bounced;
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
569 ** there should be a better way to handle those.
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
570 */
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
571 if (!addr_is_delivered(rcpt) && !addr_is_failed(rcpt)
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
572 && !(rcpt->flags & ADDR_FLAG_LAST_ROUTE)) {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
573 rcpt_list_non_delivered = g_list_append(rcpt_list_non_delivered, rcpt);
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
574 }
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
575 }
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
576 g_list_free(msgout_cloned->rcpt_list);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
577 msgout_cloned->rcpt_list = rcpt_list_non_delivered;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
578
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
579 if (!msgout_cloned->rcpt_list) {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
580 destroy_msg_out(msgout_cloned);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
581 continue;
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
582 }
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
583
317
55b7bde95d37 reworked allowed and denied addrs for routes
meillo@marmaro.de
parents: 315
diff changeset
584 /* filter by allowed envelope sender */
55b7bde95d37 reworked allowed and denied addrs for routes
meillo@marmaro.de
parents: 315
diff changeset
585 if (!route_sender_is_allowed(route, msgout->msg->return_path)) {
374
a96bb42f597d Improved log/debug messages.
markus schnalke <meillo@marmaro.de>
parents: 372
diff changeset
586 DEBUG(6) debugf("sender `%s' is not allowed for this route\n", msgout->msg->return_path);
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
587 destroy_msg_out(msgout_cloned);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
588 continue;
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
589 }
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
590
317
55b7bde95d37 reworked allowed and denied addrs for routes
meillo@marmaro.de
parents: 315
diff changeset
591 /* filter by allowed envelope rcpts */
366
41958685480d Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents: 354
diff changeset
592 GList *rcpt_list_allowed = NULL;
41958685480d Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents: 354
diff changeset
593 GList *rcpt_list_notallowed = NULL;
370
d86d7b4b8995 Broke long lines.
markus schnalke <meillo@marmaro.de>
parents: 367
diff changeset
594 route_split_rcpts(route, msgout_cloned->rcpt_list,
d86d7b4b8995 Broke long lines.
markus schnalke <meillo@marmaro.de>
parents: 367
diff changeset
595 &rcpt_list_allowed, &rcpt_list_notallowed);
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
596 if (!rcpt_list_allowed) {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
597 destroy_msg_out(msgout_cloned);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
598 continue;
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
599 }
317
55b7bde95d37 reworked allowed and denied addrs for routes
meillo@marmaro.de
parents: 315
diff changeset
600
370
d86d7b4b8995 Broke long lines.
markus schnalke <meillo@marmaro.de>
parents: 367
diff changeset
601 logwrite(LOG_NOTICE, "%s using '%s'\n", msgout->msg->uid,
d86d7b4b8995 Broke long lines.
markus schnalke <meillo@marmaro.de>
parents: 367
diff changeset
602 route->name);
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
603
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
604 g_list_free(msgout_cloned->rcpt_list);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
605 msgout_cloned->rcpt_list = rcpt_list_allowed;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
606
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
607 if (route->last_route) {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
608 GList *rcpt_node;
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
609 foreach(msgout_cloned->rcpt_list, rcpt_node) {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
610 address *rcpt = (address *) (rcpt_node->data);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
611 rcpt->flags |= ADDR_FLAG_LAST_ROUTE;
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
612 }
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
613 }
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
614
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
615 route_prepare_msgout(route, msgout_cloned);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
616 msgout_list_deliver = g_list_append(msgout_list_deliver, msgout_cloned);
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
617 }
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
618
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
619 if (msgout_list_deliver) {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
620 if (deliver_route_msgout_list(route, msgout_list_deliver)) {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
621 ok = TRUE;
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
622 }
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
623 destroy_msg_out_list(msgout_list_deliver);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
624 }
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
625 return ok;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
626 }
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
627
367
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
628 /*
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
629 ** copy pointers of delivered addresses to the msg's non_rcpt_list,
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
630 ** to make sure that they will not be delivered again.
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
631 */
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
632 void
366
41958685480d Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents: 354
diff changeset
633 update_non_rcpt_list(msg_out *msgout)
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
634 {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
635 GList *rcpt_node;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
636 message *msg = msgout->msg;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
637
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
638 foreach(msgout->rcpt_list, rcpt_node) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
639 address *rcpt = (address *) (rcpt_node->data);
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
640 if (addr_is_delivered(rcpt) || addr_is_failed(rcpt)) {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
641 msg->non_rcpt_list = g_list_append(msg->non_rcpt_list, rcpt);
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
642 }
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
643 }
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
644 }
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
645
367
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
646 /*
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
647 ** after delivery attempts, we check if there are any rcpt addresses left in
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
648 ** the message. If all addresses have been completed, the spool files will be
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
649 ** deleted, otherwise the header spool will be written back. We never changed
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
650 ** the data spool, so there is no need to write that back.
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
651 **
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
652 ** returns TRUE if all went well.
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
653 */
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
654 gboolean
366
41958685480d Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents: 354
diff changeset
655 deliver_finish(msg_out *msgout)
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
656 {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
657 GList *rcpt_node;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
658 message *msg = msgout->msg;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
659 gboolean finished = TRUE;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
660
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
661 update_non_rcpt_list(msgout);
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
662
367
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
663 /*
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
664 ** we NEVER made copies of the addresses, flags affecting addresses
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
665 ** were always set on the original address structs
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
666 */
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
667 foreach(msg->rcpt_list, rcpt_node) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
668 address *rcpt = (address *) (rcpt_node->data);
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
669 if (!addr_is_finished_children(rcpt)) {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
670 finished = FALSE;
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
671 } else {
367
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
672 /*
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
673 ** if ALL children have been delivered, mark parent as
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
674 ** delivered. if there is one or more not delivered,
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
675 ** it must have failed, we mark the parent as failed
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
676 ** as well.
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
677 */
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
678 if (addr_is_delivered_children(rcpt)) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
679 addr_mark_delivered(rcpt);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
680 } else {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
681 addr_mark_failed(rcpt);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
682 }
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
683 }
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
684 }
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
685
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
686 if (finished) {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
687 if (spool_delete_all(msg)) {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
688 logwrite(LOG_NOTICE, "%s completed.\n", msg->uid);
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
689 return TRUE;
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
690 }
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
691 return FALSE;
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
692 }
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
693
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
694 /* one not delivered address was found */
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
695 if (!spool_write(msg, FALSE)) {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
696 logwrite(LOG_ALERT, "could not write back spool header for %s\n", msg->uid);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
697 return FALSE;
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
698 }
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
699
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
700 DEBUG(2) debugf("spool header for %s written back.\n", msg->uid);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
701 return TRUE;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
702 }
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
703
354
08932c629849 reworked the route concept; removed the idea of the localnet
markus schnalke <meillo@marmaro.de>
parents: 350
diff changeset
704 int
366
41958685480d Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents: 354
diff changeset
705 deliver_remote(GList *remote_msgout_list)
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
706 {
354
08932c629849 reworked the route concept; removed the idea of the localnet
markus schnalke <meillo@marmaro.de>
parents: 350
diff changeset
707 int ok = TRUE;
08932c629849 reworked the route concept; removed the idea of the localnet
markus schnalke <meillo@marmaro.de>
parents: 350
diff changeset
708 GList *route_list = NULL;
08932c629849 reworked the route concept; removed the idea of the localnet
markus schnalke <meillo@marmaro.de>
parents: 350
diff changeset
709 GList *route_node;
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
710 GList *rf_list = NULL;
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
711 gchar *connect_name = NULL;
354
08932c629849 reworked the route concept; removed the idea of the localnet
markus schnalke <meillo@marmaro.de>
parents: 350
diff changeset
712
08932c629849 reworked the route concept; removed the idea of the localnet
markus schnalke <meillo@marmaro.de>
parents: 350
diff changeset
713 if (!remote_msgout_list) {
08932c629849 reworked the route concept; removed the idea of the localnet
markus schnalke <meillo@marmaro.de>
parents: 350
diff changeset
714 return FALSE;
08932c629849 reworked the route concept; removed the idea of the localnet
markus schnalke <meillo@marmaro.de>
parents: 350
diff changeset
715 }
08932c629849 reworked the route concept; removed the idea of the localnet
markus schnalke <meillo@marmaro.de>
parents: 350
diff changeset
716
08932c629849 reworked the route concept; removed the idea of the localnet
markus schnalke <meillo@marmaro.de>
parents: 350
diff changeset
717 /* perma routes */
08932c629849 reworked the route concept; removed the idea of the localnet
markus schnalke <meillo@marmaro.de>
parents: 350
diff changeset
718 if (conf.perma_routes) {
08932c629849 reworked the route concept; removed the idea of the localnet
markus schnalke <meillo@marmaro.de>
parents: 350
diff changeset
719 DEBUG(5) debugf("processing perma_routes\n");
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
720
354
08932c629849 reworked the route concept; removed the idea of the localnet
markus schnalke <meillo@marmaro.de>
parents: 350
diff changeset
721 route_list = read_route_list(conf.perma_routes, TRUE);
08932c629849 reworked the route concept; removed the idea of the localnet
markus schnalke <meillo@marmaro.de>
parents: 350
diff changeset
722 foreach(route_list, route_node) {
08932c629849 reworked the route concept; removed the idea of the localnet
markus schnalke <meillo@marmaro.de>
parents: 350
diff changeset
723 connect_route *route = (connect_route *) (route_node->data);
08932c629849 reworked the route concept; removed the idea of the localnet
markus schnalke <meillo@marmaro.de>
parents: 350
diff changeset
724 if (!deliver_route_msg_list(route, remote_msgout_list)) {
08932c629849 reworked the route concept; removed the idea of the localnet
markus schnalke <meillo@marmaro.de>
parents: 350
diff changeset
725 ok = FALSE;
08932c629849 reworked the route concept; removed the idea of the localnet
markus schnalke <meillo@marmaro.de>
parents: 350
diff changeset
726 }
08932c629849 reworked the route concept; removed the idea of the localnet
markus schnalke <meillo@marmaro.de>
parents: 350
diff changeset
727 }
08932c629849 reworked the route concept; removed the idea of the localnet
markus schnalke <meillo@marmaro.de>
parents: 350
diff changeset
728 destroy_route_list(route_list);
08932c629849 reworked the route concept; removed the idea of the localnet
markus schnalke <meillo@marmaro.de>
parents: 350
diff changeset
729 }
08932c629849 reworked the route concept; removed the idea of the localnet
markus schnalke <meillo@marmaro.de>
parents: 350
diff changeset
730
08932c629849 reworked the route concept; removed the idea of the localnet
markus schnalke <meillo@marmaro.de>
parents: 350
diff changeset
731 /* query routes */
310
f10a56dc7481 reworked online_detect to the simpler online_query
meillo@marmaro.de
parents: 280
diff changeset
732 connect_name = online_query();
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
733 if (!connect_name) {
344
0410c8aabac2 improved comments and debug messages
markus schnalke <meillo@marmaro.de>
parents: 343
diff changeset
734 DEBUG(5) debugf("online query returned false\n");
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
735 return FALSE;
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
736 }
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
737
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
738 /* we are online! */
344
0410c8aabac2 improved comments and debug messages
markus schnalke <meillo@marmaro.de>
parents: 343
diff changeset
739 DEBUG(5) debugf("processing query_routes\n");
0410c8aabac2 improved comments and debug messages
markus schnalke <meillo@marmaro.de>
parents: 343
diff changeset
740 logwrite(LOG_NOTICE, "detected online configuration `%s'\n", connect_name);
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
741
354
08932c629849 reworked the route concept; removed the idea of the localnet
markus schnalke <meillo@marmaro.de>
parents: 350
diff changeset
742 rf_list = (GList *) table_find(conf.query_routes, connect_name);
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
743 if (!rf_list) {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
744 logwrite(LOG_ALERT, "route list with name '%s' not found.\n", connect_name);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
745 return FALSE;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
746 }
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
747
321
412385b57dc4 refactoring
meillo@marmaro.de
parents: 317
diff changeset
748 route_list = read_route_list(rf_list, FALSE);
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
749 if (!route_list) {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
750 logwrite(LOG_ALERT, "could not read route list '%s'\n", connect_name);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
751 return FALSE;
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
752 }
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
753
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
754 foreach(route_list, route_node) {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
755 connect_route *route = (connect_route *) (route_node->data);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
756 /* TODO: ok gets overwritten */
354
08932c629849 reworked the route concept; removed the idea of the localnet
markus schnalke <meillo@marmaro.de>
parents: 350
diff changeset
757 ok = deliver_route_msg_list(route, remote_msgout_list);
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
758 }
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
759 destroy_route_list(route_list);
344
0410c8aabac2 improved comments and debug messages
markus schnalke <meillo@marmaro.de>
parents: 343
diff changeset
760
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
761 return ok;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
762 }
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
763
321
412385b57dc4 refactoring
meillo@marmaro.de
parents: 317
diff changeset
764 /*
367
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
765 ** This function splits the list of rcpt addresses
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
766 ** into local and remote addresses and processes them accordingly.
321
412385b57dc4 refactoring
meillo@marmaro.de
parents: 317
diff changeset
767 */
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
768 gboolean
366
41958685480d Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents: 354
diff changeset
769 deliver_msg_list(GList *msg_list, guint flags)
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
770 {
343
9149d893eb52 refactoring: ``insourced'' create_msg_out_list()
markus schnalke <meillo@marmaro.de>
parents: 321
diff changeset
771 GList *msgout_list = NULL;
9149d893eb52 refactoring: ``insourced'' create_msg_out_list()
markus schnalke <meillo@marmaro.de>
parents: 321
diff changeset
772 GList *msg_node;
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
773 GList *local_msgout_list = NULL;
354
08932c629849 reworked the route concept; removed the idea of the localnet
markus schnalke <meillo@marmaro.de>
parents: 350
diff changeset
774 GList *remote_msgout_list = NULL;
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
775 GList *msgout_node;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
776 GList *alias_table = NULL;
387
a408411ff8df Added a glob-pattern aliasing facility.
markus schnalke <meillo@marmaro.de>
parents: 375
diff changeset
777 GList *globalias_table = NULL;
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
778 gboolean ok = TRUE;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
779
343
9149d893eb52 refactoring: ``insourced'' create_msg_out_list()
markus schnalke <meillo@marmaro.de>
parents: 321
diff changeset
780 /* create msgout_list */
9149d893eb52 refactoring: ``insourced'' create_msg_out_list()
markus schnalke <meillo@marmaro.de>
parents: 321
diff changeset
781 foreach(msg_list, msg_node) {
9149d893eb52 refactoring: ``insourced'' create_msg_out_list()
markus schnalke <meillo@marmaro.de>
parents: 321
diff changeset
782 message *msg = (message *) msg_node->data;
9149d893eb52 refactoring: ``insourced'' create_msg_out_list()
markus schnalke <meillo@marmaro.de>
parents: 321
diff changeset
783 msgout_list = g_list_append(msgout_list, create_msg_out(msg));
9149d893eb52 refactoring: ``insourced'' create_msg_out_list()
markus schnalke <meillo@marmaro.de>
parents: 321
diff changeset
784 }
9149d893eb52 refactoring: ``insourced'' create_msg_out_list()
markus schnalke <meillo@marmaro.de>
parents: 321
diff changeset
785
387
a408411ff8df Added a glob-pattern aliasing facility.
markus schnalke <meillo@marmaro.de>
parents: 375
diff changeset
786 if (conf.globalias_file) {
a408411ff8df Added a glob-pattern aliasing facility.
markus schnalke <meillo@marmaro.de>
parents: 375
diff changeset
787 globalias_table = table_read(conf.globalias_file, ':');
a408411ff8df Added a glob-pattern aliasing facility.
markus schnalke <meillo@marmaro.de>
parents: 375
diff changeset
788 }
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
789 if (conf.alias_file) {
17
6c59dedd06be fixed delivery with empty or non-existent alias file
meillo@marmaro.de
parents: 15
diff changeset
790 alias_table = table_read(conf.alias_file, ':');
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
791 }
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
792
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
793 /* sort messages for different deliveries */
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
794 foreach(msgout_list, msgout_node) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
795 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
796 GList *rcpt_list;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
797 GList *local_rcpt_list = NULL;
237
5f9f3a65032e refactoring: new function split_rcpts() replaces two others
markus schnalke <meillo@marmaro.de>
parents: 224
diff changeset
798 GList *other_rcpt_list = NULL;
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
799
114
a80ebfa16cd5 better debugging output (thanks to Paolo)
meillo@marmaro.de
parents: 76
diff changeset
800 if (!spool_lock(msgout->msg->uid)) {
a80ebfa16cd5 better debugging output (thanks to Paolo)
meillo@marmaro.de
parents: 76
diff changeset
801 DEBUG(5) debugf("spool_lock(%s) failed.\n", msgout->msg->uid);
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
802 continue;
114
a80ebfa16cd5 better debugging output (thanks to Paolo)
meillo@marmaro.de
parents: 76
diff changeset
803 }
a80ebfa16cd5 better debugging output (thanks to Paolo)
meillo@marmaro.de
parents: 76
diff changeset
804 DEBUG(5) debugf("spool_lock(%s)\n", msgout->msg->uid);
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
805
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
806 rcpt_list = g_list_copy(msgout->msg->rcpt_list);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
807 if (conf.log_user) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
808 address *addr = create_address_qualified(conf.log_user, TRUE, conf.host_name);
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
809 if (addr) {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
810 rcpt_list = g_list_prepend(rcpt_list, addr);
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
811 } else {
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
812 logwrite(LOG_ALERT, "invalid log_user address `%s', ignoring\n", conf.log_user);
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
813 }
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
814 }
387
a408411ff8df Added a glob-pattern aliasing facility.
markus schnalke <meillo@marmaro.de>
parents: 375
diff changeset
815 if (globalias_table) {
a408411ff8df Added a glob-pattern aliasing facility.
markus schnalke <meillo@marmaro.de>
parents: 375
diff changeset
816 GList *globaliased_rcpt_list;
a408411ff8df Added a glob-pattern aliasing facility.
markus schnalke <meillo@marmaro.de>
parents: 375
diff changeset
817 globaliased_rcpt_list = alias_expand(globalias_table,
a408411ff8df Added a glob-pattern aliasing facility.
markus schnalke <meillo@marmaro.de>
parents: 375
diff changeset
818 rcpt_list,
a408411ff8df Added a glob-pattern aliasing facility.
markus schnalke <meillo@marmaro.de>
parents: 375
diff changeset
819 msgout->msg->non_rcpt_list, 1);
a408411ff8df Added a glob-pattern aliasing facility.
markus schnalke <meillo@marmaro.de>
parents: 375
diff changeset
820 g_list_free(rcpt_list);
a408411ff8df Added a glob-pattern aliasing facility.
markus schnalke <meillo@marmaro.de>
parents: 375
diff changeset
821 rcpt_list = globaliased_rcpt_list;
a408411ff8df Added a glob-pattern aliasing facility.
markus schnalke <meillo@marmaro.de>
parents: 375
diff changeset
822 }
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
823 if (alias_table) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
824 GList *aliased_rcpt_list;
387
a408411ff8df Added a glob-pattern aliasing facility.
markus schnalke <meillo@marmaro.de>
parents: 375
diff changeset
825 aliased_rcpt_list = alias_expand(alias_table,
a408411ff8df Added a glob-pattern aliasing facility.
markus schnalke <meillo@marmaro.de>
parents: 375
diff changeset
826 rcpt_list,
a408411ff8df Added a glob-pattern aliasing facility.
markus schnalke <meillo@marmaro.de>
parents: 375
diff changeset
827 msgout->msg->non_rcpt_list, 0);
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
828 g_list_free(rcpt_list);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
829 rcpt_list = aliased_rcpt_list;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
830 }
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
831
366
41958685480d Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents: 354
diff changeset
832 /* split_rcpts(rcpt_list, NULL, &local_rcpt_list, NULL, &other_rcpt_list); */
354
08932c629849 reworked the route concept; removed the idea of the localnet
markus schnalke <meillo@marmaro.de>
parents: 350
diff changeset
833 local_rcpt_list = local_rcpts(rcpt_list);
08932c629849 reworked the route concept; removed the idea of the localnet
markus schnalke <meillo@marmaro.de>
parents: 350
diff changeset
834 other_rcpt_list = remote_rcpts(rcpt_list);
237
5f9f3a65032e refactoring: new function split_rcpts() replaces two others
markus schnalke <meillo@marmaro.de>
parents: 224
diff changeset
835 g_list_free(rcpt_list);
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
836
237
5f9f3a65032e refactoring: new function split_rcpts() replaces two others
markus schnalke <meillo@marmaro.de>
parents: 224
diff changeset
837 /* local recipients */
5f9f3a65032e refactoring: new function split_rcpts() replaces two others
markus schnalke <meillo@marmaro.de>
parents: 224
diff changeset
838 if ((flags & DLVR_LOCAL) && local_rcpt_list) {
5f9f3a65032e refactoring: new function split_rcpts() replaces two others
markus schnalke <meillo@marmaro.de>
parents: 224
diff changeset
839 msg_out *local_msgout = clone_msg_out(msgout);
5f9f3a65032e refactoring: new function split_rcpts() replaces two others
markus schnalke <meillo@marmaro.de>
parents: 224
diff changeset
840 local_msgout->rcpt_list = local_rcpt_list;
5f9f3a65032e refactoring: new function split_rcpts() replaces two others
markus schnalke <meillo@marmaro.de>
parents: 224
diff changeset
841 local_msgout_list = g_list_append(local_msgout_list, local_msgout);
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
842 }
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
843
354
08932c629849 reworked the route concept; removed the idea of the localnet
markus schnalke <meillo@marmaro.de>
parents: 350
diff changeset
844 /* remote recipients, requires online delivery */
237
5f9f3a65032e refactoring: new function split_rcpts() replaces two others
markus schnalke <meillo@marmaro.de>
parents: 224
diff changeset
845 if ((flags & DLVR_ONLINE) && other_rcpt_list) {
354
08932c629849 reworked the route concept; removed the idea of the localnet
markus schnalke <meillo@marmaro.de>
parents: 350
diff changeset
846 msg_out *remote_msgout = clone_msg_out(msgout);
08932c629849 reworked the route concept; removed the idea of the localnet
markus schnalke <meillo@marmaro.de>
parents: 350
diff changeset
847 remote_msgout->rcpt_list = other_rcpt_list;
08932c629849 reworked the route concept; removed the idea of the localnet
markus schnalke <meillo@marmaro.de>
parents: 350
diff changeset
848 remote_msgout_list = g_list_append(remote_msgout_list, remote_msgout);
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
849 }
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
850 }
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
851
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
852 if (alias_table) {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
853 destroy_table(alias_table);
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
854 }
387
a408411ff8df Added a glob-pattern aliasing facility.
markus schnalke <meillo@marmaro.de>
parents: 375
diff changeset
855 if (globalias_table) {
a408411ff8df Added a glob-pattern aliasing facility.
markus schnalke <meillo@marmaro.de>
parents: 375
diff changeset
856 destroy_table(globalias_table);
a408411ff8df Added a glob-pattern aliasing facility.
markus schnalke <meillo@marmaro.de>
parents: 375
diff changeset
857 }
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
858
354
08932c629849 reworked the route concept; removed the idea of the localnet
markus schnalke <meillo@marmaro.de>
parents: 350
diff changeset
859 /* process local/remote msgout lists -> delivery */
237
5f9f3a65032e refactoring: new function split_rcpts() replaces two others
markus schnalke <meillo@marmaro.de>
parents: 224
diff changeset
860
5f9f3a65032e refactoring: new function split_rcpts() replaces two others
markus schnalke <meillo@marmaro.de>
parents: 224
diff changeset
861 if (local_msgout_list) {
114
a80ebfa16cd5 better debugging output (thanks to Paolo)
meillo@marmaro.de
parents: 76
diff changeset
862 DEBUG(5) debugf("local_msgout_list\n");
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
863 foreach(local_msgout_list, msgout_node) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
864 msg_out *msgout = (msg_out *) (msgout_node->data);
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
865 if (!deliver_local(msgout)) {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
866 ok = FALSE;
280
72e377210d5e heavy refactoring of deliver.c
markus schnalke <meillo@marmaro.de>
parents: 237
diff changeset
867 }
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
868 }
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
869 destroy_msg_out_list(local_msgout_list);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
870 }
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
871
354
08932c629849 reworked the route concept; removed the idea of the localnet
markus schnalke <meillo@marmaro.de>
parents: 350
diff changeset
872 if (remote_msgout_list) {
08932c629849 reworked the route concept; removed the idea of the localnet
markus schnalke <meillo@marmaro.de>
parents: 350
diff changeset
873 DEBUG(5) debugf("remote_msgout_list\n");
08932c629849 reworked the route concept; removed the idea of the localnet
markus schnalke <meillo@marmaro.de>
parents: 350
diff changeset
874 deliver_remote(remote_msgout_list);
08932c629849 reworked the route concept; removed the idea of the localnet
markus schnalke <meillo@marmaro.de>
parents: 350
diff changeset
875 destroy_msg_out_list(remote_msgout_list);
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
876 }
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
877
344
0410c8aabac2 improved comments and debug messages
markus schnalke <meillo@marmaro.de>
parents: 343
diff changeset
878 /* unlock spool files */
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
879 foreach(msgout_list, msgout_node) {
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
880 msg_out *msgout = (msg_out *) (msgout_node->data);
114
a80ebfa16cd5 better debugging output (thanks to Paolo)
meillo@marmaro.de
parents: 76
diff changeset
881 if (spool_unlock(msgout->msg->uid)) {
a80ebfa16cd5 better debugging output (thanks to Paolo)
meillo@marmaro.de
parents: 76
diff changeset
882 DEBUG(5) debugf("spool_unlock(%s)\n", msgout->msg->uid);
a80ebfa16cd5 better debugging output (thanks to Paolo)
meillo@marmaro.de
parents: 76
diff changeset
883 } else {
a80ebfa16cd5 better debugging output (thanks to Paolo)
meillo@marmaro.de
parents: 76
diff changeset
884 DEBUG(5) debugf("spool_unlock(%s) failed.\n", msgout->msg->uid);
a80ebfa16cd5 better debugging output (thanks to Paolo)
meillo@marmaro.de
parents: 76
diff changeset
885 }
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
886 }
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
887 destroy_msg_out_list(msgout_list);
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
888
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
889 return ok;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
890 }
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
891
321
412385b57dc4 refactoring
meillo@marmaro.de
parents: 317
diff changeset
892 /*
367
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
893 ** deliver() is called when a message has just been received
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
894 ** (mode_accept and smtp_in) and should be delivered immediately
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
895 ** (neither -odq nor do_queue). Only this one message will be tried to
b27f66555ba8 Reformated multiline comments to have leading asterisks on each line
markus schnalke <meillo@marmaro.de>
parents: 366
diff changeset
896 ** deliver then.
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
897 */
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
898 gboolean
366
41958685480d Switched to `type *name' style
markus schnalke <meillo@marmaro.de>
parents: 354
diff changeset
899 deliver(message *msg)
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
900 {
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
901 gboolean ok;
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
902 GList *msg_list = g_list_append(NULL, msg);
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
903
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
904 ok = deliver_msg_list(msg_list, DLVR_ALL);
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
905 g_list_free(msg_list);
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
906
10
26e34ae9a3e3 changed indention and line wrapping to a more consistent style
meillo@marmaro.de
parents: 0
diff changeset
907 return ok;
0
08114f7dcc23 this is masqmail-0.2.21 from oliver kurth
meillo@marmaro.de
parents:
diff changeset
908 }