Commit f223b22f f223b22f5a8cc3ed3428092ddf30dd315a3213f3 by Sergey Poznyakoff

Fix the SMTP SASL (client) without trace.

* include/mailutils/sys/smtp.h (_mu_smtp_get_streams)
(_mu_smtp_set_streams): New protos.
* libproto/mailer/smtp_gsasl.c (insert_gsasl_stream): Use _mu_smtp_get_streams
and _mu_smtp_set_streams to change streams.
* libproto/mailer/smtp_starttls.c (smtp_get_streams): Rename to
_mu_smtp_get_streams. All callers changed.
(smtp_set_streams): Rename to
_mu_smtp_set_streams. All callers changed.
1 parent 9d1a9906
......@@ -97,4 +97,8 @@ int _mu_smtp_mech_impl (mu_smtp_t smtp, mu_list_t list);
int _mu_smtp_data_begin (mu_smtp_t smtp);
int _mu_smtp_data_end (mu_smtp_t smtp);
int _mu_smtp_get_streams (mu_smtp_t smtp, mu_stream_t *streams);
int _mu_smtp_set_streams (mu_smtp_t smtp, mu_stream_t *streams);
#endif
......
......@@ -148,8 +148,8 @@ insert_gsasl_stream (mu_smtp_t smtp, Gsasl_session *sess_ctx)
{
mu_stream_t stream[2], newstream[2];
int rc;
rc = mu_stream_ioctl (smtp->carrier, MU_IOCTL_GET_STREAM, stream);
rc = _mu_smtp_get_streams (smtp, stream);
if (rc)
{
mu_error ("%s failed: %s", "MU_IOCTL_GET_STREAM",
......@@ -158,7 +158,7 @@ insert_gsasl_stream (mu_smtp_t smtp, Gsasl_session *sess_ctx)
}
rc = gsasl_encoder_stream (&newstream[0], stream[0], sess_ctx,
MU_STREAM_READ);
MU_STREAM_READ);
if (rc)
{
mu_error ("%s failed: %s", "gsasl_encoder_stream",
......@@ -179,10 +179,9 @@ insert_gsasl_stream (mu_smtp_t smtp, Gsasl_session *sess_ctx)
mu_stream_flush (stream[1]);
mu_stream_unref (stream[0]);
mu_stream_unref (stream[1]);
rc = _mu_smtp_set_streams (smtp, newstream);
rc = mu_stream_ioctl (smtp->carrier, MU_IOCTL_SET_STREAM, newstream);
mu_stream_unref (newstream[0]);
mu_stream_unref (newstream[1]);
if (rc)
{
mu_error ("%s failed when it should not: %s",
......
......@@ -27,8 +27,8 @@
#include <mailutils/sys/smtp.h>
#include <mailutils/tls.h>
static int
smtp_get_streams (mu_smtp_t smtp, mu_stream_t *streams)
int
_mu_smtp_get_streams (mu_smtp_t smtp, mu_stream_t *streams)
{
int rc;
......@@ -45,8 +45,8 @@ smtp_get_streams (mu_smtp_t smtp, mu_stream_t *streams)
return rc;
}
static int
smtp_set_streams (mu_smtp_t smtp, mu_stream_t *streams)
int
_mu_smtp_set_streams (mu_smtp_t smtp, mu_stream_t *streams)
{
int rc;
......@@ -100,7 +100,7 @@ mu_smtp_starttls (mu_smtp_t smtp)
return MU_ERR_FAILURE;
mu_stream_flush (smtp->carrier);
status = smtp_get_streams (smtp, streams);
status = _mu_smtp_get_streams (smtp, streams);
MU_SMTP_CHECK_ERROR (smtp, status);
status = mu_tls_client_stream_create (&tlsstream,
......@@ -115,7 +115,7 @@ mu_smtp_starttls (mu_smtp_t smtp)
return status;
}
streams[0] = streams[1] = tlsstream;
status = smtp_set_streams (smtp, streams);
status = _mu_smtp_set_streams (smtp, streams);
mu_stream_unref (streams[0]);
mu_stream_unref (streams[1]);
MU_SMTP_CHECK_ERROR (smtp, status);
......