Blame SOURCES/mailx-12.5-empty-from.patch

580d49
diff -uprN nail/sendout.c nail-patched/sendout.c
580d49
--- nail/sendout.c	2015-07-16 14:15:22.864905226 +0200
580d49
+++ nail-patched/sendout.c	2015-07-17 09:41:06.778677181 +0200
580d49
@@ -966,6 +966,19 @@ mail1(struct header *hp, int printheader
580d49
 		return STOP;
580d49
 	}
580d49
 #endif
580d49
+
580d49
+	/*
580d49
+	 * Variable "from" is set but empty, let user know
580d49
+	 * that something is wrong.
580d49
+	 */
580d49
+	if ((cp = value("from")) != NULL && !*cp) {
580d49
+		fprintf(stderr, "From address is empty. ");
580d49
+		fprintf(stderr, "Check your mail config ");
580d49
+		fprintf(stderr, "file for typos. E.g. no ");
580d49
+		fprintf(stderr, "whitespace after set from=");
580d49
+		fprintf(stderr, "\n");
580d49
+	}
580d49
+
580d49
 	if ((cp = value("autocc")) != NULL && *cp)
580d49
 		hp->h_cc = cat(hp->h_cc, checkaddrs(sextract(cp, GCC|GFULL)));
580d49
 	if ((cp = value("autobcc")) != NULL && *cp)
580d49
diff -uprN nail/smtp.c nail-patched/smtp.c
580d49
--- nail/smtp.c	2015-07-16 14:15:17.626914449 +0200
580d49
+++ nail-patched/smtp.c	2015-07-17 09:17:43.412730513 +0200
580d49
@@ -135,7 +135,7 @@ myaddrs(struct header *hp)
580d49
 		if (hp->h_from->n_name)
580d49
 			return savestr(hp->h_from->n_name);
580d49
 	}
580d49
-	if ((cp = value("from")) != NULL)
580d49
+	if ((cp = value("from")) != NULL && *cp)
580d49
 		return cp;
580d49
 	/*
580d49
 	 * When invoking sendmail directly, it's its task
580d49
@@ -177,6 +177,9 @@ smtp_auth_var(const char *type, const ch
580d49
 	char	*var, *cp;
580d49
 	int	len;
580d49
 
580d49
+	if (type == NULL || addr == NULL)
580d49
+		return NULL;
580d49
+
580d49
 	var = ac_alloc(len = strlen(type) + strlen(addr) + 7);
580d49
 	snprintf(var, len, "smtp-auth%s-%s", type, addr);
580d49
 	if ((cp = value(var)) != NULL)