Selaa lähdekoodia

Fixed regression while sending email via pipe on OpenBSD.

grunfink 1 vuosi sitten
vanhempi
sitoutus
89c1a4a94b
1 muutettua tiedostoa jossa 8 lisäystä ja 0 poistoa
  1. 8 0
      sandbox.c

+ 8 - 0
sandbox.c

@@ -13,6 +13,8 @@ void sbox_enter(const char *basedir)
         return;
     }
 
+    int smail = !xs_is_true(xs_dict_get(srv_config, "disable_email_notifications"));
+
     srv_debug(1, xs_fmt("Calling unveil()"));
     unveil(basedir,                "rwc");
     unveil("/tmp",                 "rwc");
@@ -25,6 +27,9 @@ void sbox_enter(const char *basedir)
     if (*address == '/')
         unveil(address, "rwc");
 
+    if (smail)
+        unveil("/usr/sbin/sendmail",   "x");
+
     unveil(NULL,                   NULL);
 
     srv_debug(1, xs_fmt("Calling pledge()"));
@@ -34,6 +39,9 @@ void sbox_enter(const char *basedir)
     if (*address == '/')
         p = xs_str_cat(p, " unix");
 
+    if (smail)
+        p = xs_str_cat(p, " exec");
+
     pledge(p, NULL);
 }