Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
mailutils
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
7378e729
...
7378e72919f5eceaf0bfa89e5e2f0dd1c687a9b8
authored
2007-04-30 18:02:14 +0000
by
Wojciech Polak
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Fixed APOP handling.
1 parent
6dbd3ee3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
7 deletions
libproto/pop/mbox.c
libproto/pop/mbox.c
View file @
7378e72
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999,
2000, 2001, 2003, 2005
Free Software Foundation, Inc.
Copyright (C) 1999,
2000,2001,2003,2005,2007
Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
...
...
@@ -190,6 +190,7 @@ struct _pop_data
void
*
func
;
/* Indicate a command is in operation, busy. */
size_t
id
;
/* A second level of distincion, we maybe in the same function
but working on a different message. */
char
*
greeting_banner
;
/* A greeting banner */
unsigned
long
capa
;
/* Server capabilities */
enum
pop_state
state
;
pop_message_t
*
pmessages
;
...
...
@@ -388,6 +389,8 @@ pop_destroy (mu_mailbox_t mbox)
mpd
->
pmessages
[
i
]
=
NULL
;
}
}
if
(
mpd
->
greeting_banner
)
free
(
mpd
->
greeting_banner
);
if
(
mpd
->
buffer
)
free
(
mpd
->
buffer
);
if
(
mpd
->
pmessages
)
...
...
@@ -417,7 +420,6 @@ pop_capa (mu_mailbox_t mbox)
mpd
->
state
=
POP_CAPA_ACK
;
/* POP_CAPA_ACK */
status
=
pop_read_ack
(
mpd
);
CHECK_EAGAIN
(
mpd
,
status
);
MAILBOX_DEBUG0
(
mbox
,
MU_DEBUG_PROT
,
mpd
->
buffer
);
...
...
@@ -645,11 +647,17 @@ pop_stls (mu_mailbox_t mbox)
status
=
pop_writeline
(
mpd
,
"STLS
\r\n
"
);
CHECK_ERROR
(
mpd
,
status
);
MAILBOX_DEBUG0
(
mbox
,
MU_DEBUG_PROT
,
mpd
->
buffer
);
status
=
pop_write
(
mpd
);
CHECK_EAGAIN
(
mpd
,
status
);
mpd
->
state
=
POP_STLS_ACK
;
/* POP_STLS_ACK */
status
=
pop_read_ack
(
mpd
);
CHECK_ERROR
(
mpd
,
status
);
MAILBOX_DEBUG0
(
mbox
,
MU_DEBUG_PROT
,
mpd
->
buffer
);
if
(
strncasecmp
(
mpd
->
buffer
,
"+OK"
,
3
)
!=
0
)
return
-
1
;
...
...
@@ -674,7 +682,7 @@ pop_open (mu_mailbox_t mbox, int flags)
int
status
;
char
*
host
;
size_t
hostlen
=
0
;
long
port
=
110
;
long
port
=
MU_POP_PORT
;
/* Sanity checks. */
if
(
mpd
==
NULL
)
...
...
@@ -749,7 +757,7 @@ pop_open (mu_mailbox_t mbox, int flags)
case
POP_GREETINGS
:
{
/* Swallow the greetings. */
int
gblen
=
0
;
status
=
pop_read_ack
(
mpd
);
CHECK_EAGAIN
(
mpd
,
status
);
MAILBOX_DEBUG0
(
mbox
,
MU_DEBUG_PROT
,
mpd
->
buffer
);
...
...
@@ -757,6 +765,13 @@ pop_open (mu_mailbox_t mbox, int flags)
{
CHECK_ERROR_CLOSE
(
mbox
,
mpd
,
EACCES
);
}
gblen
=
strlen
(
mpd
->
buffer
);
mpd
->
greeting_banner
=
calloc
(
gblen
,
1
);
if
(
mpd
->
greeting_banner
==
NULL
)
{
CHECK_ERROR
(
mpd
,
ENOMEM
);
}
memcpy
(
mpd
->
greeting_banner
,
mpd
->
buffer
,
gblen
);
mpd
->
state
=
POP_CAPA
;
}
...
...
@@ -869,6 +884,9 @@ pop_close (mu_mailbox_t mbox)
}
}
/* And clear any residue. */
if
(
mpd
->
greeting_banner
)
free
(
mpd
->
greeting_banner
);
mpd
->
greeting_banner
=
NULL
;
if
(
mpd
->
pmessages
)
free
(
mpd
->
pmessages
);
mpd
->
pmessages
=
NULL
;
...
...
@@ -2084,11 +2102,11 @@ pop_get_timestamp (pop_data_t mpd)
char
*
timestamp
=
NULL
;
size_t
len
;
len
=
strlen
(
mpd
->
buff
er
);
right
=
memchr
(
mpd
->
buff
er
,
'<'
,
len
);
len
=
strlen
(
mpd
->
greeting_bann
er
);
right
=
memchr
(
mpd
->
greeting_bann
er
,
'<'
,
len
);
if
(
right
)
{
len
=
len
-
(
right
-
mpd
->
buff
er
);
len
=
len
-
(
right
-
mpd
->
greeting_bann
er
);
left
=
memchr
(
right
,
'>'
,
len
);
if
(
left
)
{
...
...
Please
register
or
sign in
to post a comment