diff options
| -rw-r--r-- | meta-networking/recipes-support/ssmtp/ssmtp/ssmtp-bug584162-fix.patch | 126 | ||||
| -rw-r--r-- | meta-networking/recipes-support/ssmtp/ssmtp_2.64.bb | 24 |
2 files changed, 140 insertions, 10 deletions
diff --git a/meta-networking/recipes-support/ssmtp/ssmtp/ssmtp-bug584162-fix.patch b/meta-networking/recipes-support/ssmtp/ssmtp/ssmtp-bug584162-fix.patch new file mode 100644 index 0000000000..e087bc7523 --- /dev/null +++ b/meta-networking/recipes-support/ssmtp/ssmtp/ssmtp-bug584162-fix.patch | |||
| @@ -0,0 +1,126 @@ | |||
| 1 | Bug-Debian: http://bugs.debian.org/584162 | ||
| 2 | Reported-By: Christoph Biedl <debian.axhn@manchmal.in-ulm.de> | ||
| 3 | Forwarded: not-needed | ||
| 4 | Reviewed-By: Anibal Monsalve Salazar <anibal@debian.org> | ||
| 5 | Last-Update: 2014-08-15 | ||
| 6 | |||
| 7 | From: "Daniel Richard G." <skunk@iSKUNK.ORG> | ||
| 8 | Subject: Re: ssmtp: Partial loss of message body, sending message to wrong recipicients | ||
| 9 | Date: Thu, 19 Jun 2014 14:44:30 -0400 | ||
| 10 | |||
| 11 | Attached is a patch against the original 2.64 source that should address | ||
| 12 | this bug, and hopefully not break anything. An overview of my changes: | ||
| 13 | |||
| 14 | * Added code to standarise() to drop the trailing '\r' if the line | ||
| 15 | originally ended with "\r\n". | ||
| 16 | |||
| 17 | * Added a check to header_parse() that effectively converts an "\r\n" in | ||
| 18 | the input into '\n'. | ||
| 19 | |||
| 20 | * Added a conditional so that header_parse() doesn't pass the empty | ||
| 21 | string to header_save()---a behavior I observed in testing, at the end | ||
| 22 | of a header block with "\r\n" line endings. | ||
| 23 | |||
| 24 | * Simplified the last if(in_header) conditional in header_parse(), | ||
| 25 | because it erroneously assumes that if in_header == True, then c could | ||
| 26 | have some value other than EOF. (See the condition on the previous | ||
| 27 | "while" loop, and the lack of any other way to exit said loop.) | ||
| 28 | |||
| 29 | header_parse() will now properly grab a header if fed a message | ||
| 30 | without a body (i.e. no "\n\n" ending the header block), although this | ||
| 31 | code will still drop a header if there is no newline at the end. | ||
| 32 | |||
| 33 | Christoph, thank you for your excellent analysis, and the test cases. I | ||
| 34 | made use of them, and with my changes sSMTP appears to do the right | ||
| 35 | thing. | ||
| 36 | |||
| 37 | Debian patch from: https://sources.debian.net/patches/ssmtp/2.64-8/ | ||
| 38 | |||
| 39 | Upstream-Status: Backport [debian] | ||
| 40 | |||
| 41 | Signed-off-by: Andre McCurdy <armccurdy@gmail.com> | ||
| 42 | |||
| 43 | Index: ssmtp-2.64/ssmtp.c | ||
| 44 | =================================================================== | ||
| 45 | --- ssmtp-2.64.orig/ssmtp.c | ||
| 46 | +++ ssmtp-2.64/ssmtp.c | ||
| 47 | @@ -375,6 +375,12 @@ bool_t standardise(char *str, bool_t *li | ||
| 48 | if((p = strchr(str, '\n'))) { | ||
| 49 | *p = (char)NULL; | ||
| 50 | *linestart = True; | ||
| 51 | + | ||
| 52 | + /* If the line ended in "\r\n", then drop the '\r' too */ | ||
| 53 | + sl = strlen(str); | ||
| 54 | + if(sl >= 1 && str[sl - 1] == '\r') { | ||
| 55 | + str[sl - 1] = (char)NULL; | ||
| 56 | + } | ||
| 57 | } | ||
| 58 | return(leadingdot); | ||
| 59 | } | ||
| 60 | @@ -768,6 +774,14 @@ void header_parse(FILE *stream) | ||
| 61 | } | ||
| 62 | len++; | ||
| 63 | |||
| 64 | + if(l == '\r' && c == '\n') { | ||
| 65 | + /* Properly handle input that already has "\r\n" | ||
| 66 | + line endings; see https://bugs.debian.org/584162 */ | ||
| 67 | + l = (len >= 2 ? *(q - 2) : '\n'); | ||
| 68 | + q--; | ||
| 69 | + len--; | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | if(l == '\n') { | ||
| 73 | switch(c) { | ||
| 74 | case ' ': | ||
| 75 | @@ -790,7 +804,9 @@ void header_parse(FILE *stream) | ||
| 76 | if((q = strrchr(p, '\n'))) { | ||
| 77 | *q = (char)NULL; | ||
| 78 | } | ||
| 79 | - header_save(p); | ||
| 80 | + if(len > 0) { | ||
| 81 | + header_save(p); | ||
| 82 | + } | ||
| 83 | |||
| 84 | q = p; | ||
| 85 | len = 0; | ||
| 86 | @@ -800,35 +816,12 @@ void header_parse(FILE *stream) | ||
| 87 | |||
| 88 | l = c; | ||
| 89 | } | ||
| 90 | - if(in_header) { | ||
| 91 | - if(l == '\n') { | ||
| 92 | - switch(c) { | ||
| 93 | - case ' ': | ||
| 94 | - case '\t': | ||
| 95 | - /* Must insert '\r' before '\n's embedded in header | ||
| 96 | - fields otherwise qmail won't accept our mail | ||
| 97 | - because a bare '\n' violates some RFC */ | ||
| 98 | - | ||
| 99 | - *(q - 1) = '\r'; /* Replace previous \n with \r */ | ||
| 100 | - *q++ = '\n'; /* Insert \n */ | ||
| 101 | - len++; | ||
| 102 | - | ||
| 103 | - break; | ||
| 104 | - | ||
| 105 | - case '\n': | ||
| 106 | - in_header = False; | ||
| 107 | - | ||
| 108 | - default: | ||
| 109 | - *q = (char)NULL; | ||
| 110 | - if((q = strrchr(p, '\n'))) { | ||
| 111 | - *q = (char)NULL; | ||
| 112 | - } | ||
| 113 | - header_save(p); | ||
| 114 | - | ||
| 115 | - q = p; | ||
| 116 | - len = 0; | ||
| 117 | - } | ||
| 118 | + if(in_header && l == '\n') { | ||
| 119 | + /* Got EOF while reading the header */ | ||
| 120 | + if((q = strrchr(p, '\n'))) { | ||
| 121 | + *q = (char)NULL; | ||
| 122 | } | ||
| 123 | + header_save(p); | ||
| 124 | } | ||
| 125 | (void)free(p); | ||
| 126 | } | ||
diff --git a/meta-networking/recipes-support/ssmtp/ssmtp_2.64.bb b/meta-networking/recipes-support/ssmtp/ssmtp_2.64.bb index 9d4864d79a..07e3ffed42 100644 --- a/meta-networking/recipes-support/ssmtp/ssmtp_2.64.bb +++ b/meta-networking/recipes-support/ssmtp/ssmtp_2.64.bb | |||
| @@ -1,25 +1,29 @@ | |||
| 1 | SUMMARY = "extremely simple MTA to get mail off the system to a mail hub" | 1 | SUMMARY = "extremely simple MTA to get mail off the system to a mail hub" |
| 2 | HOMEPAGE = "http://packages.qa.debian.org/s/ssmtp.html" | 2 | HOMEPAGE = "http://packages.qa.debian.org/s/ssmtp.html" |
| 3 | |||
| 4 | LICENSE = "GPLv2" | 3 | LICENSE = "GPLv2" |
| 5 | LIC_FILES_CHKSUM = "file://COPYING;md5=0c56db0143f4f80c369ee3af7425af6e" | 4 | LIC_FILES_CHKSUM = "file://COPYING;md5=0c56db0143f4f80c369ee3af7425af6e" |
| 6 | 5 | ||
| 7 | SRC_URI = "\ | 6 | SRC_URI = "${DEBIAN_MIRROR}/main/s/${BPN}/${BPN}_${PV}.orig.tar.bz2 \ |
| 8 | ${DEBIAN_MIRROR}/main/s/${BPN}/${BPN}_${PV}.orig.tar.bz2 \ | 7 | file://ssmtp-bug584162-fix.patch \ |
| 9 | file://build-ouside_srcdir.patch \ | 8 | file://build-ouside_srcdir.patch \ |
| 10 | file://use-DESTDIR.patch \ | 9 | file://use-DESTDIR.patch \ |
| 11 | " | 10 | " |
| 12 | |||
| 13 | EXTRA_OECONF += "--mandir=${mandir}" | ||
| 14 | |||
| 15 | EXTRA_OEMAKE = "GEN_CONFIG='/bin/true'" | ||
| 16 | 11 | ||
| 17 | SRC_URI[md5sum] = "65b4e0df4934a6cd08c506cabcbe584f" | 12 | SRC_URI[md5sum] = "65b4e0df4934a6cd08c506cabcbe584f" |
| 18 | SRC_URI[sha256sum] = "22c37dc90c871e8e052b2cab0ad219d010fa938608cd66b21c8f3c759046fa36" | 13 | SRC_URI[sha256sum] = "22c37dc90c871e8e052b2cab0ad219d010fa938608cd66b21c8f3c759046fa36" |
| 19 | 14 | ||
| 20 | inherit autotools pkgconfig | 15 | inherit autotools |
| 16 | |||
| 17 | PACKAGECONFIG ?= "ssl ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)}" | ||
| 18 | |||
| 19 | PACKAGECONFIG[ssl] = "--enable-ssl,--disable-ssl,openssl" | ||
| 20 | PACKAGECONFIG[ipv6] = "--enable-inet6,--disable-inet6" | ||
| 21 | |||
| 22 | EXTRA_OECONF += "--mandir=${mandir}" | ||
| 23 | |||
| 24 | EXTRA_OEMAKE = "GEN_CONFIG='/bin/true'" | ||
| 21 | 25 | ||
| 22 | DEPENDS += "openssl inetutils" | 26 | LDFLAGS += "${@bb.utils.contains('PACKAGECONFIG', 'ssl', '-lssl -lcrypto', '', d)}" |
| 23 | 27 | ||
| 24 | do_install_append () { | 28 | do_install_append () { |
| 25 | install -d ${D}${mandir}/ | 29 | install -d ${D}${mandir}/ |
