commit b6f8d8e
default
·
2024-04-02 15:44:27 +0000 UTC
parent b8975b4
On OpenBSD, don't enable sendmail if email notifications are disabled.
1 files changed,
+11,
-2
M
data.c
M
data.c
+11,
-2
1@@ -117,18 +117,27 @@ int srv_open(char *basedir, int auto_upgrade)
2 srv_debug(1, xs_dup("OpenBSD security disabled by admin"));
3 }
4 else {
5+ int smail = xs_type(xs_dict_get(srv_config, "disable_email_notifications")) != XSTYPE_TRUE;
6+
7 srv_debug(1, xs_fmt("Calling unveil()"));
8 unveil(basedir, "rwc");
9 unveil("/tmp", "rwc");
10- unveil("/usr/sbin/sendmail", "x");
11 unveil("/etc/resolv.conf", "r");
12 unveil("/etc/hosts", "r");
13 unveil("/etc/ssl/openssl.cnf", "r");
14 unveil("/etc/ssl/cert.pem", "r");
15 unveil("/usr/share/zoneinfo", "r");
16+
17+ if (smail)
18+ unveil("/usr/sbin/sendmail", "x");
19+
20 unveil(NULL, NULL);
21 srv_debug(1, xs_fmt("Calling pledge()"));
22- pledge("stdio rpath wpath cpath flock inet proc exec dns fattr", NULL);
23+
24+ if (smail)
25+ pledge("stdio rpath wpath cpath flock inet proc exec dns fattr", NULL);
26+ else
27+ pledge("stdio rpath wpath cpath flock inet proc dns fattr", NULL);
28 }
29 #endif /* __OpenBSD__ */
30