|
View:
New views
6 Messages
—
Rating Filter:
Alert me
|
|
|
imap4d --foreground and DIGEST-MD5 bugletWhen testing imap4d --foreground with DIGEST-MD5 (which has an empty
final client response) I ran into this output: jas@mocca:~/src/mailutils/imap4d master$ ./imap4d --config-file /home/jas/src/www-gsasl/test-server/imap4d.rc --foreground * OK IMAP4rev1 Debugging mode . AUTHENTICATE DIGEST-MD5 + cmVhbG09Im1vY2NhLmpvc2Vmc3Nvbi5vcmciLCBub25jZT0iMktWakJ6dEFCSnl6YkREQ0xjeEd6dz09IiwgcW9wPSJhdXRoIiwgY2hhcnNldD11dGYtOCwgYWxnb3JpdGhtPW1kNS1zZXNz dXNlcm5hbWU9InVzZXIiLCByZWFsbT0ibW9jY2Euam9zZWZzc29uLm9yZyIsIG5vbmNlPSIyS1ZqQnp0QUJKeXpiRERDTGN4R3p3PT0iLCBjbm9uY2U9ImNHLzlMOWN0UlZmRjVxanN1OHZlK3c9PSIsIG5jPTAwMDAwMDAxLCBxb3A9YXV0aCwgZGlnZXN0LXVyaT0iaW1hcC9udWJiLmpvc2Vmc3Nvbi5vcmciLCByZXNwb25zZT1mMTkwM2M4MjBkNjZjMWVmMTQxMDVjNzg0ZWFiYzFlZCwgY2hhcnNldD11dGYtOA== + cnNwYXV0aD1iNWYzZDhmYTcwZDQzMmJlZTBiYzJkMTk1ZDhkMThjNg== jas@mocca:~/src/mailutils/imap4d master$ In the syslog it said: Sep 24 14:02:43 mocca imap4d[8191]: read error on control stream The reason is imap4d_getline in imap4d/util.c: if (len == 0) { imap4d_bye (ERR_NO_IFILE); /*FIXME rc = ECONNABORTED;*/ } This seems wrong -- sometimes (as in the example above) the expected data from the client can be zero-size. I checked, and imap4d_getline is only used by auth_gsasl.c and auth_gss.c. Accepting zero-size responses appears OK in both situations, but also used by imap4d_idle. As far as I can tell, that code could handle a zero-size response, but I'm not certain. How about this patch? /Simon diff --git a/imap4d/util.c b/imap4d/util.c index 8350de0..ad64aa0 100644 --- a/imap4d/util.c +++ b/imap4d/util.c @@ -1383,11 +1383,6 @@ imap4d_getline (char **pbuf, size_t *psize, size_t *pnbytes) else mu_diag_output (MU_DIAG_DEBUG, "got EOF"); } - if (len == 0) - { - imap4d_bye (ERR_NO_IFILE); - /*FIXME rc = ECONNABORTED;*/ - } if (pnbytes) *pnbytes = len; } _______________________________________________ Bug-mailutils mailing list Bug-mailutils@... http://lists.gnu.org/mailman/listinfo/bug-mailutils |
|
|
Re: imap4d --foreground and DIGEST-MD5 bugletThat last patch wasn't perfect, it resulted in "EOF" debug logs on empty
strings. How about this instead. /Simon From 9e6ff72bcd452c9d53f6869d9a425631148ad882 Mon Sep 17 00:00:00 2001 From: Simon Josefsson <simon@...> Date: Thu, 24 Sep 2009 15:01:30 +0200 Subject: [PATCH] Deal with empty lines properly. imap4d/utils.c: Fix. --- imap4d/util.c | 14 +++----------- 1 files changed, 3 insertions(+), 11 deletions(-) diff --git a/imap4d/util.c b/imap4d/util.c index 8350de0..eb5b9c6 100644 --- a/imap4d/util.c +++ b/imap4d/util.c @@ -1375,19 +1375,11 @@ imap4d_getline (char **pbuf, size_t *psize, size_t *pnbytes) if (rc == 0) { char *s = *pbuf; + if (imap4d_transcript && len == 0) + mu_diag_output (MU_DIAG_DEBUG, "got EOF"); len = util_trim_nl (s, len); if (imap4d_transcript) - { - if (len) - mu_diag_output (MU_DIAG_DEBUG, "recv: %s", s); - else - mu_diag_output (MU_DIAG_DEBUG, "got EOF"); - } - if (len == 0) - { - imap4d_bye (ERR_NO_IFILE); - /*FIXME rc = ECONNABORTED;*/ - } + mu_diag_output (MU_DIAG_DEBUG, "recv: %s", s); if (pnbytes) *pnbytes = len; } -- 1.6.3.3 _______________________________________________ Bug-mailutils mailing list Bug-mailutils@... http://lists.gnu.org/mailman/listinfo/bug-mailutils |
|
|
Re: imap4d --foreground and DIGEST-MD5 bugletSimon Josefsson <simon@...> ha escrit:
> if (len == 0) > { > imap4d_bye (ERR_NO_IFILE); > /*FIXME rc = ECONNABORTED;*/ > } > > This seems wrong -- sometimes (as in the example above) the expected > data from the client can be zero-size. Actually, that was because mu_stream_sequential_readline is expected to read at least one byte, i.e. '\n'. If it returns 0 bytes, it means it hit EOF. But the test should definitely go before calling util_trim_nl, which further modifies len. So, I'd rather propose this: diff --git a/imap4d/util.c b/imap4d/util.c index 8350de0..076d524 100644 --- a/imap4d/util.c +++ b/imap4d/util.c @@ -1375,6 +1375,12 @@ imap4d_getline (char **pbuf, size_t *psize, size_t *pnbytes) if (rc == 0) { char *s = *pbuf; + + if (len == 0) + { + imap4d_bye (ERR_NO_IFILE); + /*FIXME rc = ECONNABORTED;*/ + } len = util_trim_nl (s, len); if (imap4d_transcript) { @@ -1383,11 +1389,6 @@ imap4d_getline (char **pbuf, size_t *psize, size_t *pnbytes) else mu_diag_output (MU_DIAG_DEBUG, "got EOF"); } - if (len == 0) - { - imap4d_bye (ERR_NO_IFILE); - /*FIXME rc = ECONNABORTED;*/ - } if (pnbytes) *pnbytes = len; } Can you test if it works for you? Regards, Sergey _______________________________________________ Bug-mailutils mailing list Bug-mailutils@... http://lists.gnu.org/mailman/listinfo/bug-mailutils |
|
|
Re: Re: imap4d --foreground and DIGEST-MD5 bugletSimon Josefsson <simon@...> ha escrit:
> That last patch wasn't perfect, it resulted in "EOF" debug logs on empty > strings. Ah, yes, I overlooked this too. My previous patch becomes then: diff --git a/imap4d/util.c b/imap4d/util.c index 8350de0..ff222ab 100644 --- a/imap4d/util.c +++ b/imap4d/util.c @@ -1375,19 +1375,17 @@ imap4d_getline (char **pbuf, size_t *psize, size_t *pnbytes) if (rc == 0) { char *s = *pbuf; - len = util_trim_nl (s, len); - if (imap4d_transcript) - { - if (len) - mu_diag_output (MU_DIAG_DEBUG, "recv: %s", s); - else - mu_diag_output (MU_DIAG_DEBUG, "got EOF"); - } + if (len == 0) { + if (imap4d_transcript) + mu_diag_output (MU_DIAG_DEBUG, "got EOF"); imap4d_bye (ERR_NO_IFILE); /*FIXME rc = ECONNABORTED;*/ } + len = util_trim_nl (s, len); + if (imap4d_transcript) + mu_diag_output (MU_DIAG_DEBUG, "recv: %s", s); if (pnbytes) *pnbytes = len; } How about this? Regards, Sergey _______________________________________________ Bug-mailutils mailing list Bug-mailutils@... http://lists.gnu.org/mailman/listinfo/bug-mailutils |
|
|
Re: imap4d --foreground and DIGEST-MD5 bugletSergey Poznyakoff <gray@...> writes:
> Simon Josefsson <simon@...> ha escrit: > >> That last patch wasn't perfect, it resulted in "EOF" debug logs on empty >> strings. > > Ah, yes, I overlooked this too. My previous patch becomes then: Works fine here, please push! Thanks, /Simon _______________________________________________ Bug-mailutils mailing list Bug-mailutils@... http://lists.gnu.org/mailman/listinfo/bug-mailutils |
|
|
Re: imap4d --foreground and DIGEST-MD5 bugletSimon Josefsson <simon@...> ha escrit:
> Works fine here, please push! Pushed, as well as the cumulative patch below. Regards, Sergey From 019d0e4703c1176a318717cebe95dd8241a2d3cd Mon Sep 17 00:00:00 2001 From: Simon Josefsson <simon@...> Date: Thu, 24 Sep 2009 20:55:58 +0300 Subject: [PATCH] SASL related fixes. * imap4d/auth_gsasl.c (auth_gsasl): Make IMAP server wait for empty final client response. * include/mailutils/gsasl.h (mu_gsasl_stream_create): Don't use deprecated GNU SASL types. --- imap4d/auth_gsasl.c | 15 ++++++++++++--- include/mailutils/gsasl.h | 3 +-- libmu_auth/gsasl.c | 2 +- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/imap4d/auth_gsasl.c b/imap4d/auth_gsasl.c index f170f81..3ea71ed 100644 --- a/imap4d/auth_gsasl.c +++ b/imap4d/auth_gsasl.c @@ -109,10 +109,19 @@ auth_gsasl (struct imap4d_command *command, char *auth_type, char **username) return RESP_NO; } - /* Some SASL mechanisms output data when GSASL_OK is returned */ + /* Some SASL mechanisms output additional data when GSASL_OK is + returned, and clients must respond with an empty response. */ if (output[0]) - util_send ("+ %s\r\n", output); - + { + util_send ("+ %s\r\n", output); + imap4d_getline (&input_str, &input_size, &input_len); + if (input_len != 0) + { + mu_diag_output (MU_DIAG_NOTICE, _("non-empty client response")); + return RESP_NO; + } + } + free (output); if (*username == NULL) diff --git a/include/mailutils/gsasl.h b/include/mailutils/gsasl.h index 6067746..ef33f25 100644 --- a/include/mailutils/gsasl.h +++ b/include/mailutils/gsasl.h @@ -37,8 +37,7 @@ struct mu_gsasl_module_data mu_gsasl_module_data; #include <gsasl.h> int mu_gsasl_stream_create (mu_stream_t *stream, mu_stream_t transport, - Gsasl_session_ctx *ctx, - int flags); + Gsasl_session *ctx, int flags); #endif -- 1.6.0 _______________________________________________ Bug-mailutils mailing list Bug-mailutils@... http://lists.gnu.org/mailman/listinfo/bug-mailutils |
| Free embeddable forum powered by Nabble | Forum Help |