[dovecot-cvs] dovecot/src/deliver deliver.c, 1.20.2.38, 1.20.2.39 smtp-client.c, 1.1.2.2, 1.1.2.3

tss at dovecot.org tss at dovecot.org
Sun May 13 17:06:22 EEST 2007


Update of /var/lib/cvs/dovecot/src/deliver
In directory talvi:/tmp/cvs-serv14652

Modified Files:
      Tag: branch_1_0
	deliver.c smtp-client.c 
Log Message:
DEBUG environment removal was pretty much broken. Also it was supposed to
remove MAIL_DEBUG, not DEBUG.



Index: deliver.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/deliver/deliver.c,v
retrieving revision 1.20.2.38
retrieving revision 1.20.2.39
diff -u -d -r1.20.2.38 -r1.20.2.39
--- deliver.c	3 Apr 2007 05:42:29 -0000	1.20.2.38
+++ deliver.c	13 May 2007 14:06:19 -0000	1.20.2.39
@@ -277,6 +277,15 @@
 		if (setting_is_bool(key) && strcasecmp(value, "yes") != 0)
 			continue;
 
+		if (strcasecmp(key, "mail_debug") == 0) {
+			/* We'll internally use only DEBUG environment.
+			   Postfix's sendmail binary uses MAIL_DEBUG
+			   environment for different purposes and we really
+			   don't want to enable it. */
+			env_put("DEBUG=1");
+			continue;
+		}
+
 		env_put(t_strconcat(t_str_ucase(key), "=", value, NULL));
 	}
 	i_stream_unref(&input);
@@ -564,9 +573,6 @@
 	config_file_init(config_path);
 	open_logfile(user);
 
-	if (getenv("MAIL_DEBUG") != NULL)
-		env_put("DEBUG=1");
-
 	if (getenv("MAIL_PLUGINS") == NULL)
 		modules = NULL;
 	else {

Index: smtp-client.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/deliver/smtp-client.c,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -d -r1.1.2.2 -r1.1.2.3
--- smtp-client.c	6 Mar 2007 16:57:16 -0000	1.1.2.2
+++ smtp-client.c	13 May 2007 14:06:19 -0000	1.1.2.3
@@ -27,34 +27,16 @@
 	return client;
 }
 
-static void smtp_env_clean(void)
-{
-	extern char **environ;
-	char **p;
-	array_t ARRAY_DEFINE(new_env, char *);
-	unsigned int i, count;
-
-	/* copy the environment, but drop out the unwanted fields. */
-	ARRAY_CREATE(&new_env, pool_datastack_create(), char *, 128);
-	for (p = environ; *p != NULL; p++) {
-		if (strncmp(*p, "DEBUG=", 6) != 0)
-			array_append(&new_env, p, 1);
-	}
-
-	/* then recreate the environment */
-	env_clean();
-
-	p = array_get_modifyable(&new_env, &count);
-	for (i = 0; i < count; i++)
-		env_put(p[i]);
-}
-
 static void smtp_client_run_sendmail(const char *destination,
 				     const char *return_path, int fd)
 {
+	const char *sendmail_path;
 	const char *argv[7];
 
-	argv[0] = deliver_set->sendmail_path;
+	/* since we're removing an environment */
+	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' ?
@@ -66,14 +48,6 @@
 	if (dup2(fd, STDIN_FILENO) < 0)
 		i_fatal("dup2() failed: %m");
 
-	if (getenv("DEBUG") != NULL) {
-		/* Postfix's sendmail binary uses DEBUG environment for its own
-		   purposes, which pretty much break things. Remove it before
-		   continuing. FIXME: Perhaps the whole environment could be
-		   cleaned? */
-		smtp_env_clean();
-	}
-
 	(void)execv(deliver_set->sendmail_path, (char **)argv);
 	i_fatal("execv(%s) failed: %m", deliver_set->sendmail_path);
 }



More information about the dovecot-cvs mailing list