Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | From e34e2ac67b80497080ebecccec40c3b61456167d Mon Sep 17 00:00:00 2001 |
| 2 | From: Florian Weimer <fweimer@redhat.com> |
| 3 | Date: Mon, 17 Nov 2014 11:14:06 +0100 |
| 4 | Subject: [PATCH 2/4] unpack: Disable option processing for email addresses |
| 5 | when calling sendmail |
| 6 | |
| 7 | This patch is taken from |
| 8 | ftp://ftp.debian.org/debian/pool/main/h/heirloom-mailx/heirloom-mailx_12.5-5.debian.tar.xz |
| 9 | |
| 10 | Upstream-Status: Inappropriate [upstream is dead] |
| 11 | --- |
| 12 | extern.h | 2 +- |
| 13 | names.c | 8 ++++++-- |
| 14 | sendout.c | 2 +- |
| 15 | 3 files changed, 8 insertions(+), 4 deletions(-) |
| 16 | |
| 17 | diff --git a/extern.h b/extern.h |
| 18 | index 6b85ba0..8873fe8 100644 |
| 19 | --- a/extern.h |
| 20 | +++ b/extern.h |
| 21 | @@ -396,7 +396,7 @@ struct name *outof(struct name *names, FILE *fo, struct header *hp); |
| 22 | int is_fileaddr(char *name); |
| 23 | struct name *usermap(struct name *names); |
| 24 | struct name *cat(struct name *n1, struct name *n2); |
| 25 | -char **unpack(struct name *np); |
| 26 | +char **unpack(struct name *smopts, struct name *np); |
| 27 | struct name *elide(struct name *names); |
| 28 | int count(struct name *np); |
| 29 | struct name *delete_alternates(struct name *np); |
| 30 | diff --git a/names.c b/names.c |
| 31 | index c69560f..45bbaed 100644 |
| 32 | --- a/names.c |
| 33 | +++ b/names.c |
| 34 | @@ -549,7 +549,7 @@ cat(struct name *n1, struct name *n2) |
| 35 | * Return an error if the name list won't fit. |
| 36 | */ |
| 37 | char ** |
| 38 | -unpack(struct name *np) |
| 39 | +unpack(struct name *smopts, struct name *np) |
| 40 | { |
| 41 | char **ap, **top; |
| 42 | struct name *n; |
| 43 | @@ -564,7 +564,7 @@ unpack(struct name *np) |
| 44 | * the terminating 0 pointer. Additional spots may be needed |
| 45 | * to pass along -f to the host mailer. |
| 46 | */ |
| 47 | - extra = 2; |
| 48 | + extra = 3 + count(smopts); |
| 49 | extra++; |
| 50 | metoo = value("metoo") != NULL; |
| 51 | if (metoo) |
| 52 | @@ -581,6 +581,10 @@ unpack(struct name *np) |
| 53 | *ap++ = "-m"; |
| 54 | if (verbose) |
| 55 | *ap++ = "-v"; |
| 56 | + for (; smopts != NULL; smopts = smopts->n_flink) |
| 57 | + if ((smopts->n_type & GDEL) == 0) |
| 58 | + *ap++ = smopts->n_name; |
| 59 | + *ap++ = "--"; |
| 60 | for (; n != NULL; n = n->n_flink) |
| 61 | if ((n->n_type & GDEL) == 0) |
| 62 | *ap++ = n->n_name; |
| 63 | diff --git a/sendout.c b/sendout.c |
| 64 | index 7b7f2eb..c52f15d 100644 |
| 65 | --- a/sendout.c |
| 66 | +++ b/sendout.c |
| 67 | @@ -835,7 +835,7 @@ start_mta(struct name *to, struct name *mailargs, FILE *input, |
| 68 | #endif /* HAVE_SOCKETS */ |
| 69 | |
| 70 | if ((smtp = value("smtp")) == NULL) { |
| 71 | - args = unpack(cat(mailargs, to)); |
| 72 | + args = unpack(mailargs, to); |
| 73 | if (debug || value("debug")) { |
| 74 | printf(catgets(catd, CATSET, 181, |
| 75 | "Sendmail arguments:")); |
| 76 | -- |
| 77 | 1.9.3 |
| 78 | |
| 79 | |