mailx/mailx-12.5-empty-from.patch

46 lines
1.5 KiB
Diff

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