summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-02-11 17:11:53 (UTC)
committer zautrix <zautrix>2005-02-11 17:11:53 (UTC)
commitd45d293d045a8d0f68e09ff9414e2dd6d18dd651 (patch) (unidiff)
tree9ea69affac4d35e8cb96074237702fb0b75e63ce
parent28b0fff54d5e3ddf59e922cae06285c3bdbbf1de (diff)
downloadkdepimpi-d45d293d045a8d0f68e09ff9414e2dd6d18dd651.zip
kdepimpi-d45d293d045a8d0f68e09ff9414e2dd6d18dd651.tar.gz
kdepimpi-d45d293d045a8d0f68e09ff9414e2dd6d18dd651.tar.bz2
fixi
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/libetpan/generic/pop3driver.c9
-rw-r--r--kmicromail/libetpan/pop3/mailpop3.c5
-rw-r--r--kmicromail/libetpan/tools/mailstream_helper.c11
3 files changed, 19 insertions, 6 deletions
diff --git a/kmicromail/libetpan/generic/pop3driver.c b/kmicromail/libetpan/generic/pop3driver.c
index 375879e..475dfcc 100644
--- a/kmicromail/libetpan/generic/pop3driver.c
+++ b/kmicromail/libetpan/generic/pop3driver.c
@@ -257,36 +257,39 @@ static int pop3driver_login(mailsession * session,
257 switch (data->pop3_auth_type) { 257 switch (data->pop3_auth_type) {
258 case POP3DRIVER_AUTH_TYPE_TRY_APOP: 258 case POP3DRIVER_AUTH_TYPE_TRY_APOP:
259 r = mailpop3_login_apop(get_pop3_session(session), userid, password); 259 r = mailpop3_login_apop(get_pop3_session(session), userid, password);
260 if (r != MAILPOP3_NO_ERROR) 260 if (r != MAILPOP3_NO_ERROR)
261 r = mailpop3_login(get_pop3_session(session), userid, password); 261 r = mailpop3_login(get_pop3_session(session), userid, password);
262 break; 262 break;
263 263
264 case POP3DRIVER_AUTH_TYPE_APOP: 264 case POP3DRIVER_AUTH_TYPE_APOP:
265 r = mailpop3_login_apop(get_pop3_session(session), userid, password); 265 r = mailpop3_login_apop(get_pop3_session(session), userid, password);
266 break; 266 break;
267 267
268 default: 268 default:
269 case POP3DRIVER_AUTH_TYPE_PLAIN: 269 case POP3DRIVER_AUTH_TYPE_PLAIN:
270 r = mailpop3_login(get_pop3_session(session), userid, password); 270 r = mailpop3_login(get_pop3_session(session), userid, password);
271 break; 271 break;
272 } 272 }
273 // LR 2 lines
274 int ret = pop3driver_pop3_error_to_mail_error(r);
275 if ( ret == MAIL_NO_ERROR )
276 mailpop3_list(get_pop3_session(session), &msg_tab);
273 277
274 mailpop3_list(get_pop3_session(session), &msg_tab); 278 // LR
275 279 return ret;
276 return pop3driver_pop3_error_to_mail_error(r);
277} 280}
278 281
279static int pop3driver_logout(mailsession * session) 282static int pop3driver_logout(mailsession * session)
280{ 283{
281 int r; 284 int r;
282 285
283 r = mailpop3_quit(get_pop3_session(session)); 286 r = mailpop3_quit(get_pop3_session(session));
284 287
285 return pop3driver_pop3_error_to_mail_error(r); 288 return pop3driver_pop3_error_to_mail_error(r);
286} 289}
287 290
288static int pop3driver_noop(mailsession * session) 291static int pop3driver_noop(mailsession * session)
289{ 292{
290 int r; 293 int r;
291 294
292 r = mailpop3_noop(get_pop3_session(session)); 295 r = mailpop3_noop(get_pop3_session(session));
diff --git a/kmicromail/libetpan/pop3/mailpop3.c b/kmicromail/libetpan/pop3/mailpop3.c
index 28fafe9..691b07a 100644
--- a/kmicromail/libetpan/pop3/mailpop3.c
+++ b/kmicromail/libetpan/pop3/mailpop3.c
@@ -495,34 +495,37 @@ int mailpop3_pass(mailpop3 * f, const char * password)
495 495
496 if (f->pop3_state != POP3_STATE_AUTHORIZATION) 496 if (f->pop3_state != POP3_STATE_AUTHORIZATION)
497 return MAILPOP3_ERROR_BAD_STATE; 497 return MAILPOP3_ERROR_BAD_STATE;
498 498
499 /* send password command */ 499 /* send password command */
500 500
501 snprintf(command, POP3_STRING_SIZE, "PASS %s\r\n", password); 501 snprintf(command, POP3_STRING_SIZE, "PASS %s\r\n", password);
502 r = send_command(f, command); 502 r = send_command(f, command);
503 if (r == -1) 503 if (r == -1)
504 return MAILPOP3_ERROR_STREAM; 504 return MAILPOP3_ERROR_STREAM;
505 505
506 response = read_line(f); 506 response = read_line(f);
507 if (response == NULL) 507 if (response == NULL)
508 return MAILPOP3_ERROR_STREAM; 508 return MAILPOP3_ERROR_STREAM;
509 r = parse_response(f, response); 509 r = parse_response(f, response);
510 510
511 if (r != RESPONSE_OK) 511 if (r != RESPONSE_OK) {
512 // LR
513 fprintf(stderr,"POP3 login error. Response from server:\n%s\n",response );
512 return MAILPOP3_ERROR_BAD_PASSWORD; 514 return MAILPOP3_ERROR_BAD_PASSWORD;
515 }
513 516
514 f->pop3_state = POP3_STATE_TRANSACTION; 517 f->pop3_state = POP3_STATE_TRANSACTION;
515 518
516 return MAILPOP3_NO_ERROR; 519 return MAILPOP3_NO_ERROR;
517} 520}
518 521
519static int read_list(mailpop3 * f, carray ** result); 522static int read_list(mailpop3 * f, carray ** result);
520 523
521 524
522 525
523static int read_uidl(mailpop3 * f, carray * msg_tab); 526static int read_uidl(mailpop3 * f, carray * msg_tab);
524 527
525 528
526 529
527static int mailpop3_do_uidl(mailpop3 * f, carray * msg_tab) 530static int mailpop3_do_uidl(mailpop3 * f, carray * msg_tab)
528{ 531{
diff --git a/kmicromail/libetpan/tools/mailstream_helper.c b/kmicromail/libetpan/tools/mailstream_helper.c
index 146f955..92f4ffe 100644
--- a/kmicromail/libetpan/tools/mailstream_helper.c
+++ b/kmicromail/libetpan/tools/mailstream_helper.c
@@ -85,34 +85,41 @@ char * mailstream_read_line_append(mailstream * stream, MMAPString * line)
85 while (i < stream->read_buffer_len) { 85 while (i < stream->read_buffer_len) {
86 if (stream->read_buffer[i] == '\n') 86 if (stream->read_buffer[i] == '\n')
87 return mailstream_read_len_append(stream, line, i + 1); 87 return mailstream_read_len_append(stream, line, i + 1);
88 i++; 88 i++;
89 } 89 }
90 if (mailstream_read_len_append(stream, line, 90 if (mailstream_read_len_append(stream, line,
91 stream->read_buffer_len) == NULL) 91 stream->read_buffer_len) == NULL)
92 return NULL; 92 return NULL;
93 } 93 }
94 else { 94 else {
95 ssize_t r; 95 ssize_t r;
96 96
97 r = mailstream_feed_read_buffer(stream); 97 r = mailstream_feed_read_buffer(stream);
98 if (r == -1) 98 if (r == -1)
99 return NULL; 99 return NULL;
100 100
101 if (r == 0) 101 if (r == 0) {
102 break; 102 // LR
103 // this avoids a memory access violation later when trying
104 // to remove_trailing_eol from a null string
105 if ( line->len == 0 )
106 return NULL;
107 else
108 break;
109 }
103 } 110 }
104 } 111 }
105 while (1); 112 while (1);
106 113
107 return line->str; 114 return line->str;
108} 115}
109 116
110char * mailstream_read_line_remove_eol(mailstream * stream, MMAPString * line) 117char * mailstream_read_line_remove_eol(mailstream * stream, MMAPString * line)
111{ 118{
112 if (!mailstream_read_line(stream, line)) 119 if (!mailstream_read_line(stream, line))
113 return NULL; 120 return NULL;
114 121
115 remove_trailing_eol(line); 122 remove_trailing_eol(line);
116 123
117 return line->str; 124 return line->str;
118} 125}