git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] imap-send: check for NOLOGIN capability only when using LOGIN command
       [not found] <cover.1460122532.git.k@rhe.jp>
@ 2016-04-08 14:02 ` Kazuki Yamaguchi
  2016-04-08 18:43   ` Junio C Hamano
  2016-04-08 14:02 ` [PATCH 2/2] imap-send: fix CRAM-MD5 response calculation Kazuki Yamaguchi
  1 sibling, 1 reply; 3+ messages in thread
From: Kazuki Yamaguchi @ 2016-04-08 14:02 UTC (permalink / raw)
  To: git; +Cc: Hitoshi Mitake

Don't check for NOLOGIN (LOGINDISABLED) capability when imap.authMethod
is specified.

LOGINDISABLED capability doesn't forbid using AUTHENTICATE, so it should
be allowed, or we can't connect to IMAP servers which only accepts
AUTHENTICATE command.

Signed-off-by: Kazuki Yamaguchi <k@rhe.jp>
---
 imap-send.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/imap-send.c b/imap-send.c
index 2c52027c8445..30979f0c63cc 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -1095,11 +1095,6 @@ static struct imap_store *imap_open_store(struct imap_server_conf *srvc, char *f
 				srvc->pass = xstrdup(cred.password);
 		}
 
-		if (CAP(NOLOGIN)) {
-			fprintf(stderr, "Skipping account %s@%s, server forbids LOGIN\n", srvc->user, srvc->host);
-			goto bail;
-		}
-
 		if (srvc->auth_method) {
 			struct imap_cmd_cb cb;
 
@@ -1123,6 +1118,11 @@ static struct imap_store *imap_open_store(struct imap_server_conf *srvc, char *f
 				goto bail;
 			}
 		} else {
+			if (CAP(NOLOGIN)) {
+				fprintf(stderr, "Skipping account %s@%s, server forbids LOGIN\n",
+					srvc->user, srvc->host);
+				goto bail;
+			}
 			if (!imap->buf.sock.ssl)
 				imap_warn("*** IMAP Warning *** Password is being "
 					  "sent in the clear\n");
-- 
2.8.1.104.g07d5700.dirty

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] imap-send: fix CRAM-MD5 response calculation
       [not found] <cover.1460122532.git.k@rhe.jp>
  2016-04-08 14:02 ` [PATCH 1/2] imap-send: check for NOLOGIN capability only when using LOGIN command Kazuki Yamaguchi
@ 2016-04-08 14:02 ` Kazuki Yamaguchi
  1 sibling, 0 replies; 3+ messages in thread
From: Kazuki Yamaguchi @ 2016-04-08 14:02 UTC (permalink / raw)
  To: git; +Cc: Hitoshi Mitake

Remove extra + 1 from resp_len, the length of the byte sequence to be
Base64 encoded and passed to the server as the response. Or the response
incorrectly contains an extra \0.

Signed-off-by: Kazuki Yamaguchi <k@rhe.jp>
---
 imap-send.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/imap-send.c b/imap-send.c
index 30979f0c63cc..407e46bc8c0e 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -890,7 +890,7 @@ static char *cram(const char *challenge_64, const char *user, const char *pass)
 
 	/* response: "<user> <digest in hex>" */
 	response = xstrfmt("%s %s", user, hex);
-	resp_len = strlen(response) + 1;
+	resp_len = strlen(response);
 
 	response_64 = xmallocz(ENCODED_SIZE(resp_len));
 	encoded_len = EVP_EncodeBlock((unsigned char *)response_64,
-- 
2.8.1.104.g07d5700.dirty

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] imap-send: check for NOLOGIN capability only when using LOGIN command
  2016-04-08 14:02 ` [PATCH 1/2] imap-send: check for NOLOGIN capability only when using LOGIN command Kazuki Yamaguchi
@ 2016-04-08 18:43   ` Junio C Hamano
  0 siblings, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2016-04-08 18:43 UTC (permalink / raw)
  To: Kazuki Yamaguchi; +Cc: git, Hitoshi Mitake

Kazuki Yamaguchi <k@rhe.jp> writes:

> Don't check for NOLOGIN (LOGINDISABLED) capability when imap.authMethod
> is specified.
>
> LOGINDISABLED capability doesn't forbid using AUTHENTICATE, so it should
> be allowed, or we can't connect to IMAP servers which only accepts
> AUTHENTICATE command.

Makes sense.  The code with this patch applied implements "An IMAP
client which complies with this specification MUST NOT issue the
LOGIN command if this capability is present." correctly.

Will queue.  Thanks.

>
> Signed-off-by: Kazuki Yamaguchi <k@rhe.jp>
> ---
>  imap-send.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/imap-send.c b/imap-send.c
> index 2c52027c8445..30979f0c63cc 100644
> --- a/imap-send.c
> +++ b/imap-send.c
> @@ -1095,11 +1095,6 @@ static struct imap_store *imap_open_store(struct imap_server_conf *srvc, char *f
>  				srvc->pass = xstrdup(cred.password);
>  		}
>  
> -		if (CAP(NOLOGIN)) {
> -			fprintf(stderr, "Skipping account %s@%s, server forbids LOGIN\n", srvc->user, srvc->host);
> -			goto bail;
> -		}
> -
>  		if (srvc->auth_method) {
>  			struct imap_cmd_cb cb;
>  
> @@ -1123,6 +1118,11 @@ static struct imap_store *imap_open_store(struct imap_server_conf *srvc, char *f
>  				goto bail;
>  			}
>  		} else {
> +			if (CAP(NOLOGIN)) {
> +				fprintf(stderr, "Skipping account %s@%s, server forbids LOGIN\n",
> +					srvc->user, srvc->host);
> +				goto bail;
> +			}
>  			if (!imap->buf.sock.ssl)
>  				imap_warn("*** IMAP Warning *** Password is being "
>  					  "sent in the clear\n");

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-04-08 18:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <cover.1460122532.git.k@rhe.jp>
2016-04-08 14:02 ` [PATCH 1/2] imap-send: check for NOLOGIN capability only when using LOGIN command Kazuki Yamaguchi
2016-04-08 18:43   ` Junio C Hamano
2016-04-08 14:02 ` [PATCH 2/2] imap-send: fix CRAM-MD5 response calculation Kazuki Yamaguchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).