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
d5cb4d08
...
d5cb4d08cb22931c18c26c00b6d765a565d7ca72
authored
2001-07-18 12:46:46 +0000
by
Sam Roberts
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Added checks for low-memory conditions, and look for passwd in url before
prompting user.
1 parent
065d2cc7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
7 deletions
mailbox/mbx_pop.c
mailbox/mbx_pop.c
View file @
d5cb4d0
...
...
@@ -279,20 +279,21 @@ do \
while (0)
/*
Parse the url, a
llocate mailbox_t, allocate pop internal structures. */
/*
A
llocate mailbox_t, allocate pop internal structures. */
int
_mailbox_pop_init
(
mailbox_t
mbox
)
{
pop_data_t
mpd
;
int
status
=
0
;
/* Allocate specifics for pop data. */
mpd
=
mbox
->
data
=
calloc
(
1
,
sizeof
(
*
mpd
));
if
(
mbox
->
data
==
NULL
)
return
ENOMEM
;
mpd
->
mbox
=
mbox
;
/* Back pointer. */
mpd
->
mbox
=
mbox
;
/* Back pointer. */
mpd
->
state
=
POP_NO_STATE
;
/* Init with no state. */
mpd
->
state
=
POP_NO_STATE
;
/* Init with no state. */
/* Initialize the structure. */
mbox
->
_destroy
=
pop_destroy
;
...
...
@@ -315,11 +316,33 @@ _mailbox_pop_init (mailbox_t mbox)
/* Properties. */
mbox
->
properties
=
calloc
(
1
,
sizeof
(
*
(
mbox
->
properties
)));
if
(
mbox
->
properties
==
NULL
)
return
ENOMEM
;
{
status
=
ENOMEM
;
goto
END
;
}
mbox
->
properties_count
=
1
;
mbox
->
properties
[
0
].
key
=
strdup
(
"TYPE"
);
mbox
->
properties
[
0
].
value
=
strdup
(
"POP3"
);
return
0
;
/* Okdoke. */
if
(
mbox
->
properties
[
0
].
key
==
NULL
||
mbox
->
properties
[
0
].
value
==
NULL
)
{
status
=
ENOMEM
;
goto
END
;
}
END:
if
(
status
!=
0
)
{
if
(
mbox
->
properties
[
0
].
key
)
free
(
mbox
->
properties
[
0
].
key
);
if
(
mbox
->
properties
[
0
].
value
)
free
(
mbox
->
properties
[
0
].
value
);
if
(
mbox
->
properties
)
free
(
mbox
->
properties
);
if
(
mbox
->
data
)
free
(
mbox
->
data
);
}
return
status
;
}
/* Cleaning up all the ressources associate with a pop mailbox. */
...
...
@@ -415,8 +438,18 @@ pop_user (authority_t auth)
}
if
(
mpd
->
passwd
)
free
(
mpd
->
passwd
);
/* Fetch the passwd from them. */
ticket_pop
(
ticket
,
"Pop Passwd: "
,
&
mpd
->
passwd
);
/* Was it in the URL? */
{
size_t
n
=
0
;
status
=
url_get_passwd
(
mbox
->
url
,
NULL
,
0
,
&
n
);
if
(
status
!=
0
||
n
==
0
)
ticket_pop
(
ticket
,
"Pop Passwd: "
,
&
mpd
->
passwd
);
else
{
mpd
->
passwd
=
calloc
(
1
,
n
+
1
);
url_get_passwd
(
mbox
->
url
,
mpd
->
passwd
,
n
+
1
,
NULL
);
}
}
if
(
mpd
->
passwd
==
NULL
||
mpd
->
passwd
[
0
]
==
'\0'
)
{
CHECK_ERROR_CLOSE
(
mbox
,
mpd
,
EINVAL
);
...
...
Please
register
or
sign in
to post a comment