diff options
| author | Sergey Poznyakoff <gray@gnu.org> | 2022-02-18 16:59:30 +0200 |
|---|---|---|
| committer | Sergey Poznyakoff <gray@gnu.org> | 2022-02-18 17:26:42 +0200 |
| commit | 6f0dfc97a0484029d8719cd6fd629fa7f4af814c (patch) | |
| tree | f659d3e929b49e3e944f45f0bd173b97c79e5d44 | |
| parent | 826c48d8bee69bea1f7b7b786d81d513cb82c570 (diff) | |
| download | mailutils-6f0dfc97a0484029d8719cd6fd629fa7f4af814c.tar.gz | |
Fix GSASL stream initialization in imap4d
* imap4d/auth_gsasl.c (auth_gsasl): Initialize stream[1],
unless set after return from ioctl.
* libmailutils/stream/fltstream.c (filter_ctl): If both streams
are supplied for MU_IOCTL_OP_SET, combine them into an iostream
prior to setting the transport pointer.
| -rw-r--r-- | imap4d/auth_gsasl.c | 7 | ||||
| -rw-r--r-- | libmailutils/stream/fltstream.c | 9 |
2 files changed, 15 insertions, 1 deletions
diff --git a/imap4d/auth_gsasl.c b/imap4d/auth_gsasl.c index 4fff4d5..307affd 100644 --- a/imap4d/auth_gsasl.c +++ b/imap4d/auth_gsasl.c @@ -119,6 +119,11 @@ auth_gsasl (struct imap4d_auth *ap) ap->response = RESP_NO; return imap4d_auth_resp; } + if (!stream[1]) + { + mu_stream_ref(stream[1] = stream[0]); + } + rc = gsasl_encoder_stream (&newstream[0], stream[0], sess_ctx, MU_STREAM_READ); if (rc) @@ -156,7 +161,7 @@ auth_gsasl (struct imap4d_auth *ap) mu_stream_unref (stream[0]); mu_stream_unref (stream[1]); - + rc = mu_stream_ioctl (iostream, MU_IOCTL_SUBSTREAM, MU_IOCTL_OP_SET, newstream); if (rc) diff --git a/libmailutils/stream/fltstream.c b/libmailutils/stream/fltstream.c index 0d8562a..da9e1fc 100644 --- a/libmailutils/stream/fltstream.c +++ b/libmailutils/stream/fltstream.c @@ -529,6 +529,15 @@ filter_ctl (struct _mu_stream *stream, int code, int opcode, void *ptr) break; case MU_IOCTL_OP_SET: + if (pstr[1] != NULL) + { + mu_stream_t iostr; + status = mu_iostream_create (&iostr, pstr[0], pstr[1]); + if (status) + return status; + pstr[0] = iostr; + } + mu_stream_unref (fs->transport); fs->transport = pstr[0]; mu_stream_ref (fs->transport); |
