rohrpost

A commandline mail client to change the world as we see it.
git clone git://r-36.net/rohrpost
Log | Files | Refs | LICENSE

commit 1e5149467eabdf2c76e7a31466c6e988d002218e
parent fecee315e0cd0f1f1397285fbf3a1797bdc3c425
Author: Christoph Lohmann <20h@r-36.net>
Date:   Sun,  7 Jun 2020 13:38:19 +0200

Add some more tls error checking.

Diffstat:
net.c | 20+++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/net.c b/net.c @@ -165,15 +165,25 @@ net_addssl(net_t *net) struct tls *tls = NULL; struct tls_config *config = NULL; - tls_init(); - tls = tls_client(); - config = tls_config_new(); + if (tls_init() < 0) + return 1; + if ((tls = tls_client()) == NULL) + return 1; + if ((config = tls_config_new()) == NULL) { + tls_free(tls); + return 1; + } tls_config_insecure_noverifycert(config); tls_config_insecure_noverifyname(config); - tls_configure(tls, config); + if (tls_configure(tls, config) < 0) { + fprintf(stderr, "tls_configure: %s\n", tls_error(tls)); + tls_free(tls); + tls_config_free(config); + return 1; + } if (tls_connect_socket(tls, net->fd, net->addr) < 0) { - fprintf(stderr, "tls_connect_socket %s\n", tls_error(tls)); + fprintf(stderr, "tls_connect_socket: %s\n", tls_error(tls)); tls_free(tls); tls_config_free(config); return 1;