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