{"thread":{"id":"41967","subject":"[PATCH 1/2] imap-send: check for NOLOGIN capability only when using LOGIN command","startedAt":"2016-04-08T14:02:24Z","lastAt":"2016-04-08T18:43:44Z","messageCount":3,"participants":["Kazuki Yamaguchi","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"282957","messageId":"20160408140224.GB13469@chikuwa.rhe.jp","threadId":"41967","inReplyTo":"cover.1460122532.git.k@rhe.jp","subject":"[PATCH 1/2] imap-send: check for NOLOGIN capability only when using LOGIN command","fromName":"Kazuki Yamaguchi","fromEmail":"k@rhe.jp","sentAt":"2016-04-08T14:02:24Z","receivedAt":"2016-04-08T14:02:24Z","isPatch":true,"sender":{"key":"k@rhe.jp","avatar":"https://avatars.githubusercontent.com/u/1033740?v=4"},"body":"Don't check for NOLOGIN (LOGINDISABLED) capability when imap.authMethod\nis specified.\n\nLOGINDISABLED capability doesn't forbid using AUTHENTICATE, so it should\nbe allowed, or we can't connect to IMAP servers which only accepts\nAUTHENTICATE command.\n\nSigned-off-by: Kazuki Yamaguchi <k@rhe.jp>\n---\n imap-send.c | 10 +++++-----\n 1 file changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/imap-send.c b/imap-send.c\nindex 2c52027c8445..30979f0c63cc 100644\n--- a/imap-send.c\n+++ b/imap-send.c\n@@ -1095,11 +1095,6 @@ static struct imap_store *imap_open_store(struct imap_server_conf *srvc, char *f\n \t\t\t\tsrvc->pass = xstrdup(cred.password);\n \t\t}\n \n-\t\tif (CAP(NOLOGIN)) {\n-\t\t\tfprintf(stderr, \"Skipping account %s@%s, server forbids LOGIN\\n\", srvc->user, srvc->host);\n-\t\t\tgoto bail;\n-\t\t}\n-\n \t\tif (srvc->auth_method) {\n \t\t\tstruct imap_cmd_cb cb;\n \n@@ -1123,6 +1118,11 @@ static struct imap_store *imap_open_store(struct imap_server_conf *srvc, char *f\n \t\t\t\tgoto bail;\n \t\t\t}\n \t\t} else {\n+\t\t\tif (CAP(NOLOGIN)) {\n+\t\t\t\tfprintf(stderr, \"Skipping account %s@%s, server forbids LOGIN\\n\",\n+\t\t\t\t\tsrvc->user, srvc->host);\n+\t\t\t\tgoto bail;\n+\t\t\t}\n \t\t\tif (!imap->buf.sock.ssl)\n \t\t\t\timap_warn(\"*** IMAP Warning *** Password is being \"\n \t\t\t\t\t  \"sent in the clear\\n\");\n-- \n2.8.1.104.g07d5700.dirty\n"},{"id":"282958","messageId":"20160408140229.GC13469@chikuwa.rhe.jp","threadId":"41967","inReplyTo":"cover.1460122532.git.k@rhe.jp","subject":"[PATCH 2/2] imap-send: fix CRAM-MD5 response calculation","fromName":"Kazuki Yamaguchi","fromEmail":"k@rhe.jp","sentAt":"2016-04-08T14:02:30Z","receivedAt":"2016-04-08T14:02:30Z","isPatch":true,"sender":{"key":"k@rhe.jp","avatar":"https://avatars.githubusercontent.com/u/1033740?v=4"},"body":"Remove extra + 1 from resp_len, the length of the byte sequence to be\nBase64 encoded and passed to the server as the response. Or the response\nincorrectly contains an extra \\0.\n\nSigned-off-by: Kazuki Yamaguchi <k@rhe.jp>\n---\n imap-send.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/imap-send.c b/imap-send.c\nindex 30979f0c63cc..407e46bc8c0e 100644\n--- a/imap-send.c\n+++ b/imap-send.c\n@@ -890,7 +890,7 @@ static char *cram(const char *challenge_64, const char *user, const char *pass)\n \n \t/* response: \"<user> <digest in hex>\" */\n \tresponse = xstrfmt(\"%s %s\", user, hex);\n-\tresp_len = strlen(response) + 1;\n+\tresp_len = strlen(response);\n \n \tresponse_64 = xmallocz(ENCODED_SIZE(resp_len));\n \tencoded_len = EVP_EncodeBlock((unsigned char *)response_64,\n-- \n2.8.1.104.g07d5700.dirty\n"},{"id":"282975","messageId":"xmqqd1q0vt3z.fsf@gitster.mtv.corp.google.com","threadId":"41967","inReplyTo":"20160408140224.GB13469@chikuwa.rhe.jp","subject":"Re: [PATCH 1/2] imap-send: check for NOLOGIN capability only when using LOGIN command","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-04-08T18:43:44Z","receivedAt":"2016-04-08T18:43:44Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Kazuki Yamaguchi <k@rhe.jp> writes:\n\n> Don't check for NOLOGIN (LOGINDISABLED) capability when imap.authMethod\n> is specified.\n>\n> LOGINDISABLED capability doesn't forbid using AUTHENTICATE, so it should\n> be allowed, or we can't connect to IMAP servers which only accepts\n> AUTHENTICATE command.\n\nMakes sense.  The code with this patch applied implements \"An IMAP\nclient which complies with this specification MUST NOT issue the\nLOGIN command if this capability is present.\" correctly.\n\nWill queue.  Thanks.\n\n>\n> Signed-off-by: Kazuki Yamaguchi <k@rhe.jp>\n> ---\n>  imap-send.c | 10 +++++-----\n>  1 file changed, 5 insertions(+), 5 deletions(-)\n>\n> diff --git a/imap-send.c b/imap-send.c\n> index 2c52027c8445..30979f0c63cc 100644\n> --- a/imap-send.c\n> +++ b/imap-send.c\n> @@ -1095,11 +1095,6 @@ static struct imap_store *imap_open_store(struct imap_server_conf *srvc, char *f\n>  \t\t\t\tsrvc->pass = xstrdup(cred.password);\n>  \t\t}\n>  \n> -\t\tif (CAP(NOLOGIN)) {\n> -\t\t\tfprintf(stderr, \"Skipping account %s@%s, server forbids LOGIN\\n\", srvc->user, srvc->host);\n> -\t\t\tgoto bail;\n> -\t\t}\n> -\n>  \t\tif (srvc->auth_method) {\n>  \t\t\tstruct imap_cmd_cb cb;\n>  \n> @@ -1123,6 +1118,11 @@ static struct imap_store *imap_open_store(struct imap_server_conf *srvc, char *f\n>  \t\t\t\tgoto bail;\n>  \t\t\t}\n>  \t\t} else {\n> +\t\t\tif (CAP(NOLOGIN)) {\n> +\t\t\t\tfprintf(stderr, \"Skipping account %s@%s, server forbids LOGIN\\n\",\n> +\t\t\t\t\tsrvc->user, srvc->host);\n> +\t\t\t\tgoto bail;\n> +\t\t\t}\n>  \t\t\tif (!imap->buf.sock.ssl)\n>  \t\t\t\timap_warn(\"*** IMAP Warning *** Password is being \"\n>  \t\t\t\t\t  \"sent in the clear\\n\");\n"}]}