changeset 5602:117ec208d66b HEAD

If sendmail_path was set in config file, it was cleared just before trying to execute it.
author Timo Sirainen <tss@iki.fi>
date Sun, 13 May 2007 17:07:23 +0300
parents b02af502bcd6
children 86886a8fb0f1
files src/deliver/smtp-client.c
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/deliver/smtp-client.c	Sun May 13 16:45:49 2007 +0300
+++ b/src/deliver/smtp-client.c	Sun May 13 17:07:23 2007 +0300
@@ -28,9 +28,13 @@
 smtp_client_run_sendmail(const char *destination,
 			 const char *return_path, int fd)
 {
-	const char *argv[7];
+	const char *argv[7], *sendmail_path;
 
-	argv[0] = deliver_set->sendmail_path;
+	/* deliver_set's contents may point to environment variables.
+	   deliver_env_clean() cleans them up, so they have to be copied. */
+	sendmail_path = t_strdup(deliver_set->sendmail_path);
+
+	argv[0] = sendmail_path;
 	argv[1] = "-i"; /* ignore dots */
 	argv[2] = "-f";
 	argv[3] = return_path != NULL && *return_path != '\0' ?
@@ -44,8 +48,8 @@
 
 	deliver_env_clean();
 
-	(void)execv(deliver_set->sendmail_path, (char **)argv);
-	i_fatal("execv(%s) failed: %m", deliver_set->sendmail_path);
+	(void)execv(sendmail_path, (char **)argv);
+	i_fatal("execv(%s) failed: %m", sendmail_path);
 }
 
 struct smtp_client *smtp_client_open(const char *destination,