@@ -1,5 +1,12 @@
1−{ stdenv, fetchurl, autoconf, automake, libtool, bison
1+{ stdenv, lib, fetchurl, autoconf, automake, libtool, bison
2, libasr, libevent, zlib, openssl, db, pam
2, libasr, libevent, zlib, openssl, db, pam
4+# opensmtpd requires root for no reason to encrypt passwords, this patch fixes it
5+# see also https://github.com/OpenSMTPD/OpenSMTPD/issues/678
6+, unpriviledged_smtpctl_encrypt ? true
8+# This enables you to override the '+' character which typically separates the user from the tag in user+tag@domain.tld
5stdenv.mkDerivation rec {
12stdenv.mkDerivation rec {
@@ -16,6 +23,16 @@ stdenv.mkDerivation rec {
17 patches = [ ./proc_path.diff ];
24 patches = [ ./proc_path.diff ];
26+ postPatch = with builtins; with lib;
27+ optionalString (isString tag_char) ''
28+ sed -i -e "s,TAG_CHAR.*'+',TAG_CHAR '${tag_char}'," smtpd/smtpd-defines.h
30+ optionalString unpriviledged_smtpctl_encrypt ''
31+ substituteInPlace smtpd/smtpctl.c --replace \
33+ 'if (geteuid() != 0 && !(argc > 1 && !strcmp(argv[1], "encrypt")))'
19 configureFlags = [
36 configureFlags = [
20 "--sysconfdir=/etc"
37 "--sysconfdir=/etc"
21 "--localstatedir=/var"
38 "--localstatedir=/var"