Commit f23e20ff f23e20ffd01ec882ab2d9f102e2dfc657de76bbd by Sergey Poznyakoff

(_pop_user): Send QUIT before dropping the connection. Provide a better diagnostics.

1 parent 2cbbfcf0
...@@ -474,7 +474,10 @@ _pop_user (authority_t auth) ...@@ -474,7 +474,10 @@ _pop_user (authority_t auth)
474 status = pop_get_user (auth); 474 status = pop_get_user (auth);
475 if (status != 0 || mpd->user == NULL || mpd->user[0] == '\0') 475 if (status != 0 || mpd->user == NULL || mpd->user[0] == '\0')
476 { 476 {
477 CHECK_ERROR_CLOSE (mbox, mpd, EINVAL); 477 pop_writeline (mpd, "QUIT\r\n");
478 MAILBOX_DEBUG0 (mbox, MU_DEBUG_PROT, mpd->buffer);
479 pop_write (mpd);
480 CHECK_ERROR_CLOSE (mbox, mpd, MU_ERR_NOUSERNAME);
478 } 481 }
479 status = pop_writeline (mpd, "USER %s\r\n", mpd->user); 482 status = pop_writeline (mpd, "USER %s\r\n", mpd->user);
480 CHECK_ERROR_CLOSE(mbox, mpd, status); 483 CHECK_ERROR_CLOSE(mbox, mpd, status);
...@@ -505,7 +508,10 @@ _pop_user (authority_t auth) ...@@ -505,7 +508,10 @@ _pop_user (authority_t auth)
505 status = pop_get_passwd (auth); 508 status = pop_get_passwd (auth);
506 if (status != 0 || mpd->passwd == NULL || mpd->passwd[0] == '\0') 509 if (status != 0 || mpd->passwd == NULL || mpd->passwd[0] == '\0')
507 { 510 {
508 CHECK_ERROR_CLOSE (mbox, mpd, EINVAL); 511 pop_writeline (mpd, "QUIT\r\n");
512 MAILBOX_DEBUG0 (mbox, MU_DEBUG_PROT, mpd->buffer);
513 pop_write (mpd);
514 CHECK_ERROR_CLOSE (mbox, mpd, MU_ERR_NOPASSWORD);
509 } 515 }
510 status = pop_writeline (mpd, "PASS %s\r\n", mpd->passwd); 516 status = pop_writeline (mpd, "PASS %s\r\n", mpd->passwd);
511 MAILBOX_DEBUG0 (mbox, MU_DEBUG_PROT, mpd->buffer); 517 MAILBOX_DEBUG0 (mbox, MU_DEBUG_PROT, mpd->buffer);
......