summary refs log tree commit diff
path: root/pkgs/servers/mail/opensmtpd
diff options
context:
space:
mode:
authorLéo Gaspard <leo@gaspard.io>2018-10-24 00:07:17 +0900
committerLéo Gaspard <leo@gaspard.io>2018-10-27 12:15:09 +0900
commit58f701ab74568692a49a4230f37eb07b3b63740d (patch)
treee41293bd8d571b07ea394bc57a2098b4e111fd3b /pkgs/servers/mail/opensmtpd
parent591ba7335bae245733777c1c4eeedb4d34ef57af (diff)
downloadnixpkgs-58f701ab74568692a49a4230f37eb07b3b63740d.tar
nixpkgs-58f701ab74568692a49a4230f37eb07b3b63740d.tar.gz
nixpkgs-58f701ab74568692a49a4230f37eb07b3b63740d.tar.bz2
nixpkgs-58f701ab74568692a49a4230f37eb07b3b63740d.tar.lz
nixpkgs-58f701ab74568692a49a4230f37eb07b3b63740d.tar.xz
nixpkgs-58f701ab74568692a49a4230f37eb07b3b63740d.tar.zst
nixpkgs-58f701ab74568692a49a4230f37eb07b3b63740d.zip
opensmtpd: 6.0.3p1 -> 6.4.0p1
Diffstat (limited to 'pkgs/servers/mail/opensmtpd')
-rw-r--r--pkgs/servers/mail/opensmtpd/default.nix45
-rw-r--r--pkgs/servers/mail/opensmtpd/fix-build.diff12
2 files changed, 31 insertions, 26 deletions
diff --git a/pkgs/servers/mail/opensmtpd/default.nix b/pkgs/servers/mail/opensmtpd/default.nix
index 60c517230b4..d5580450444 100644
--- a/pkgs/servers/mail/opensmtpd/default.nix
+++ b/pkgs/servers/mail/opensmtpd/default.nix
@@ -1,43 +1,33 @@
 { stdenv, lib, fetchurl, fetchpatch, autoconf, automake, libtool, bison
-, libasr, libevent, zlib, openssl, db, pam
-
-# opensmtpd requires root for no reason to encrypt passwords, this patch fixes it
-# see also https://github.com/OpenSMTPD/OpenSMTPD/issues/678
-, unpriviledged_smtpctl_encrypt ? true
-
-# Deprecated: use the subaddressing-delimiter in the config file going forward
-, tag_char ? null
+, libasr, libevent, zlib, libressl, db, pam
 }:
 
-if (tag_char != null)
-then throw "opensmtpd: the tag_char argument is deprecated as it can now be specified at runtime via the 'subaddressing-delimiter' option of the configuration file"
-else stdenv.mkDerivation rec {
+stdenv.mkDerivation rec {
   name = "opensmtpd-${version}";
-  version = "6.0.3p1";
+  version = "6.4.0p1";
 
   nativeBuildInputs = [ autoconf automake libtool bison ];
-  buildInputs = [ libasr libevent zlib openssl db pam ];
+  buildInputs = [ libasr libevent zlib libressl db pam ];
 
   src = fetchurl {
     url = "https://www.opensmtpd.org/archives/${name}.tar.gz";
-    sha256 = "291881862888655565e8bbe3cfb743310f5dc0edb6fd28a889a9a547ad767a81";
+    sha256 = "1qxxhnlsmpfh9v4azgl0634955r085gsic1c66jdll21bd5w2mq8";
   };
 
   patches = [
     ./proc_path.diff
-    (fetchpatch {
-      url = "https://github.com/OpenSMTPD/OpenSMTPD/commit/725ba4fa2ddf23bbcd1ff9ec92e86bbfaa6825c8.diff";
-      sha256 = "19rla0b2r53jpdiz25fcza29c2msz6j6paivxhp9jcy1xl457dqa";
-    })
+    ./fix-build.diff # See https://github.com/OpenSMTPD/OpenSMTPD/pull/884
   ];
 
-  postPatch = with builtins; with lib;
-    optionalString unpriviledged_smtpctl_encrypt ''
-      substituteInPlace smtpd/smtpctl.c --replace \
-        'if (geteuid())' \
-        'if (geteuid() != 0 && !(argc > 1 && !strcmp(argv[1], "encrypt")))'
-      substituteInPlace mk/smtpctl/Makefile.in --replace "chmod 2555" "chmod 0555"
-    '';
+  # See https://github.com/OpenSMTPD/OpenSMTPD/issues/885 for the `sh bootstrap`
+  # requirement
+  postPatch = ''
+    substituteInPlace smtpd/parse.y \
+      --replace "/usr/libexec/" "$out/libexec/opensmtpd/"
+    substituteInPlace mk/smtpctl/Makefile.am --replace "chgrp" "true"
+    substituteInPlace mk/smtpctl/Makefile.am --replace "chmod 2555" "chmod 0555"
+    sh bootstrap
+  '';
 
   configureFlags = [
     "--sysconfdir=/etc"
@@ -54,6 +44,9 @@ else stdenv.mkDerivation rec {
     "--with-table-db"
   ];
 
+  # See https://github.com/OpenSMTPD/OpenSMTPD/pull/884
+  makeFlags = [ "CFLAGS=-ffunction-sections" "LDFLAGS=-Wl,--gc-sections" ];
+
   installFlags = [
     "sysconfdir=\${out}/etc"
     "localstatedir=\${TMPDIR}"
@@ -67,6 +60,6 @@ else stdenv.mkDerivation rec {
     '';
     license = licenses.isc;
     platforms = platforms.linux;
-    maintainers = with maintainers; [ rickynils obadz ];
+    maintainers = with maintainers; [ rickynils obadz ekleog ];
   };
 }
diff --git a/pkgs/servers/mail/opensmtpd/fix-build.diff b/pkgs/servers/mail/opensmtpd/fix-build.diff
new file mode 100644
index 00000000000..1f995fd4f62
--- /dev/null
+++ b/pkgs/servers/mail/opensmtpd/fix-build.diff
@@ -0,0 +1,12 @@
+diff --git a/mk/smtpctl/Makefile.am b/mk/smtpctl/Makefile.am
+index 5af0b713..f0fce735 100644
+--- a/mk/smtpctl/Makefile.am
++++ b/mk/smtpctl/Makefile.am
+@@ -4,6 +4,7 @@ sbin_PROGRAMS=          smtpctl
+ 
+ smtpctl_SOURCES=	$(smtpd_srcdir)/enqueue.c
+ smtpctl_SOURCES+=	$(smtpd_srcdir)/parser.c
++smtpctl_SOURCES+=	$(smtpd_srcdir)/config.c
+ smtpctl_SOURCES+=	$(smtpd_srcdir)/log.c
+ smtpctl_SOURCES+=	$(smtpd_srcdir)/envelope.c
+ smtpctl_SOURCES+=	$(smtpd_srcdir)/queue_backend.c