aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2026-02-10 09:47:53 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2026-02-10 09:47:53 +0000
commit173df359336ce7cb178ba6be8d87d1652876ed2f (patch)
treef1883c76e2cab1965a0e10d70192d0cbd1be2c6b
parent27a9b53363ff44df5b9b5acd17e64c77ec6ede53 (diff)
downloadsmtpd-starttls-proxy-173df359336ce7cb178ba6be8d87d1652876ed2f.tar.gz
Pass the correct arguments (sender, not helohost)
-rw-r--r--src/qmail-remote/qmail-remote.c11
-rw-r--r--src/qmail-remote/qmail-remote.h2
-rw-r--r--src/qmail-remote/tls.c5
3 files changed, 8 insertions, 10 deletions
diff --git a/src/qmail-remote/qmail-remote.c b/src/qmail-remote/qmail-remote.c
index d5bf0ea..aa9df66 100644
--- a/src/qmail-remote/qmail-remote.c
+++ b/src/qmail-remote/qmail-remote.c
@@ -29,13 +29,13 @@
#define dieusage() qmailr_perm("qmail-remote was invoked improperly")
-static inline void exec_notls (int fd, char const *fmtip, unsigned int timeoutremote, size_t helopos, size_t const *eaddrpos, unsigned int n, char const *storage) gccattr_noreturn ;
-static inline void exec_notls (int fd, char const *fmtip, unsigned int timeoutremote, size_t helopos, size_t const *eaddrpos, unsigned int n, char const *storage)
+static inline void exec_notls (int fd, char const *fmtip, unsigned int timeoutremote, size_t const *eaddrpos, unsigned int n, char const *storage) gccattr_noreturn ;
+static inline void exec_notls (int fd, char const *fmtip, unsigned int timeoutremote, size_t const *eaddrpos, unsigned int n, char const *storage)
{
unsigned int m = 0 ;
char fmtfd[UINT_FMT] ;
char fmtt[UINT_FMT] ;
- char const *argv[11 + n] ;
+ char const *argv[10 + n] ;
LOLDEBUG("connected to %s, sending without TLS", fmtip) ;
fmtfd[uint_fmt(fmtfd, (unsigned int)fd)] = 0 ;
@@ -49,7 +49,6 @@ static inline void exec_notls (int fd, char const *fmtip, unsigned int timeoutre
argv[m++] = fmtfd ;
argv[m++] = "--" ;
argv[m++] = fmtip ;
- argv[m++] = storage + helopos ;
for (unsigned int i = 0 ; i < n ; i++) argv[m++] = storage + eaddrpos[i] ;
argv[m++] = 0 ;
exec(argv) ;
@@ -121,12 +120,12 @@ static void attempt_smtp (int fd, char const *ip, int is6, unsigned int timeoutc
qmailr_smtp_quit(&out, timeoutremote) ;
qmailr_temp("Connected to ", fmtip, " but connection died") ;
}
- else if (r == 220) run_tls(fd, fmtip, timeoutconnect, timeoutremote, qtls, helopos, eaddrpos, n, mxnamepos, storage) ;
+ else if (r == 220) run_tls(fd, fmtip, timeoutconnect, timeoutremote, qtls, eaddrpos, n, mxnamepos, storage) ;
if (qtls->strictness) return ;
}
else if (qtls->strictness >= 2) return ;
}
- exec_notls(fd, fmtip, timeoutremote, helopos, eaddrpos, n, storage) ;
+ exec_notls(fd, fmtip, timeoutremote, eaddrpos, n, storage) ;
}
int main (int argc, char const *const *argv)
diff --git a/src/qmail-remote/qmail-remote.h b/src/qmail-remote/qmail-remote.h
index ad36d88..ce7de4f 100644
--- a/src/qmail-remote/qmail-remote.h
+++ b/src/qmail-remote/qmail-remote.h
@@ -46,6 +46,6 @@ extern int smtproutes_match (smtproutes const *, char const *, stralloc *, size_
extern void smtproutes_free (smtproutes *) ;
-extern void run_tls (int, char const *, unsigned int, unsigned int, qmailr_tls const *, size_t, size_t const *, unsigned int, size_t, char const *) gccattr_noreturn ;
+extern void run_tls (int, char const *, unsigned int, unsigned int, qmailr_tls const *, size_t const *, unsigned int, size_t, char const *) gccattr_noreturn ;
#endif
diff --git a/src/qmail-remote/tls.c b/src/qmail-remote/tls.c
index a679467..c5e42aa 100644
--- a/src/qmail-remote/tls.c
+++ b/src/qmail-remote/tls.c
@@ -31,7 +31,7 @@ So instead of execing, we spawn it and stick around to translate
the exit code and the error message back to qmail-rspawn.
*/
-void run_tls (int fdr, char const *fmtip, unsigned int timeoutconnect, unsigned int timeoutremote, qmailr_tls const *qtls, size_t helopos, size_t const *eaddrpos, unsigned int n, size_t mxnamepos, char const *storage)
+void run_tls (int fdr, char const *fmtip, unsigned int timeoutconnect, unsigned int timeoutremote, qmailr_tls const *qtls, size_t const *eaddrpos, unsigned int n, size_t mxnamepos, char const *storage)
{
int wstat ;
pid_t pid ;
@@ -48,7 +48,7 @@ void run_tls (int fdr, char const *fmtip, unsigned int timeoutconnect, unsigned
char fmtw[UINT_FMT] ;
char fmtt[UINT_FMT] ;
char fmtk[UINT_FMT] ;
- char const *argv[22 + n] ;
+ char const *argv[21 + n] ;
if (fdw == -1) qmailr_tempusys("duplicate file descriptor") ;
if (pipe(p) == -1) qmailr_tempusys("pipe") ;
@@ -89,7 +89,6 @@ void run_tls (int fdr, char const *fmtip, unsigned int timeoutconnect, unsigned
argv[m++] = fmtw ;
argv[m++] = "--" ;
argv[m++] = fmtip ;
- argv[m++] = storage + helopos ;
for (unsigned int i = 0 ; i < n ; i++) argv[m++] = storage + eaddrpos[i] ;
argv[m++] = 0 ;
pid = mspawn_m(argv, modif.s, modif.len, 0, fa, 2) ;