imap-send: check for NOLOGIN capability only when using LOGIN command

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> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Kazuki Yamaguchi committed Apr 8, 2016 at 23:02 UTC 6c50a575952fcffa0df0cb435e9e3f4eab74b1bf
1 file changed +5 -5
imap-send.c
+5 -5
@@ -1095,11 +1095,6 @@ static struct imap_store *imap_open_store(struct imap_server_conf *srvc, char *f
1095 srvc->pass = xstrdup(cred.password);
1096 }
1097
1098 - if (CAP(NOLOGIN)) {
1099 - fprintf(stderr, "Skipping account %s@%s, server forbids LOGIN\n", srvc->user, srvc->host);
1100 - goto bail;
1101 - }
1102 -
1098 if (srvc->auth_method) {
1099 struct imap_cmd_cb cb;
1100
@@ -1123,6 +1118,11 @@ static struct imap_store *imap_open_store(struct imap_server_conf *srvc, char *f
1118 goto bail;
1119 }
1120 } else {
1121 + if (CAP(NOLOGIN)) {
1122 + fprintf(stderr, "Skipping account %s@%s, server forbids LOGIN\n",
1123 + srvc->user, srvc->host);
1124 + goto bail;
1125 + }
1126 if (!imap->buf.sock.ssl)
1127 imap_warn("*** IMAP Warning *** Password is being "
1128 "sent in the clear\n");