Merge branch 'ky/imap-send' into maint

Support for CRAM-MD5 authentication method in "git imap-send" did
not work well.

* ky/imap-send:
  imap-send: fix CRAM-MD5 response calculation
  imap-send: check for NOLOGIN capability only when using LOGIN command
This commit is contained in:
Junio C Hamano 2016-05-02 14:24:09 -07:00
commit e18ace0951

View File

@ -890,7 +890,7 @@ static char *cram(const char *challenge_64, const char *user, const char *pass)
/* response: "<user> <digest in hex>" */ /* response: "<user> <digest in hex>" */
response = xstrfmt("%s %s", user, hex); response = xstrfmt("%s %s", user, hex);
resp_len = strlen(response) + 1; resp_len = strlen(response);
response_64 = xmallocz(ENCODED_SIZE(resp_len)); response_64 = xmallocz(ENCODED_SIZE(resp_len));
encoded_len = EVP_EncodeBlock((unsigned char *)response_64, encoded_len = EVP_EncodeBlock((unsigned char *)response_64,
@ -1095,11 +1095,6 @@ static struct imap_store *imap_open_store(struct imap_server_conf *srvc, char *f
srvc->pass = xstrdup(cred.password); 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) { if (srvc->auth_method) {
struct imap_cmd_cb cb; 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; goto bail;
} }
} else { } 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) if (!imap->buf.sock.ssl)
imap_warn("*** IMAP Warning *** Password is being " imap_warn("*** IMAP Warning *** Password is being "
"sent in the clear\n"); "sent in the clear\n");