smtp tpt fallback_hosts list must be mutable
authorJeremy Harris <jgh146exb@wizmail.org>
Sat, 15 May 2021 14:41:43 +0000 (15:41 +0100)
committerJeremy Harris <jgh146exb@wizmail.org>
Sun, 27 Jun 2021 23:30:02 +0000 (00:30 +0100)
src/src/readconf.c
src/src/transports/smtp.c

index c8f25aaaf1f781b4402a363938223fe9aa98eeb4..5d14be8111f4c2ba1a1e721e3bdc01bcaad77218 100644 (file)
@@ -3673,6 +3673,16 @@ return NULL;   /* never obeyed */
 
 
 
+static void
+driver_init_fini(driver_instance * d, const uschar * class)
+{
+if (!d->driver_name)
+  log_write(0, LOG_PANIC_DIE|LOG_CONFIG,
+    "no driver defined for %s \"%s\"", class, d->name);
+(d->info->init)(d);
+}
+
+
 /*************************************************
 *             Initialize driver list             *
 *************************************************/
@@ -3733,11 +3743,8 @@ while ((buffer = get_config_line()))
     {
     if (d)
       {
-      if (!d->driver_name)
-        log_write(0, LOG_PANIC_DIE|LOG_CONFIG,
-          "no driver defined for %s \"%s\"", class, d->name);
       /* s is using big_buffer, so this call had better not */
-      (d->info->init)(d);
+      driver_init_fini(d, class);
       d = NULL;
       }
     if (!macro_read_assignment(buffer)) exim_exit(EXIT_FAILURE);
@@ -3753,12 +3760,7 @@ while ((buffer = get_config_line()))
     /* Finish off initializing the previous driver. */
 
     if (d)
-      {
-      if (!d->driver_name)
-        log_write(0, LOG_PANIC_DIE|LOG_CONFIG,
-          "no driver defined for %s \"%s\"", class, d->name);
-      (d->info->init)(d);
-      }
+      driver_init_fini(d, class);
 
     /* Check that we haven't already got a driver of this name */
 
@@ -3822,12 +3824,7 @@ while ((buffer = get_config_line()))
 /* Run the initialization function for the final driver. */
 
 if (d)
-  {
-  if (!d->driver_name)
-    log_write(0, LOG_PANIC_DIE|LOG_CONFIG,
-      "no driver defined for %s \"%s\"", class, d->name);
-  (d->info->init)(d);
-  }
+  driver_init_fini(d, class);
 }
 
 
index e2b2250adcb6b392c1fded04489f5bd8c64452be..dfb4a928492ddcf71aabf84e59e3efc428492365 100644 (file)
@@ -355,6 +355,7 @@ void
 smtp_transport_init(transport_instance *tblock)
 {
 smtp_transport_options_block *ob = SOB tblock->options_block;
+int old_pool = store_pool;
 
 /* Retry_use_local_part defaults FALSE if unset */
 
@@ -390,7 +391,9 @@ if (ob->hosts_override && ob->hosts) tblock->overrides_hosts = TRUE;
 /* If there are any fallback hosts listed, build a chain of host items
 for them, but do not do any lookups at this time. */
 
-host_build_hostlist(&(ob->fallback_hostlist), ob->fallback_hosts, FALSE);
+store_pool = POOL_PERM;
+host_build_hostlist(&ob->fallback_hostlist, ob->fallback_hosts, FALSE);
+store_pool = old_pool;
 }