tidying
[exim.git] / src / src / routers / queryprogram.c
index e6e538841ed115f4898e69cfddee1e12633a236f..5f0f50cd956d6e2ffbc2af201ffb5cb98e1161ed 100644 (file)
@@ -2,11 +2,14 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
 /* Copyright (c) University of Cambridge 1995 - 2018 */
-/* Copyright (c) The Exim Maintainers 2020 - 2021 */
 /* See the file NOTICE for conditions of use and distribution. */
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 
 #include "../exim.h"
+
+#ifdef ROUTER_QUERYPROGRAM     /* Remainder of file */
 #include "rf_functions.h"
 #include "queryprogram.h"
 
@@ -86,13 +89,13 @@ queryprogram_router_options_block *ob =
 
 /* A command must be given */
 
-if (ob->command == NULL)
+if (!ob->command)
   log_write(0, LOG_PANIC_DIE|LOG_CONFIG_FOR, "%s router:\n  "
     "a command specification is required", rblock->name);
 
 /* A uid/gid must be supplied */
 
-if (!ob->cmd_uid_set && ob->expand_cmd_uid == NULL)
+if (!ob->cmd_uid_set && !ob->expand_cmd_uid)
   log_write(0, LOG_PANIC_DIE|LOG_CONFIG_FOR, "%s router:\n  "
     "command_user must be specified", rblock->name);
 }
@@ -242,10 +245,6 @@ rc = rf_get_munge_headers(addr, rblock, &addr_prop.extra_headers,
   &addr_prop.remove_headers);
 if (rc != OK) return rc;
 
-#ifdef EXPERIMENTAL_SRS_ALT
-addr_prop.srs_sender = NULL;
-#endif
-
 /* Get the fixed or expanded uid under which the command is to run
 (initialization ensures that one or the other is set). */
 
@@ -290,9 +289,10 @@ if (curr_uid != root_uid && (uid != curr_uid || gid != curr_gid))
 
 /* Set up the command to run */
 
+GET_OPTION("command");
 if (!transport_set_up_command(&argvptr, /* anchor for arg list */
     ob->command,                        /* raw command */
-    TRUE,                               /* expand the arguments */
+    TSUC_EXPAND_ARGS,                   /* arguments expanded but must not be tainted */
     0,                                  /* not relevant when... */
     NULL,                               /* no transporting address */
     US"queryprogram router",            /* for error messages */
@@ -363,10 +363,10 @@ buffer[len] = 0;
 DEBUG(D_route) debug_printf("command wrote: %s\n", buffer);
 
 rword = buffer;
-while (isspace(*rword)) rword++;
+Uskip_whitespace(&rword);
 rdata = rword;
 while (*rdata && !isspace(*rdata)) rdata++;
-if (*rdata) *rdata++ = 0;
+if (*rdata) *rdata++ = '\0';
 
 /* The word must be a known yield name. If it is "REDIRECT", the rest of the
 line is redirection data, as for a .forward file. It may not contain filter
@@ -537,5 +537,6 @@ addr->prop = addr_prop;
 return rf_queue_add(addr, addr_local, addr_remote, rblock, pw) ? OK : DEFER;
 }
 
-#endif   /*!MACRO_PREDEF*/
+#endif /*!MACRO_PREDEF*/
+#endif /*ROUTER_QUERYPROGRAM*/
 /* End of routers/queryprogram.c */