diff options
author | Matthias Andree <matthias.andree@gmx.de> | 2021-08-27 19:24:03 +0200 |
---|---|---|
committer | Matthias Andree <matthias.andree@gmx.de> | 2021-08-27 19:50:58 +0200 |
commit | 616e8c70a39521839847d4c3b61fcb878b689075 (patch) | |
tree | 63de66dd92fefbdefea97aaff326d71d46d45105 /pop3.c | |
parent | 2a2150f4cd1bd6b10c1b327e6aa2704bb421f128 (diff) | |
download | fetchmail-616e8c70a39521839847d4c3b61fcb878b689075.tar.gz fetchmail-616e8c70a39521839847d4c3b61fcb878b689075.tar.bz2 fetchmail-616e8c70a39521839847d4c3b61fcb878b689075.zip |
imap.c, pop3.c: fix protocol regression of 6.4.22.rc1
fetchmail 6.4.22.rc1 clobbered its IMAP state too late, and lost
information on the protocol version in many circumstances.
Consequently, it tried to talk IMAP4 to IMAP4rev1 servers, which failed.
This fix the clear_sessiondata() out to the new constructor and
destructor, such that imap_getauth() only needs to call it after
STARTTLS, when it must re-probe CAPABILITY anyways.
This was the same bug for POP3, which however does not collect state
from the greeting, so that the bug was without effect for POP3.
Reported by: Corey Halpin, FreeBSD port maintainer.
Diffstat (limited to 'pop3.c')
-rw-r--r-- | pop3.c | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -114,6 +114,20 @@ static int do_pop3_ntlm(int sock, struct query *ctl, #define DOTLINE(s) (s[0] == '.' && (s[1]=='\r'||s[1]=='\n'||s[1]=='\0')) +static int pop3_setup(struct query *ctl) +{ + (void)ctl; + clear_sessiondata(); + return PS_SUCCESS; +} + +static int pop3_cleanup(struct query *ctl) +{ + (void)ctl; + clear_sessiondata(); + return PS_SUCCESS; +} + static int pop3_ok (int sock, char *argbuf) /* parse command response */ { @@ -295,8 +309,6 @@ static int pop3_getauth(int sock, struct query *ctl, char *greeting) char *commonname; #endif /* SSL_ENABLE */ - clear_sessiondata(); - /* Set this up before authentication quits early. */ set_peek_capable(ctl); @@ -1388,6 +1400,8 @@ static const struct method pop3 = NULL, /* no action at end of mailbox */ pop3_logout, /* log out, we're done */ FALSE, /* no, we can't re-poll */ + pop3_setup, /* setup method */ + pop3_cleanup /* cleanup method */ }; int doPOP3 (struct query *ctl) |