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