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
fa523d76
...
fa523d76253c3d558afb4087d99620f497fe3f35
authored
2003-09-10 14:05:37 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
(authority_authenticate): Authentication methods are now stored as a list.
1 parent
47c1dc84
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
6 deletions
mailbox/auth.c
mailbox/auth.c
View file @
fa523d7
...
...
@@ -24,9 +24,9 @@
#include <string.h>
#include <stdlib.h>
#include <mailutils/errno.h>
#include <auth0.h>
static
int
_authenticate_null
(
authority_t
auth
ARG_UNUSED
)
{
...
...
@@ -37,9 +37,9 @@ int
authority_create_null
(
authority_t
*
pauthority
,
void
*
owner
)
{
int
rc
=
authority_create
(
pauthority
,
NULL
,
owner
);
if
(
rc
)
if
(
rc
)
return
rc
;
(
*
pauthority
)
->
_authenticate
=
_authenticate_null
;
authority_set_authenticate
(
*
pauthority
,
_authenticate_null
,
owner
)
;
return
0
;
}
...
...
@@ -105,12 +105,35 @@ authority_get_ticket (authority_t authority, ticket_t *pticket)
return
0
;
}
struct
auth_cb
{
int
status
;
authority_t
authority
;
};
static
int
try_auth
(
void
*
item
,
void
*
data
)
{
int
(
*
authenticate
)
__P
((
authority_t
))
=
item
;
struct
auth_cb
*
cb
=
data
;
if
(
authenticate
(
cb
->
authority
)
==
0
)
{
cb
->
status
=
0
;
return
1
;
}
return
0
;
}
int
authority_authenticate
(
authority_t
authority
)
{
if
(
authority
&&
authority
->
_authenticate
)
if
(
authority
&&
authority
->
auth_methods
)
{
return
authority
->
_authenticate
(
authority
);
struct
auth_cb
cb
;
cb
.
status
=
MU_ERR_AUTH_FAILURE
;
cb
.
authority
=
authority
;
list_do
(
authority
->
auth_methods
,
try_auth
,
&
cb
);
return
cb
.
status
;
}
return
EINVAL
;
}
...
...
@@ -125,6 +148,12 @@ authority_set_authenticate (authority_t authority,
if
(
authority
->
owner
!=
owner
)
return
EACCES
;
authority
->
_authenticate
=
_authenticate
;
if
(
!
authority
->
auth_methods
)
{
int
rc
=
list_create
(
&
authority
->
auth_methods
);
if
(
rc
)
return
rc
;
}
list_append
(
authority
->
auth_methods
,
_authenticate
);
return
0
;
}
...
...
Please
register
or
sign in
to post a comment