Mercurial > masqmail
comparison src/route.c @ 373:4cab237ce923
Fixed bug in matching of allowed recipients.
Thanks to Juergen Daubert for finding and reporting the issue.
The code had evaluated completely different data ...
author | markus schnalke <meillo@marmaro.de> |
---|---|
date | Sat, 14 Jan 2012 11:47:57 +0100 |
parents | b27f66555ba8 |
children | 5593964ec779 |
comparison
equal
deleted
inserted
replaced
372:b0708fac99dd | 373:4cab237ce923 |
---|---|
202 void | 202 void |
203 split_rcpts(GList *rcpt_list, GList *patterns, GList **rl_local, | 203 split_rcpts(GList *rcpt_list, GList *patterns, GList **rl_local, |
204 GList **rl_matching, GList **rl_others) | 204 GList **rl_matching, GList **rl_others) |
205 { | 205 { |
206 GList *rcpt_node; | 206 GList *rcpt_node; |
207 GList *host_node = NULL; | 207 GList *pat_node = NULL; |
208 address *rcpt = NULL; | 208 address *rcpt = NULL; |
209 | 209 |
210 if (rcpt_list == NULL) | 210 if (rcpt_list == NULL) |
211 return; | 211 return; |
212 | 212 |
213 foreach(rcpt_list, rcpt_node) { | 213 foreach(rcpt_list, rcpt_node) { |
214 rcpt = (address *) (rcpt_node->data); | 214 rcpt = (address *) (rcpt_node->data); |
215 host_node = NULL; | 215 pat_node = NULL; |
216 | 216 |
217 if (addr_is_local(rcpt)) { | 217 if (addr_is_local(rcpt)) { |
218 if (rl_local) | 218 if (rl_local) |
219 *rl_local = g_list_append(*rl_local, rcpt); | 219 *rl_local = g_list_append(*rl_local, rcpt); |
220 } else { | 220 } else { |
221 /* | 221 /* |
222 ** if patterns is NULL, host_node will be NULL, | 222 ** if patterns is NULL, pat_node will be NULL, |
223 ** hence all non-locals are put to others | 223 ** hence all non-locals are put to others |
224 */ | 224 */ |
225 foreach(patterns, host_node) { | 225 foreach(patterns, pat_node) { |
226 gchar *host = (gchar *) (host_node->data); | 226 address *pat = (address *) (pat_node->data); |
227 if (fnmatch(host, rcpt->domain, FNM_CASEFOLD) == 0) | 227 if (fnmatch(pat->domain, rcpt->domain, FNM_CASEFOLD)==0 && fnmatch(pat->local_part, rcpt->local_part, 0)==0) { /* TODO: match local_part caseless? */ |
228 break; | 228 break; |
229 } | 229 } |
230 if (host_node) { | 230 } |
231 if (pat_node) { | |
231 if (rl_matching) | 232 if (rl_matching) |
232 *rl_matching = g_list_append(*rl_matching, rcpt); | 233 *rl_matching = g_list_append(*rl_matching, rcpt); |
233 } else { | 234 } else { |
234 if (rl_others) | 235 if (rl_others) |
235 *rl_others = g_list_append(*rl_others, rcpt); | 236 *rl_others = g_list_append(*rl_others, rcpt); |