nim-lang / smtp

SMTP client implementation, adapted from the Nim standard library
MIT License
10 stars 5 forks source link

Dual-stack IPv4/IPv6 Implementation is utterly broken #9

Open theAkito opened 10 months ago

theAkito commented 10 months ago

https://github.com/nim-lang/smtp/commit/7eae0f0d834ffe6517031b4570e9aa86ea7c26bf

This commit has broken SSL/TLS.

Proof

https://github.com/theAkito/zoominvitr

Compile & run this project with smtp#8013aa199dedd04905d46acf3484a232378de518, which will work.

nimble uninstall smtp

Then, re-compile & run this project with smtp#7eae0f0d834ffe6517031b4570e9aa86ea7c26bf which will not work.

Error result.

/home/user/.nimble/pkgs/smtp-#7eae0f0d834ffe6517031b4570e9aa86ea7c26bf/smtp.nim(332) close
/home/user/.nimble/pkgs/smtp-#7eae0f0d834ffe6517031b4570e9aa86ea7c26bf/smtp.nim(93) debugSend
/home/user/.choosenim/toolchains/nim-1.6.14/lib/pure/net.nim(1781) send
/home/user/.choosenim/toolchains/nim-1.6.14/lib/pure/net.nim(983) socketError
/home/user/.choosenim/toolchains/nim-1.6.14/lib/pure/net.nim(574) raiseSSLError
Error: unhandled exception: error:1420C114:SSL routines:ssl_write_internal:uninitialized [SslError]

This error is constantly reproducible.

It might not reproduce on certain libssl versions, like Alpine's libssl3-3.1.2-r0 & libssl1.1-1.1.1u-r1.

Definitely reproduces on Debian's libssl1.1.1n-0+deb11u5.


I just constantly reproduced it by running it inside a Docker container on an Ubuntu host. The error appears there, too.

Using 8013aa199dedd04905d46acf3484a232378de518 makes the error disappear.