diff options
Diffstat (limited to 'libproto/imap/starttls.c')
-rw-r--r-- | libproto/imap/starttls.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/libproto/imap/starttls.c b/libproto/imap/starttls.c index 0afa8fb94..39e055fb0 100644 --- a/libproto/imap/starttls.c +++ b/libproto/imap/starttls.c @@ -1,5 +1,5 @@ /* GNU Mailutils -- a suite of utilities for electronic mail - Copyright (C) 2010-2019 Free Software Foundation, Inc. + Copyright (C) 2010-2024 Free Software Foundation, Inc. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -32,7 +32,7 @@ mu_imap_starttls (mu_imap_t imap) { #ifdef WITH_TLS int status; - mu_stream_t tlsstream, streams[2]; + mu_stream_t transport; if (imap == NULL) return EINVAL; @@ -63,17 +63,15 @@ mu_imap_starttls (mu_imap_t imap) switch (imap->response) { case MU_IMAP_OK: - status = mu_imapio_get_streams (imap->io, streams); + status = mu_imapio_get_transport (imap->io, &transport); MU_IMAP_CHECK_EAGAIN (imap, status); - status = mu_tls_client_stream_create (&tlsstream, - streams[0], streams[1], 0); - mu_stream_unref (streams[0]); - mu_stream_unref (streams[1]); + mu_stream_unref (transport); + + status = mu_starttls (&transport, NULL, MU_TLS_CLIENT); MU_IMAP_CHECK_EAGAIN (imap, status); - streams[0] = streams[1] = tlsstream; - status = mu_imapio_set_streams (imap->io, streams); - mu_stream_unref (streams[0]); - mu_stream_unref (streams[1]); + + status = mu_imapio_set_transport (imap->io, transport); + mu_stream_unref (transport); MU_IMAP_CHECK_EAGAIN (imap, status); /* Invalidate the capability list */ mu_list_destroy (&imap->capa); |