[Indimail-support] dotls handling of CR+LF

4 views
Skip to first unread message

ste...@bande.at

unread,
May 29, 2022, 1:54:54 PM5/29/22
to indimail...@lists.sourceforge.net
Hello Manvendra,

i was looking for better STARTTLS support for an old qmail-ldap installation
(on centos 6) and found your
"dotls" solution as part of your "ucspi-tcp-x" package.
I was able to compile it against openssl 1.1.1o and your libqmail libary on
a test centos 6 vm.

It's working great - thanks for this !

Anyway i have had to modify something in the code.
During debugging (strace) i have seen that the output of our qmail-ldap smtp
daemon was
modified -
1. all "\r\n" were replaced by "\n"
2. trailing"\0" from string isn't removed

Qmail-smtpd write out
pid [23176] write(1, "250-test.dotls.local MX
TEST\r\n250-PIPELINING\r\n250-SIZE 60000000\r\n250 8BITMIME\r\n", 81) = 81

dotls read from qmail
pid [pid 23174] <... read resumed> "250-test.dotls.local MX
TEST\r\n250-PIPELINING\r\n250-SIZE 60000000\r\n250 8BITMIME\r\n", 512) =

dotls output to client
[pid 23174] write(1, "250-test.dotls.local MX TEST\n250-PIPELINING\n250-SIZE
60000000\n250-STARTTLS\n250\0 8BITMIME\n\0", 92) = 92

I'm not a programer (only a little bit shell and perl scripting) so i have
tried to change this
by adapting the code in dotls.c

\r\n handling
***********
void
get1(char *ch)

originial: if (*ch != '\r' && capatext.len < HUGECAPATEXT &&
changed: if ( capatext.len < HUGECAPATEXT &&


STARTTLS insert and trailing \0
***************************
Int
smtp_ehlo(char *arg, char *cmmd, int cmmdlen)

original: if (!stralloc_catb(&capatext, "-STARTTLS\n250", 14) ||
changed: if (!stralloc_catb(&capatext, "-STARTTLS\r\n250", 14) ||

original: if (substdio_put(&ssto, capatext.s, capatext.len) == -1 ||
substdio_flush(&ssto) == -1) {
changed: if (substdio_put(&ssto, capatext.s, capatext.len-1) == -1
|| substdio_flush(&ssto) == -1) {

sorry i'm not familar with creating patch files nor i have a git account to
report this

Maybe this is helpful for others - after these two modifications everything
is working fine.
Thanks again for your helpfull software tools !

If you have any questions or comments please don't hestitate to contact me.

BR
Stefan




_______________________________________________
Indimail-support mailing list
Indimail...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/indimail-support

Manvendra Bhangui

unread,
May 29, 2022, 2:01:51 PM5/29/22
to ste...@bande.at, indimail...@lists.sourceforge.net
On Sun, 29 May 2022 at 23:25, <ste...@bande.at> wrote:
>
> Hello Manvendra,
>
> i was looking for better STARTTLS support for an old qmail-ldap installation
> (on centos 6) and found your
> "dotls" solution as part of your "ucspi-tcp-x" package.
> I was able to compile it against openssl 1.1.1o and your libqmail libary on
> a test centos 6 vm.
>
> It's working great - thanks for this !
>

Thank you
Thank you for taking the time to debug and modify the code. I will
take a look, test and make the necessary changes. I can make out that
you are a good programmer with a keen eye for detecting bugs.
Reply all
Reply to author
Forward
0 new messages