DNS: explicit alloc/free of workspace
[exim.git] / src / src / exim.c
index 3edbc29d3044957f049136c515d0ff69f0a69271..cb11a2a38bf16ef3793eda513e0a341060c46313 100644 (file)
@@ -1669,6 +1669,8 @@ extern char **environ;
 (void)gettimeofday(&timestamp_startup, NULL);
 #endif
 
+store_init();  /* Initialise the memory allocation susbsystem */
+
 /* If the Exim user and/or group and/or the configuration file owner/group were
 defined by ref:name at build time, we must now find the actual uid/gid values.
 This is a feature to make the lives of binary distributors easier. */
@@ -2373,6 +2375,7 @@ on the second character (the one after '-'), to save some effort. */
       int len = Ustrlen(ALT_CONFIG_PREFIX);
       const uschar *list = argrest;
       uschar *filename;
+      /* The argv is untainted, so big_buffer (also untainted) is ok to use */
       while((filename = string_nextinlist(&list, &sep, big_buffer,
              big_buffer_size)))
         if (  (  Ustrlen(filename) < len
@@ -2813,10 +2816,22 @@ on the second character (the one after '-'), to save some effort. */
        case 'S': smtp_peer_options |= OPTION_SIZE; break;
 
 #ifndef DISABLE_TLS
+    /* -MCs: used with -MCt; SNI was sent */
+    /* -MCr: ditto, DANE */
+
+       case 'r':
+       case 's': if (++i < argc)
+                   {
+                   continue_proxy_sni = string_copy_taint(argv[i], TRUE);
+                   if (argrest[1] == 'r') continue_proxy_dane = TRUE;
+                   }
+                 else badarg = TRUE;
+                 break;
+
     /* -MCt: similar to -MCT below but the connection is still open
     via a proxy process which handles the TLS context and coding.
     Require three arguments for the proxied local address and port,
-    and the TLS cipher.  */
+    and the TLS cipher. */
 
        case 't': if (++i < argc)
                    sending_ip_address = string_copy_taint(argv[i], TRUE);
@@ -3208,6 +3223,13 @@ on the second character (the one after '-'), to save some effort. */
        else override_local_interfaces = string_copy_taint(argv[++i], TRUE);
        break;
 
+      /* -oY: Override creation of daemon notifier socket */
+
+      case 'Y':
+       if (*argrest) badarg = TRUE;
+       else notifier_socket = NULL;
+       break;
+
       /* Unknown -o argument */
 
       default:
@@ -4758,16 +4780,16 @@ for (i = 0;;)
 configuration specifies something to use. When running in the test harness,
 any setting of unknown_login overrides the actual name. */
 
-if (originator_login == NULL || f.running_in_test_harness)
+if (!originator_login || f.running_in_test_harness)
   {
-  if (unknown_login != NULL)
+  if (unknown_login)
     {
     originator_login = expand_string(unknown_login);
-    if (originator_name == NULL && unknown_username != NULL)
+    if (!originator_name && unknown_username)
       originator_name = expand_string(unknown_username);
-    if (originator_name == NULL) originator_name = US"";
+    if (!originator_name) originator_name = US"";
     }
-  if (originator_login == NULL)
+  if (!originator_login)
     log_write(0, LOG_MAIN|LOG_PANIC_DIE, "Failed to get user name for uid %d",
       (int)real_uid);
   }
@@ -4775,8 +4797,7 @@ if (originator_login == NULL || f.running_in_test_harness)
 /* Ensure that the user name is in a suitable form for use as a "phrase" in an
 RFC822 address.*/
 
-originator_name = string_copy(parse_fix_phrase(originator_name,
-  Ustrlen(originator_name), big_buffer, big_buffer_size));
+originator_name = US parse_fix_phrase(originator_name, Ustrlen(originator_name));
 
 /* If a message is created by this call of Exim, the uid/gid of its originator
 are those of the caller. These values are overridden if an existing message is