masqmail
changeset 404:899c97e877a5
Broke long lines.
author | markus schnalke <meillo@marmaro.de> |
---|---|
date | Wed, 29 Feb 2012 10:21:58 +0100 |
parents | 7954b82040b3 |
children | 0dd84c8f2524 |
files | src/deliver.c |
diffstat | 1 files changed, 89 insertions(+), 39 deletions(-) [+] |
line diff
1.1 --- a/src/deliver.c Wed Feb 29 09:46:34 2012 +0100 1.2 +++ b/src/deliver.c Wed Feb 29 10:21:58 2012 +0100 1.3 @@ -419,8 +419,8 @@ 1.4 GList *rcpt_node; 1.5 1.6 for (rcpt_node = g_list_first(msgout->rcpt_list); 1.7 - rcpt_node; 1.8 - rcpt_node = g_list_next(rcpt_node)) { 1.9 + rcpt_node; 1.10 + rcpt_node = g_list_next(rcpt_node)) { 1.11 address *rcpt = (address *) (rcpt_node->data); 1.12 gboolean ret = FALSE; 1.13 1.14 @@ -431,9 +431,20 @@ 1.15 addr_mark_defered(rcpt); 1.16 } 1.17 if (route->wrapper) { 1.18 - ret = delivery_failures(msgout->msg, msgout->rcpt_list, "could not open wrapper:\n\t%s", strerror(errno)); 1.19 + ret = delivery_failures(msgout->msg, 1.20 + msgout->rcpt_list, 1.21 + "could not open " 1.22 + "wrapper:\n\t%s", 1.23 + strerror(errno)); 1.24 } else { 1.25 - 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)); 1.26 + ret = delivery_failures(msgout->msg, 1.27 + msgout->rcpt_list, 1.28 + "could not open " 1.29 + "connection to %s:%d " 1.30 + ":\n\t%s", host, port, 1.31 + h_errno != 0 ? 1.32 + hstrerror(h_errno) : 1.33 + strerror(errno)); 1.34 } 1.35 if (ret) { 1.36 deliver_finish(msgout); 1.37 @@ -443,23 +454,33 @@ 1.38 return ok; 1.39 } 1.40 1.41 - set_heloname(psb, route->helo_name ? route->helo_name : conf.host_name, route->do_correct_helo); 1.42 + set_heloname(psb, route->helo_name ? route->helo_name : conf.host_name, 1.43 + route->do_correct_helo); 1.44 1.45 #ifdef ENABLE_AUTH 1.46 if (route->auth_name && route->auth_login && route->auth_secret) { 1.47 - set_auth(psb, route->auth_name, route->auth_login, route->auth_secret); 1.48 + set_auth(psb, route->auth_name, route->auth_login, 1.49 + route->auth_secret); 1.50 } 1.51 #endif 1.52 if (!smtp_out_init(psb, route->instant_helo)) { 1.53 /* smtp_out_init() failed */ 1.54 - if ((psb->error==smtp_fail) || (psb->error==smtp_trylater) || (psb->error==smtp_syntax)) { 1.55 + if ((psb->error==smtp_fail) || (psb->error==smtp_trylater) || 1.56 + (psb->error==smtp_syntax)) { 1.57 smtp_out_quit(psb); 1.58 1.59 foreach(msgout_list, msgout_node) { 1.60 - msg_out *msgout = (msg_out *) (msgout_node->data); 1.61 + msg_out *msgout = 1.62 + (msg_out *)(msgout_node->data); 1.63 smtp_out_mark_rcpts(psb, msgout->rcpt_list); 1.64 1.65 - if (delivery_failures(msgout->msg, msgout->rcpt_list, "while connected with %s, the server replied\n\t%s", (route->wrapper) ? "<wrapper>" : host, psb->buffer)) { 1.66 + if (delivery_failures(msgout->msg, 1.67 + msgout->rcpt_list, 1.68 + "while connected with %s, " 1.69 + "the server replied\n\t%s", 1.70 + (route->wrapper) ? 1.71 + "<wrapper>" : host, 1.72 + psb->buffer)) { 1.73 deliver_finish(msgout); 1.74 } 1.75 } 1.76 @@ -477,16 +498,22 @@ 1.77 gboolean flag, ok_msg = FALSE, ok_fail = FALSE; 1.78 message *msg = msgout->msg; 1.79 1.80 - /* we may have to read the data at this point and remember if we did */ 1.81 + /* we may have to read the data at this point 1.82 + ** and remember if we did */ 1.83 flag = (msg->data_list == NULL); 1.84 if (flag && !spool_read_data(msg)) { 1.85 - logwrite(LOG_ALERT, "could not open data spool file %s\n", msg->uid); 1.86 + logwrite(LOG_ALERT, "could not open data spool " 1.87 + "file %s\n", msg->uid); 1.88 break; 1.89 } 1.90 1.91 - smtp_out_msg(psb, msg, msgout->return_path, msgout->rcpt_list, msgout->hdr_list); 1.92 + smtp_out_msg(psb, msg, msgout->return_path, msgout->rcpt_list, 1.93 + msgout->hdr_list); 1.94 1.95 - ok_fail = delivery_failures(msg, msgout->rcpt_list, "while connected with %s, the server replied\n\t%s", (route->wrapper) ? "<wrapper>" : host, psb->buffer); 1.96 + ok_fail = delivery_failures(msg, msgout->rcpt_list, 1.97 + "while connected with %s, the server " 1.98 + "replied\n\t%s", (route->wrapper) ? 1.99 + "<wrapper>" : host, psb->buffer); 1.100 1.101 if ((psb->error == smtp_eof) || (psb->error == smtp_timeout)) { 1.102 /* connection lost */ 1.103 @@ -508,8 +535,9 @@ 1.104 deliver_finish(msgout); 1.105 } 1.106 } 1.107 - if (psb->error == smtp_ok || (psb->error == smtp_fail) 1.108 - || (psb->error == smtp_trylater) || (psb->error == smtp_syntax)) { 1.109 + if (psb->error == smtp_ok || (psb->error == smtp_fail) || 1.110 + (psb->error == smtp_trylater) || 1.111 + (psb->error == smtp_syntax)) { 1.112 smtp_out_quit(psb); 1.113 } 1.114 destroy_smtpbase(psb); 1.115 @@ -523,10 +551,12 @@ 1.116 1.117 if (route->pipe) { 1.118 DEBUG(5) debugf("with pipe\n"); 1.119 - return deliver_msglist_host_pipe(route, msgout_list, host, res_list); 1.120 + return deliver_msglist_host_pipe(route, msgout_list, 1.121 + host, res_list); 1.122 } else { 1.123 DEBUG(5) debugf("with smtp\n"); 1.124 - return deliver_msglist_host_smtp(route, msgout_list, host, res_list); 1.125 + return deliver_msglist_host_smtp(route, msgout_list, 1.126 + host, res_list); 1.127 } 1.128 } 1.129 1.130 @@ -540,10 +570,11 @@ 1.131 GList *mo_ph_list; 1.132 GList *mo_ph_node; 1.133 1.134 - DEBUG(5) debugf("deliver_route_msgout_list entered, route->name = %s\n", route->name); 1.135 + DEBUG(5) debugf("deliver_route_msgout_list entered, route->name=%s\n", 1.136 + route->name); 1.137 1.138 if (route->mail_host) { 1.139 - /* this is easy... deliver everything to a smart host for relay */ 1.140 + /* easy: deliver everything to a smart host for relay */ 1.141 return deliver_msglist_host(route, msgout_list, NULL, 1.142 route->resolve_list); 1.143 } 1.144 @@ -604,8 +635,9 @@ 1.145 ** failed addresses already have been bounced; 1.146 ** there should be a better way to handle those. 1.147 */ 1.148 - if (!addr_is_delivered(rcpt) && !addr_is_failed(rcpt) 1.149 - && !(rcpt->flags & ADDR_FLAG_LAST_ROUTE)) { 1.150 + if (!addr_is_delivered(rcpt) && 1.151 + !addr_is_failed(rcpt) && 1.152 + !(rcpt->flags & ADDR_FLAG_LAST_ROUTE)){ 1.153 rcpt_list_non_delivered = g_list_append(rcpt_list_non_delivered, rcpt); 1.154 } 1.155 } 1.156 @@ -618,8 +650,9 @@ 1.157 } 1.158 1.159 /* filter by allowed envelope sender */ 1.160 - if (!route_sender_is_allowed(route, msgout->msg->return_path)) { 1.161 - DEBUG(6) debugf("sender `%s' is not allowed for this route\n", msgout->msg->return_path); 1.162 + if (!route_sender_is_allowed(route, msgout->msg->return_path)){ 1.163 + DEBUG(6) debugf("sender `%s' is not allowed for this " 1.164 + "route\n", msgout->msg->return_path); 1.165 destroy_msg_out(msgout_cloned); 1.166 continue; 1.167 } 1.168 @@ -649,7 +682,8 @@ 1.169 } 1.170 1.171 route_prepare_msgout(route, msgout_cloned); 1.172 - msgout_list_deliver = g_list_append(msgout_list_deliver, msgout_cloned); 1.173 + msgout_list_deliver = g_list_append(msgout_list_deliver, 1.174 + msgout_cloned); 1.175 } 1.176 1.177 if (msgout_list_deliver) { 1.178 @@ -674,7 +708,8 @@ 1.179 foreach(msgout->rcpt_list, rcpt_node) { 1.180 address *rcpt = (address *) (rcpt_node->data); 1.181 if (addr_is_delivered(rcpt) || addr_is_failed(rcpt)) { 1.182 - msg->non_rcpt_list = g_list_append(msg->non_rcpt_list, rcpt); 1.183 + msg->non_rcpt_list = g_list_append(msg->non_rcpt_list, 1.184 + rcpt); 1.185 } 1.186 } 1.187 } 1.188 @@ -729,7 +764,8 @@ 1.189 1.190 /* one not delivered address was found */ 1.191 if (!spool_write(msg, FALSE)) { 1.192 - logwrite(LOG_ALERT, "could not write back spool header for %s\n", msg->uid); 1.193 + logwrite(LOG_ALERT, "could not write back spool header " 1.194 + "for %s\n", msg->uid); 1.195 return FALSE; 1.196 } 1.197 1.198 @@ -756,8 +792,10 @@ 1.199 1.200 route_list = read_route_list(conf.perma_routes, TRUE); 1.201 foreach(route_list, route_node) { 1.202 - connect_route *route = (connect_route *) (route_node->data); 1.203 - if (!deliver_route_msg_list(route, remote_msgout_list)) { 1.204 + connect_route *route = 1.205 + (connect_route *) (route_node->data); 1.206 + if (!deliver_route_msg_list(route, 1.207 + remote_msgout_list)) { 1.208 ok = FALSE; 1.209 } 1.210 } 1.211 @@ -773,17 +811,20 @@ 1.212 1.213 /* we are online! */ 1.214 DEBUG(5) debugf("processing query_routes\n"); 1.215 - logwrite(LOG_NOTICE, "detected online configuration `%s'\n", connect_name); 1.216 + logwrite(LOG_NOTICE, "detected online configuration `%s'\n", 1.217 + connect_name); 1.218 1.219 rf_list = (GList *) table_find(conf.query_routes, connect_name); 1.220 if (!rf_list) { 1.221 - logwrite(LOG_ALERT, "route list with name '%s' not found.\n", connect_name); 1.222 + logwrite(LOG_ALERT, "route list with name '%s' not found.\n", 1.223 + connect_name); 1.224 return FALSE; 1.225 } 1.226 1.227 route_list = read_route_list(rf_list, FALSE); 1.228 if (!route_list) { 1.229 - logwrite(LOG_ALERT, "could not read route list '%s'\n", connect_name); 1.230 + logwrite(LOG_ALERT, "could not read route list '%s'\n", 1.231 + connect_name); 1.232 return FALSE; 1.233 } 1.234 1.235 @@ -834,18 +875,22 @@ 1.236 GList *other_rcpt_list = NULL; 1.237 1.238 if (!spool_lock(msgout->msg->uid)) { 1.239 - DEBUG(5) debugf("spool_lock(%s) failed.\n", msgout->msg->uid); 1.240 + DEBUG(5) debugf("spool_lock(%s) failed.\n", 1.241 + msgout->msg->uid); 1.242 continue; 1.243 } 1.244 DEBUG(5) debugf("spool_lock(%s)\n", msgout->msg->uid); 1.245 1.246 rcpt_list = g_list_copy(msgout->msg->rcpt_list); 1.247 if (conf.log_user) { 1.248 - address *addr = create_address_qualified(conf.log_user, TRUE, conf.host_name); 1.249 + address *addr = create_address_qualified(conf.log_user, 1.250 + TRUE, conf.host_name); 1.251 if (addr) { 1.252 rcpt_list = g_list_prepend(rcpt_list, addr); 1.253 } else { 1.254 - logwrite(LOG_ALERT, "invalid log_user address `%s', ignoring\n", conf.log_user); 1.255 + logwrite(LOG_ALERT, "invalid log_user " 1.256 + "address `%s', ignoring\n", 1.257 + conf.log_user); 1.258 } 1.259 } 1.260 if (globalias_table) { 1.261 @@ -865,7 +910,8 @@ 1.262 rcpt_list = aliased_rcpt_list; 1.263 } 1.264 1.265 - /* split_rcpts(rcpt_list, NULL, &local_rcpt_list, NULL, &other_rcpt_list); */ 1.266 + /* split_rcpts(rcpt_list, NULL, &local_rcpt_list, NULL, 1.267 + ** &other_rcpt_list); */ 1.268 local_rcpt_list = local_rcpts(rcpt_list); 1.269 other_rcpt_list = remote_rcpts(rcpt_list); 1.270 g_list_free(rcpt_list); 1.271 @@ -874,14 +920,16 @@ 1.272 if ((flags & DLVR_LOCAL) && local_rcpt_list) { 1.273 msg_out *local_msgout = clone_msg_out(msgout); 1.274 local_msgout->rcpt_list = local_rcpt_list; 1.275 - local_msgout_list = g_list_append(local_msgout_list, local_msgout); 1.276 + local_msgout_list = g_list_append(local_msgout_list, 1.277 + local_msgout); 1.278 } 1.279 1.280 /* remote recipients, requires online delivery */ 1.281 if ((flags & DLVR_ONLINE) && other_rcpt_list) { 1.282 msg_out *remote_msgout = clone_msg_out(msgout); 1.283 remote_msgout->rcpt_list = other_rcpt_list; 1.284 - remote_msgout_list = g_list_append(remote_msgout_list, remote_msgout); 1.285 + remote_msgout_list = g_list_append(remote_msgout_list, 1.286 + remote_msgout); 1.287 } 1.288 } 1.289 1.290 @@ -915,9 +963,11 @@ 1.291 foreach(msgout_list, msgout_node) { 1.292 msg_out *msgout = (msg_out *) (msgout_node->data); 1.293 if (spool_unlock(msgout->msg->uid)) { 1.294 - DEBUG(5) debugf("spool_unlock(%s)\n", msgout->msg->uid); 1.295 + DEBUG(5) debugf("spool_unlock(%s)\n", 1.296 + msgout->msg->uid); 1.297 } else { 1.298 - DEBUG(5) debugf("spool_unlock(%s) failed.\n", msgout->msg->uid); 1.299 + DEBUG(5) debugf("spool_unlock(%s) failed.\n", 1.300 + msgout->msg->uid); 1.301 } 1.302 } 1.303 destroy_msg_out_list(msgout_list);