Download raw body.
smtpd: correct remove return-path on enqueue
[2025-01-04 07:11] Philipp <philipp+openbsd@bureaucracy.de>
> When the sendmail binary is used to enqueue a mail the return-path field
> is be removed. This is not correct implemented. When the field is foldet
> only the first line of the field is removed. A patch fixing the bug
> is attached.
I have noticed an other bug in this function. When the return-path value
doesn't start with an optional space the field is not filtered. Here is
an updated patch.
Philipp
diff --git a/usr.sbin/smtpd/enqueue.c b/usr.sbin/smtpd/enqueue.c
index 0dc0ffae1a6..19ef2cbe328 100644
--- a/usr.sbin/smtpd/enqueue.c
+++ b/usr.sbin/smtpd/enqueue.c
@@ -180,6 +180,7 @@ enqueue(int argc, char *argv[], FILE *ofp)
ssize_t len;
char *line;
int inheaders = 1;
+ int remove_rpath = 0;
int save_argc;
char **save_argv;
int no_getlogin = 0;
@@ -401,10 +402,15 @@ enqueue(int argc, char *argv[], FILE *ofp)
line = buf;
if (inheaders) {
+ if (remove_rpath && (line[0] == ' ' || line[0] == '\t'))
+ continue;
if (strncasecmp("from ", line, 5) == 0)
continue;
- if (strncasecmp("return-path: ", line, 13) == 0)
+ if (strncasecmp("return-path:", line, 12) == 0) {
+ remove_rpath = 1;
continue;
+ }
+ remove_rpath = 0;
}
if (msg.saw_content_transfer_encoding || msg.noheader ||
smtpd: correct remove return-path on enqueue