Skip to content

Commit e18ace0

Browse files
committed
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
2 parents 12c5cd7 + eb94ee7 commit e18ace0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

imap-send.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,7 @@ static char *cram(const char *challenge_64, const char *user, const char *pass)
890890

891891
/* response: "<user> <digest in hex>" */
892892
response = xstrfmt("%s %s", user, hex);
893-
resp_len = strlen(response) + 1;
893+
resp_len = strlen(response);
894894

895895
response_64 = xmallocz(ENCODED_SIZE(resp_len));
896896
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
10951095
srvc->pass = xstrdup(cred.password);
10961096
}
10971097

1098-
if (CAP(NOLOGIN)) {
1099-
fprintf(stderr, "Skipping account %s@%s, server forbids LOGIN\n", srvc->user, srvc->host);
1100-
goto bail;
1101-
}
1102-
11031098
if (srvc->auth_method) {
11041099
struct imap_cmd_cb cb;
11051100

@@ -1123,6 +1118,11 @@ static struct imap_store *imap_open_store(struct imap_server_conf *srvc, char *f
11231118
goto bail;
11241119
}
11251120
} 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+
}
11261126
if (!imap->buf.sock.ssl)
11271127
imap_warn("*** IMAP Warning *** Password is being "
11281128
"sent in the clear\n");

0 commit comments

Comments
 (0)