(yyerror,yylex): Forward declarations.
(alias_expand_list,mh_alias_get_internal) (mh_alias_get_address): Get an extra argument (for handling ";" aliases).
Showing
1 changed file
with
33 additions
and
11 deletions
... | @@ -49,6 +49,9 @@ static list_t unix_group_to_list __P((char *name)); | ... | @@ -49,6 +49,9 @@ static list_t unix_group_to_list __P((char *name)); |
49 | static list_t unix_gid_to_list __P((char *name)); | 49 | static list_t unix_gid_to_list __P((char *name)); |
50 | static list_t unix_passwd_to_list __P((void)); | 50 | static list_t unix_passwd_to_list __P((void)); |
51 | 51 | ||
52 | int yyerror __P((char *s)); | ||
53 | int yylex __P((void)); | ||
54 | |||
52 | %} | 55 | %} |
53 | 56 | ||
54 | %union { | 57 | %union { |
... | @@ -213,10 +216,10 @@ _insert_list (list_t list, void *prev, list_t new_list) | ... | @@ -213,10 +216,10 @@ _insert_list (list_t list, void *prev, list_t new_list) |
213 | } | 216 | } |
214 | 217 | ||
215 | static int mh_alias_get_internal __P((char *name, iterator_t start, | 218 | static int mh_alias_get_internal __P((char *name, iterator_t start, |
216 | list_t *return_list)); | 219 | list_t *return_list, int *inclusive)); |
217 | 220 | ||
218 | int | 221 | int |
219 | alias_expand_list (list_t name_list, iterator_t orig_itr) | 222 | alias_expand_list (list_t name_list, iterator_t orig_itr, int *inclusive) |
220 | { | 223 | { |
221 | iterator_t itr; | 224 | iterator_t itr; |
222 | 225 | ||
... | @@ -228,7 +231,7 @@ alias_expand_list (list_t name_list, iterator_t orig_itr) | ... | @@ -228,7 +231,7 @@ alias_expand_list (list_t name_list, iterator_t orig_itr) |
228 | list_t exlist; | 231 | list_t exlist; |
229 | 232 | ||
230 | iterator_current (itr, (void **)&name); | 233 | iterator_current (itr, (void **)&name); |
231 | if (mh_alias_get_internal (name, orig_itr, &exlist) == 0) | 234 | if (mh_alias_get_internal (name, orig_itr, &exlist, inclusive) == 0) |
232 | { | 235 | { |
233 | _insert_list (name_list, name, exlist); | 236 | _insert_list (name_list, name, exlist); |
234 | list_remove (name_list, name); | 237 | list_remove (name_list, name); |
... | @@ -242,7 +245,8 @@ alias_expand_list (list_t name_list, iterator_t orig_itr) | ... | @@ -242,7 +245,8 @@ alias_expand_list (list_t name_list, iterator_t orig_itr) |
242 | /* Look up the named alias. If found, return the list of recipient | 245 | /* Look up the named alias. If found, return the list of recipient |
243 | names associated with it */ | 246 | names associated with it */ |
244 | static int | 247 | static int |
245 | mh_alias_get_internal (char *name, iterator_t start, list_t *return_list) | 248 | mh_alias_get_internal (char *name, iterator_t start, list_t *return_list, |
249 | int *inclusive) | ||
246 | { | 250 | { |
247 | iterator_t itr; | 251 | iterator_t itr; |
248 | int rc = 1; | 252 | int rc = 1; |
... | @@ -263,10 +267,12 @@ mh_alias_get_internal (char *name, iterator_t start, list_t *return_list) | ... | @@ -263,10 +267,12 @@ mh_alias_get_internal (char *name, iterator_t start, list_t *return_list) |
263 | { | 267 | { |
264 | struct mh_alias *alias; | 268 | struct mh_alias *alias; |
265 | iterator_current (itr, (void **)&alias); | 269 | iterator_current (itr, (void **)&alias); |
270 | if (inclusive) | ||
271 | *inclusive |= alias->inclusive; | ||
266 | if (aliascmp (alias->name, name) == 0) | 272 | if (aliascmp (alias->name, name) == 0) |
267 | { | 273 | { |
268 | *return_list = ali_list_dup (alias->rcpt_list); | 274 | *return_list = ali_list_dup (alias->rcpt_list); |
269 | alias_expand_list (*return_list, itr); | 275 | alias_expand_list (*return_list, itr, inclusive); |
270 | rc = 0; | 276 | rc = 0; |
271 | break; | 277 | break; |
272 | } | 278 | } |
... | @@ -279,16 +285,17 @@ mh_alias_get_internal (char *name, iterator_t start, list_t *return_list) | ... | @@ -279,16 +285,17 @@ mh_alias_get_internal (char *name, iterator_t start, list_t *return_list) |
279 | int | 285 | int |
280 | mh_alias_get (char *name, list_t *return_list) | 286 | mh_alias_get (char *name, list_t *return_list) |
281 | { | 287 | { |
282 | return mh_alias_get_internal (name, NULL, return_list); | 288 | return mh_alias_get_internal (name, NULL, return_list, NULL); |
283 | } | 289 | } |
284 | 290 | ||
285 | int | 291 | int |
286 | mh_alias_get_address (char *name, address_t *paddr) | 292 | mh_alias_get_address (char *name, address_t *paddr, int *incl) |
287 | { | 293 | { |
288 | iterator_t itr; | 294 | iterator_t itr; |
289 | list_t list; | 295 | list_t list; |
290 | 296 | const char *domain = NULL; | |
291 | if (mh_alias_get (name, &list)) | 297 | |
298 | if (mh_alias_get_internal (name, NULL, &list, incl)) | ||
292 | return 1; | 299 | return 1; |
293 | if (list_is_empty (list)) | 300 | if (list_is_empty (list)) |
294 | { | 301 | { |
... | @@ -302,8 +309,21 @@ mh_alias_get_address (char *name, address_t *paddr) | ... | @@ -302,8 +309,21 @@ mh_alias_get_address (char *name, address_t *paddr) |
302 | { | 309 | { |
303 | char *item; | 310 | char *item; |
304 | address_t a; | 311 | address_t a; |
305 | 312 | char *ptr = NULL; | |
313 | |||
306 | iterator_current (itr, (void **)&item); | 314 | iterator_current (itr, (void **)&item); |
315 | if (incl && *incl) | ||
316 | { | ||
317 | if (strchr (item, '@') == 0) | ||
318 | { | ||
319 | if (!domain) | ||
320 | mu_get_user_email_domain (&domain); | ||
321 | asprintf (&ptr, "\"%s\" <%s@%s>", name, item, domain); | ||
322 | } | ||
323 | else | ||
324 | asprintf (&ptr, "\"%s\" <%s>", name, item); | ||
325 | item = ptr; | ||
326 | } | ||
307 | if (address_create (&a, item)) | 327 | if (address_create (&a, item)) |
308 | { | 328 | { |
309 | mh_error (_("Error expanding aliases -- invalid address `%s'"), | 329 | mh_error (_("Error expanding aliases -- invalid address `%s'"), |
... | @@ -314,6 +334,8 @@ mh_alias_get_address (char *name, address_t *paddr) | ... | @@ -314,6 +334,8 @@ mh_alias_get_address (char *name, address_t *paddr) |
314 | address_union (paddr, a); | 334 | address_union (paddr, a); |
315 | address_destroy (&a); | 335 | address_destroy (&a); |
316 | } | 336 | } |
337 | if (ptr) | ||
338 | free (ptr); | ||
317 | } | 339 | } |
318 | iterator_destroy (&itr); | 340 | iterator_destroy (&itr); |
319 | } | 341 | } |
... | @@ -366,7 +388,7 @@ mh_alias_enumerate (mh_alias_enumerator_t fun, void *data) | ... | @@ -366,7 +388,7 @@ mh_alias_enumerate (mh_alias_enumerator_t fun, void *data) |
366 | iterator_current (itr, (void **)&alias); | 388 | iterator_current (itr, (void **)&alias); |
367 | 389 | ||
368 | tmp = ali_list_dup (alias->rcpt_list); | 390 | tmp = ali_list_dup (alias->rcpt_list); |
369 | alias_expand_list (tmp, itr); | 391 | alias_expand_list (tmp, itr, NULL); |
370 | 392 | ||
371 | rc = fun (alias->name, tmp, data); | 393 | rc = fun (alias->name, tmp, data); |
372 | list_destroy (&tmp); | 394 | list_destroy (&tmp); | ... | ... |
-
Please register or sign in to post a comment