commit b7320f5

shtrophic  ·  2025-04-29 21:31:04 +0000 UTC
parent 4698583
allow sandbox to work with changed config values
1 files changed,  +4, -5
+4, -5
 1@@ -107,9 +107,9 @@ LL_BEGIN(sbox_enter_linux_, const char* basedir, const char *address, int smtp_p
 2 
 3 void sbox_enter(const char *basedir)
 4 {
 5-    const xs_val *v;
 6     const char *errstr;
 7     const char *address = xs_dict_get(srv_config, "address");
 8+    const char *smtp_url = xs_dict_get(srv_config, "smtp_url");
 9     int smtp_port = -1;
10 
11     if (xs_is_true(xs_dict_get(srv_config, "disable_sandbox"))) {
12@@ -117,11 +117,10 @@ void sbox_enter(const char *basedir)
13         return;
14     }
15 
16-    if ((v = xs_dict_get(srv_config, "email_notifications")) && 
17-        (v = xs_dict_get(v, "url"))) {
18-        smtp_port = parse_port((const char *)v, &errstr);
19+    if (xs_is_string(smtp_url) && *smtp_url != '\0') {
20+        smtp_port = parse_port(smtp_url, &errstr);
21         if (errstr)
22-            srv_debug(0, xs_fmt("Couldn't determine port from '%s': %s", (const char *)v, errstr));
23+            srv_debug(0, xs_fmt("Couldn't determine port from '%s': %s", smtp_url, errstr));
24     }
25 
26     if (sbox_enter_linux_(basedir, address, smtp_port) == 0)