Przeglądaj źródła

allow sandbox to work with changed config values

shtrophic 1 rok temu
rodzic
commit
b7320f580d
1 zmienionych plików z 4 dodań i 5 usunięć
  1. 4 5
      sandbox.c

+ 4 - 5
sandbox.c

@@ -107,9 +107,9 @@ LL_BEGIN(sbox_enter_linux_, const char* basedir, const char *address, int smtp_p
 
 void sbox_enter(const char *basedir)
 {
-    const xs_val *v;
     const char *errstr;
     const char *address = xs_dict_get(srv_config, "address");
+    const char *smtp_url = xs_dict_get(srv_config, "smtp_url");
     int smtp_port = -1;
 
     if (xs_is_true(xs_dict_get(srv_config, "disable_sandbox"))) {
@@ -117,11 +117,10 @@ void sbox_enter(const char *basedir)
         return;
     }
 
-    if ((v = xs_dict_get(srv_config, "email_notifications")) && 
-        (v = xs_dict_get(v, "url"))) {
-        smtp_port = parse_port((const char *)v, &errstr);
+    if (xs_is_string(smtp_url) && *smtp_url != '\0') {
+        smtp_port = parse_port(smtp_url, &errstr);
         if (errstr)
-            srv_debug(0, xs_fmt("Couldn't determine port from '%s': %s", (const char *)v, errstr));
+            srv_debug(0, xs_fmt("Couldn't determine port from '%s': %s", smtp_url, errstr));
     }
 
     if (sbox_enter_linux_(basedir, address, smtp_port) == 0)