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
2f36e990
...
2f36e9904d36583e5fa6c611ae305f56d2eb7d27
authored
2001-09-19 02:47:05 +0000
by
Sam Roberts
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Check url authentication type at initialization to trap invalid ones early.
1 parent
cca9cce8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
28 deletions
mailbox/mbx_pop.c
mailbox/mbx_pop.c
View file @
2f36e99
...
...
@@ -48,6 +48,7 @@
#include <mailutils/error.h>
#include <mailbox0.h>
#include <registrar0.h>
#include <url0.h>
#define PROP_RFC822 1
...
...
@@ -288,11 +289,45 @@ _mailbox_pop_init (mailbox_t mbox)
{
pop_data_t
mpd
;
int
status
=
0
;
ticket_t
ticket
=
NULL
;
const
char
*
auth
=
mbox
->
url
->
auth
;
/* Allocate authority based on AUTH type, default to user/pass */
if
(
mbox
->
folder
)
folder_get_ticket
(
mbox
->
folder
,
&
ticket
);
if
(
ticket
==
NULL
)
ticket
=
mbox
->
ticket
;
if
((
status
=
authority_create
(
&
mbox
->
authority
,
ticket
,
mbox
)))
{
return
status
;
}
if
(
auth
==
NULL
||
strcasecmp
(
auth
,
"*"
)
==
0
)
{
authority_set_authenticate
(
mbox
->
authority
,
pop_user
,
mbox
);
}
/*
else...
"+apop" could be supported.
Anything else starting with "+" is an extension mechanism.
Without a "+" it's a SASL mechanism.
*/
else
{
authority_destroy
(
&
mbox
->
authority
,
mbox
);
return
ENOTSUP
;
}
/* Allocate specifics for pop data. */
mpd
=
mbox
->
data
=
calloc
(
1
,
sizeof
(
*
mpd
));
if
(
mbox
->
data
==
NULL
)
return
ENOMEM
;
{
authority_destroy
(
&
mbox
->
authority
,
mbox
);
return
ENOMEM
;
}
mpd
->
mbox
=
mbox
;
/* Back pointer. */
...
...
@@ -343,6 +378,7 @@ END:
free
(
mbox
->
properties
);
if
(
mbox
->
data
)
free
(
mbox
->
data
);
authority_destroy
(
&
mbox
->
authority
,
mbox
);
}
return
status
;
...
...
@@ -593,33 +629,6 @@ pop_open (mailbox_t mbox, int flags)
{
CHECK_ERROR_CLOSE
(
mbox
,
mpd
,
EACCES
);
}
/* Create an authentication if none was set, according to the url. The
default is User/Passwd. */
if
(
mbox
->
authority
==
NULL
)
{
char
auth
[
64
]
=
""
;
size_t
n
=
0
;
url_get_auth
(
mbox
->
url
,
auth
,
sizeof
(
auth
),
&
n
);
if
(
n
==
0
||
strcasecmp
(
auth
,
"*"
)
==
0
)
{
ticket_t
ticket
=
NULL
;
if
(
mbox
->
folder
)
folder_get_ticket
(
mbox
->
folder
,
&
ticket
);
if
(
ticket
==
NULL
)
ticket
=
mbox
->
ticket
;
authority_create
(
&
(
mbox
->
authority
),
ticket
,
mbox
);
authority_set_authenticate
(
mbox
->
authority
,
pop_user
,
mbox
);
}
else
if
(
strcasecmp
(
auth
,
"+apop"
)
==
0
)
{
/* Not supported. */
}
else
{
/* What can we do ? flag an error ? */
}
}
mpd
->
state
=
POP_AUTH
;
}
...
...
Please
register
or
sign in
to post a comment