From d6dd64af3743934402616a5fda3f93e3a14a3ab0 Mon Sep 17 00:00:00 2001 From: Adam Zimmerman Date: Wed, 6 Jun 2018 14:47:46 -0700 Subject: [PATCH] gnu: opensmtpd: Fix crash on table authentication. * gnu/packages/patches/opensmtpd-fix-crash.patch: New patch. * gnu/packages/mail.scm (opensmtpd)[source]: Use it. * gnu/local.mk (dist_patch_DATA): Add it. Signed-off-by: Tobias Geerinckx-Rice --- gnu/local.mk | 1 + gnu/packages/mail.scm | 4 +- .../patches/opensmtpd-fix-crash.patch | 44 +++++++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/opensmtpd-fix-crash.patch diff --git a/gnu/local.mk b/gnu/local.mk index 0ff25909b8..f98e741c1e 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -967,6 +967,7 @@ dist_patch_DATA = \ %D%/packages/patches/openldap-CVE-2017-9287.patch \ %D%/packages/patches/openocd-nrf52.patch \ %D%/packages/patches/openscenegraph-ffmpeg3.patch \ + %D%/packages/patches/opensmtpd-fix-crash.patch \ %D%/packages/patches/openssl-runpath.patch \ %D%/packages/patches/openssl-1.1.0-c-rehash-in.patch \ %D%/packages/patches/openssl-c-rehash-in.patch \ diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm index f6dfb33970..a9add98d14 100644 --- a/gnu/packages/mail.scm +++ b/gnu/packages/mail.scm @@ -1995,7 +1995,9 @@ (define-public opensmtpd name "-" version ".tar.gz")) (sha256 (base32 - "10bsfsnlg9d9i6l2izdnxp05s3ri8fvwzqxvx1jmarc852382619")))) + "10bsfsnlg9d9i6l2izdnxp05s3ri8fvwzqxvx1jmarc852382619")) + ;; Fixed upstream: . + (patches (search-patches "opensmtpd-fix-crash.patch")))) (build-system gnu-build-system) (inputs `(("bdb" ,bdb) diff --git a/gnu/packages/patches/opensmtpd-fix-crash.patch b/gnu/packages/patches/opensmtpd-fix-crash.patch new file mode 100644 index 0000000000..0030167533 --- /dev/null +++ b/gnu/packages/patches/opensmtpd-fix-crash.patch @@ -0,0 +1,44 @@ +From 9b5f70b93e038df5446bd37a4adac5a0380748e7 Mon Sep 17 00:00:00 2001 +From: johannes +Date: Wed, 21 Feb 2018 23:57:11 +0100 +Subject: [PATCH] crypt_checkpass: include HAVE_CRYPT_H definition, add NULL + check + +--- + openbsd-compat/crypt_checkpass.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/openbsd-compat/crypt_checkpass.c b/openbsd-compat/crypt_checkpass.c +index dafd2dae..d10b3a57 100644 +--- a/openbsd-compat/crypt_checkpass.c ++++ b/openbsd-compat/crypt_checkpass.c +@@ -1,5 +1,6 @@ + /* OPENBSD ORIGINAL: lib/libc/crypt/cryptutil.c */ + ++#include "includes.h" + #include + #ifdef HAVE_CRYPT_H + #include +@@ -10,6 +11,8 @@ + int + crypt_checkpass(const char *pass, const char *goodhash) + { ++ char *c; ++ + if (goodhash == NULL) + goto fail; + +@@ -17,7 +20,11 @@ crypt_checkpass(const char *pass, const char *goodhash) + if (strlen(goodhash) == 0 && strlen(pass) == 0) + return 0; + +- if (strcmp(crypt(pass, goodhash), goodhash) == 0) ++ c = crypt(pass, goodhash); ++ if (c == NULL) ++ goto fail; ++ ++ if (strcmp(c, goodhash) == 0) + return 0; + + fail: +