git.iko.soy/typeable/nixpkgs
on master help sign in
opensmtpd: 5.7.3p2 -> 5.9.2p1
e69ed2bobadz
nixos/modules/services/mail/opensmtpd.nix+10−1
@@ -107,7 +107,16 @@ in {
107 wantedBy = [ "multi-user.target" ];
107 wantedBy = [ "multi-user.target" ];
108 wants = [ "network.target" ];
108 wants = [ "network.target" ];
109 after = [ "network.target" ];
109 after = [ "network.target" ];
110+ preStart = ''
111+ mkdir -p /var/spool/smtpd
112+
113+ mkdir -p /var/spool/smtpd/offline
114+ chown root.smtpq /var/spool/smtpd/offline
115+ chmod 770 /var/spool/smtpd/offline
116+
110− preStart = "mkdir -p /var/spool";
117+ mkdir -p /var/spool/smtpd/purge
118+ chmod 700 /var/spool/smtpd/purge
119+ '';
111 serviceConfig.ExecStart = "${opensmtpd}/sbin/smtpd -d -f ${conf} ${args}";
120 serviceConfig.ExecStart = "${opensmtpd}/sbin/smtpd -d -f ${conf} ${args}";
112 environment.OPENSMTPD_PROC_PATH = "${procEnv}/libexec/opensmtpd";
121 environment.OPENSMTPD_PROC_PATH = "${procEnv}/libexec/opensmtpd";
113 };
122 };
pkgs/servers/mail/opensmtpd/default.nix+10−9
@@ -1,17 +1,17 @@
1{ stdenv, fetchurl, autoconf, automake, libtool, bison
1{ stdenv, fetchurl, autoconf, automake, libtool, bison
2−, libasr, libevent, zlib, openssl, db, pam, cacert
2+, libasr, libevent, zlib, openssl, db, pam
3}:
3}:
4
4
5stdenv.mkDerivation rec {
5stdenv.mkDerivation rec {
6 name = "opensmtpd-${version}";
6 name = "opensmtpd-${version}";
7− version = "5.7.3p2";
7+ version = "5.9.2p1";
8
8
9 nativeBuildInputs = [ autoconf automake libtool bison ];
9 nativeBuildInputs = [ autoconf automake libtool bison ];
10 buildInputs = [ libasr libevent zlib openssl db pam ];
10 buildInputs = [ libasr libevent zlib openssl db pam ];
11
11
12 src = fetchurl {
12 src = fetchurl {
13 url = "http://www.opensmtpd.org/archives/${name}.tar.gz";
13 url = "http://www.opensmtpd.org/archives/${name}.tar.gz";
14− sha256 = "0d2973008d0f66bebb84bed516be6c32617735241cc54dd26643529281a8e52b";
14+ sha256 = "07d7f1m5sxyz6mkk228rcm7fsf7350994ayvmhgph333q5rz48im";
15 };
15 };
16
16
17 patches = [ ./proc_path.diff ];
17 patches = [ ./proc_path.diff ];
@@ -23,8 +23,9 @@ stdenv.mkDerivation rec {
23 "--with-pam"
23 "--with-pam"
24 "--without-bsd-auth"
24 "--without-bsd-auth"
25 "--with-sock-dir=/run"
25 "--with-sock-dir=/run"
26− "--with-privsep-user=smtpd"
26+ "--with-user-smtpd=smtpd"
27− "--with-queue-user=smtpq"
27+ "--with-user-queue=smtpq"
28+ "--with-group-queue=smtpq"
28 "--with-ca-file=/etc/ssl/certs/ca-certificates.crt"
29 "--with-ca-file=/etc/ssl/certs/ca-certificates.crt"
29 "--with-libevent-dir=${libevent.dev}"
30 "--with-libevent-dir=${libevent.dev}"
30 "--enable-table-db"
31 "--enable-table-db"
@@ -35,14 +36,14 @@ stdenv.mkDerivation rec {
35 "localstatedir=\${TMPDIR}"
36 "localstatedir=\${TMPDIR}"
36 ];
37 ];
37
38
38− meta = {
39+ meta = with stdenv.lib; {
39 homepage = https://www.opensmtpd.org/;
40 homepage = https://www.opensmtpd.org/;
40 description = ''
41 description = ''
41 A free implementation of the server-side SMTP protocol as defined by
42 A free implementation of the server-side SMTP protocol as defined by
42 RFC 5321, with some additional standard extensions
43 RFC 5321, with some additional standard extensions
43 '';
44 '';
44− license = stdenv.lib.licenses.isc;
45+ license = licenses.isc;
45− platforms = stdenv.lib.platforms.linux;
46+ platforms = platforms.linux;
46− maintainers = [ stdenv.lib.maintainers.rickynils ];
47+ maintainers = with maintainers; [ rickynils obadz ];
47 };
48 };
48}
49}
pkgs/servers/mail/opensmtpd/proc_path.diff+42−34
@@ -1,11 +1,12 @@
1−diff -Naur opensmtpd-5.7.1p1/smtpd/parse.y opensmtpd-5.7.1p1.patched/smtpd/parse.y
1+diff --git a/smtpd/parse.y b/smtpd/parse.y
2−--- opensmtpd-5.7.1p1/smtpd/parse.y 2015-06-30 10:13:34.000000000 +0200
2+index ab02719..c1c77d9 100644
3−+++ opensmtpd-5.7.1p1.patched/smtpd/parse.y 2015-09-26 08:41:17.012472516 +0200
3+--- a/smtpd/parse.y
4−@@ -2519,13 +2519,19 @@
4++++ b/smtpd/parse.y
5+@@ -2534,13 +2534,19 @@ create_filter_proc(char *name, char *prog)
5 {
6 {
6 struct filter_conf *f;
7 struct filter_conf *f;
7 char *path;
8 char *path;
8−+ const char *proc_path;
9++ const char *proc_path;
9
10
10 if (dict_get(&conf->sc_filters, name)) {
11 if (dict_get(&conf->sc_filters, name)) {
11 yyerror("filter \"%s\" already defined", name);
12 yyerror("filter \"%s\" already defined", name);
@@ -13,64 +14,71 @@ diff -Naur opensmtpd-5.7.1p1/smtpd/parse.y opensmtpd-5.7.1p1.patched/smtpd/parse
13 }
14 }
14
15
15- if (asprintf(&path, "%s/filter-%s", PATH_LIBEXEC, prog) == -1) {
16- if (asprintf(&path, "%s/filter-%s", PATH_LIBEXEC, prog) == -1) {
16−+ proc_path = getenv("OPENSMTPD_PROC_PATH");
17++ proc_path = getenv("OPENSMTPD_PROC_PATH");
17−+ if (proc_path == NULL) {
18++ if (proc_path == NULL) {
18−+ proc_path = PATH_LIBEXEC;
19++ proc_path = PATH_LIBEXEC;
19−+ }
20++ }
20+
21+
21+ if (asprintf(&path, "%s/filter-%s", proc_path, prog) == -1) {
22+ if (asprintf(&path, "%s/filter-%s", proc_path, prog) == -1) {
22 yyerror("filter \"%s\" asprintf failed", name);
23 yyerror("filter \"%s\" asprintf failed", name);
23 return (0);
24 return (0);
24 }
25 }
25−diff -Naur opensmtpd-5.7.1p1/smtpd/smtpd.c opensmtpd-5.7.1p1.patched/smtpd/smtpd.c
26+diff --git a/smtpd/smtpd.c b/smtpd/smtpd.c
26−--- opensmtpd-5.7.1p1/smtpd/smtpd.c 2015-06-30 10:13:34.000000000 +0200
27+index afc8891..9b0a80f 100644
27−+++ opensmtpd-5.7.1p1.patched/smtpd/smtpd.c 2015-09-26 08:41:16.998472557 +0200
28+--- a/smtpd/smtpd.c
28−@@ -854,6 +854,7 @@
29++++ b/smtpd/smtpd.c
30+@@ -795,6 +795,7 @@ fork_proc_backend(const char *key, const char *conf, const char *procname)
29 char path[PATH_MAX];
31 char path[PATH_MAX];
30 char name[PATH_MAX];
32 char name[PATH_MAX];
31 char *arg;
33 char *arg;
32−+ char *proc_path;
34++ char *proc_path;
33
35
34 if (strlcpy(name, conf, sizeof(name)) >= sizeof(name)) {
36 if (strlcpy(name, conf, sizeof(name)) >= sizeof(name)) {
35 log_warnx("warn: %s-proc: conf too long", key);
37 log_warnx("warn: %s-proc: conf too long", key);
36−@@ -864,7 +865,12 @@
38+@@ -805,7 +806,12 @@ fork_proc_backend(const char *key, const char *conf, const char *procname)
37 if (arg)
39 if (arg)
38 *arg++ = '\0';
40 *arg++ = '\0';
39
41
40- if (snprintf(path, sizeof(path), PATH_LIBEXEC "/%s-%s", key, name) >=
42- if (snprintf(path, sizeof(path), PATH_LIBEXEC "/%s-%s", key, name) >=
41−+ proc_path = getenv("OPENSMTPD_PROC_PATH");
43++ proc_path = getenv("OPENSMTPD_PROC_PATH");
42−+ if (proc_path == NULL) {
44++ if (proc_path == NULL) {
43−+ proc_path = PATH_LIBEXEC;
45++ proc_path = PATH_LIBEXEC;
44−+ }
46++ }
45+
47+
46+ if (snprintf(path, sizeof(path), "%s/%s-%s", proc_path, key, name) >=
48+ if (snprintf(path, sizeof(path), "%s/%s-%s", proc_path, key, name) >=
47 (ssize_t)sizeof(path)) {
49 (ssize_t)sizeof(path)) {
48 log_warn("warn: %s-proc: exec path too long", key);
50 log_warn("warn: %s-proc: exec path too long", key);
49 return (-1);
51 return (-1);
50−diff -Naur opensmtpd-5.7.1p1/smtpd/table.c opensmtpd-5.7.1p1.patched/smtpd/table.c
52+diff --git a/smtpd/table.c b/smtpd/table.c
51−--- opensmtpd-5.7.1p1/smtpd/table.c 2015-06-30 10:13:34.000000000 +0200
53+index 21ee237..95b5164 100644
52−+++ opensmtpd-5.7.1p1.patched/smtpd/table.c 2015-09-26 08:41:17.005472536 +0200
54+--- a/smtpd/table.c
53−@@ -201,6 +201,7 @@
55++++ b/smtpd/table.c
56+@@ -193,6 +193,7 @@ table_create(const char *backend, const char *name, const char *tag,
54 struct table_backend *tb;
57 struct table_backend *tb;
55 char buf[LINE_MAX];
58 char buf[LINE_MAX];
56 char path[LINE_MAX];
59 char path[LINE_MAX];
57−+ const char *proc_path;
60++ const char *proc_path;
58 size_t n;
61 size_t n;
59 struct stat sb;
62 struct stat sb;
60
63
61−@@ -215,8 +216,14 @@
64+@@ -207,11 +208,16 @@ table_create(const char *backend, const char *name, const char *tag,
62 if (name && table_find(name, NULL))
65 if (name && table_find(name, NULL))
63 fatalx("table_create: table \"%s\" already defined", name);
66 fatalx("table_create: table \"%s\" already defined", name);
64
67
65−+ proc_path = getenv("OPENSMTPD_PROC_PATH");
68++ proc_path = getenv("OPENSMTPD_PROC_PATH");
66−+ if (proc_path == NULL) {
69++ if (proc_path == NULL) {
67−+ proc_path = PATH_LIBEXEC;
70++ proc_path = PATH_LIBEXEC;
68−+ }
71++ }
69+
72+
70 if ((tb = table_backend_lookup(backend)) == NULL) {
73 if ((tb = table_backend_lookup(backend)) == NULL) {
71−- if ((size_t)snprintf(path, sizeof(path), PATH_LIBEXEC "/table-%s",
74+- if ((size_t)snprintf(path, sizeof(path), PATH_LIBEXEC"/table-%s",
75+- backend) >= sizeof(path)) {
76+- fatalx("table_create: path too long \""
77+- PATH_LIBEXEC"/table-%s\"", backend);
72+ if ((size_t)snprintf(path, sizeof(path), "%s/table-%s",
78+ if ((size_t)snprintf(path, sizeof(path), "%s/table-%s",
73−+ proc_path,
74− backend) >= sizeof(path)) {
79++ proc_path, backend) >= sizeof(path)) {
75− fatalx("table_create: path too long \""
80++ fatalx("table_create: path too long \"%s/table-%s\"",
76− PATH_LIBEXEC "/table-%s\"", backend);
81++ proc_path, backend);
82+ }
83+ if (stat(path, &sb) == 0) {
84+ tb = table_backend_lookup("proc");