Commit 93e59460 authored by Pekka Pessi's avatar Pekka Pessi

Added auth_status_init_with(), as_profile and as_alt_uri.

darcs-hash:20060322031042-65a35-bae922110f79e78b52990c38cefbb257f87e8776.gz
parent 79773196
......@@ -278,18 +278,30 @@ void auth_mod_unref(auth_mod_t *am)
*/
auth_status_t *auth_status_init(void *p, int size)
{
auth_status_t *as;
return auth_status_init_with(p, size, 500, auth_internal_server_error);
}
/** Initialize a auth_status_t stucture.
*
* @retval NULL upon an error
* @relates auth_status_t
*/
auth_status_t *auth_status_init_with(void *p,
int size,
int status,
char const *phrase)
{
auth_status_t *as;
if (!p || size < (sizeof *as))
return NULL;
as = memset(p, 0, size);
as->as_home->suh_size = size;
su_home_init(as->as_home);
/* su_home_init(as->as_home); */
as->as_status = 500;
as->as_phrase = auth_internal_server_error;
as->as_status = status, as->as_phrase = phrase;
return as;
}
......
......@@ -89,7 +89,8 @@ typedef void auth_callback_t(auth_magic_t *, auth_status_t *);
* operation is completed.
*
* It is recommended that the auth_status_t structure is allocated with
* auth_status_new() or initialized with auth_status_init() function.
* auth_status_new() or initialized with auth_status_init() or
* auth_status_init_with() functions.
*/
struct auth_status_t
{
......@@ -97,10 +98,13 @@ struct auth_status_t
int as_status; /**< Return authorization status [out] */
char const *as_phrase; /**< Return response phrase [out] */
char const *as_user; /**< Authenticated user name [in/out] */
char const *as_user; /**< Authenticated username [in/out] */
char const *as_display; /**< Return user's real name [in/out] */
url_t const *as_user_uri; /**< Return user's identity [in/out] */
char const *as_alt_uri; /**< List of alternative identities [out] */
unsigned as_profile; /**< User profile (group) [out] */
su_addrinfo_t *as_source; /**< Source address [in] */
char const *as_realm; /**< Authentication realm [in] */
......@@ -169,6 +173,8 @@ auth_mod_t *auth_mod_ref(auth_mod_t *am);
void auth_mod_unref(auth_mod_t *am);
auth_status_t *auth_status_init(void *, int size);
auth_status_t *auth_status_init_with(void *, int size,
int status, char const *phrase);
auth_status_t *auth_status_new(su_home_t *);
......@@ -185,6 +191,10 @@ void auth_mod_challenge(auth_mod_t *am,
auth_status_t *as,
auth_challenger_t const *ach);
void auth_mod_authorize(auth_mod_t *am,
auth_status_t *as,
auth_challenger_t const *ach);
void auth_mod_cancel(auth_mod_t *am, auth_status_t *as);
/* ====================================================================== */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment