imap fix;

master
Alexander Vdolainen 4 years ago
parent ef5042412b
commit 573e0a9eaa

@ -11,7 +11,7 @@ AM_CFLAGS = -Wall -g
bin_PROGRAMS = ejabberdauth bin_PROGRAMS = ejabberdauth
ejabberdauth_SOURCES = main.c eport.c tls.c ejabberdauth_SOURCES = main.c eport.c tls.c imap.c
ejabberdauth_LDADD = $(LIBS) $(OPENSSL_LIBS) ejabberdauth_LDADD = $(LIBS) $(OPENSSL_LIBS)

@ -76,5 +76,17 @@ int imap_auth(struct tlsport *p, struct ejabber_msg *m)
if(strncmp(buf, "a OK", 4)) return -1; if(strncmp(buf, "a OK", 4)) return -1;
/* check for leftovers */
if(len == IMAPLINE_LENGTH - sizeof(char)) {
do {
len = tls_io(p, buf, IMAPLINE_LENGTH - sizeof(char), TLSIO_READ);
} while(len == IMAPLINE_LENGTH - sizeof(char));
memset(buf, '\0', IMAPLINE_LENGTH);
} else memset(buf, '\0', len = sizeof(char));
/* say logout */
snprintf(buf, IMAPLINE_LENGTH - sizeof(char), "a logout");
len = tls_io(p, buf, 9, TLSIO_WRITE);
return 0; return 0;
} }

Loading…
Cancel
Save