/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* Copyright 2009 by the Massachusetts Institute of Technology. All
* Rights Reserved.
*
* Export of this software from the United States of America may
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
*
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright notice and
* this permission notice appear in supporting documentation, and that
* the name of M.I.T. not be used in advertising or publicity pertaining
* to distribution of the software without specific, written prior
* permission. Furthermore if you modify this software you must label
* your software as modified software and not distribute it in such a
* fashion that it might be confused with the original M.I.T. software.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
*
*/
#include "k5-int.h"
#include "authdata.h"
#include "auth_con.h"
#include "int-proto.h"
/* Loosely based on preauth2.c */
static const char *objdirs[] = {
#if TARGET_OS_MAC
#endif
}; /* should be a list */
/* Internal authdata systems */
};
static inline int
{
int i;
return 0;
for (i = 0; table->ad_type_list[i]; i++)
;
return i;
}
static krb5_error_code
int *module_count)
{
int j, k = *module_count;
void **rcpp;
#ifdef DEBUG
#endif
return ENOENT;
}
return ENOSYS;
if (code != 0) {
#ifdef DEBUG
#endif
return code;
}
for (j = 0; table->ad_type_list[j] != 0; j++) {
if (j == 0)
else
} else {
}
if (j == 0) {
/* For now, single request per context. That may change */
rcpp);
code = 0;
if (code != 0)
break;
} else {
}
#ifdef DEBUG
#endif
k++;
}
*module_count = k;
return code;
}
/*
* Determine size of to-be-externalized authdata context, for
* modules that match given flags mask. Note that this size
* does not include the magic identifier/trailer.
*/
static krb5_error_code
{
int i;
continue;
/* externalize request context for the first instance only */
if (!IS_PRIMARY_INSTANCE(module))
continue;
continue;
*(module->request_context_pp),
&size);
if (code != 0)
break;
}
return code;
}
/*
* Externalize authdata context, for modules that match given flags
* mask. Note that the magic identifier/trailer is not included.
*/
static krb5_error_code
krb5_octet **buffer,
{
int i;
/* placeholder for count */
if (code != 0)
return code;
continue;
/* externalize request context for the first instance only */
if (!IS_PRIMARY_INSTANCE(module))
continue;
continue;
/*
* We use the module name rather than the authdata type, because
* there may be multiple modules for a particular authdata type.
*/
if (code != 0)
break;
if (code != 0)
break;
*(module->request_context_pp),
&bp,
&remain);
if (code != 0)
break;
ad_count++;
}
if (code == 0) {
/* store actual count */
}
return code;
}
/*
* Find authdata module for authdata type that matches flag mask
*/
static struct _krb5_authdata_context_module *
{
int i;
continue;
/* internalize request context for the first instance only */
if (!IS_PRIMARY_INSTANCE(module))
continue;
/* check for name match */
continue;
break;
}
return ret;
}
/*
* In-place internalize authdata context, for modules that match given
* flags mask. The magic identifier/trailer is not expected by this.
*/
static krb5_error_code
krb5_octet **buffer,
{
if (code != 0)
return code;
for (i = 0; i < count; i++) {
if (code != 0)
break;
break;
}
break;
}
*(module->request_context_pp),
&bp,
&remain);
if (code != 0)
break;
}
if (code == 0) {
}
return code;
}
{
int internal_count = 0;
n_modules = 0;
}
if (PLUGIN_DIR_OPEN(&plugins) == 0 &&
&plugins,
"authdata_client_0",
&tables,
{
}
}
goto cleanup;
}
goto cleanup;
}
/* fill in the structure */
if (code != 0)
goto cleanup;
}
for (i = 0; i < internal_count; i++) {
if (code != 0)
goto cleanup;
}
if (code != 0) {
} else {
/* plugins is owned by context now */
}
return code;
}
void KRB5_CALLCONV
{
int i;
return;
}
}
}
{
}
static krb5_error_code
const krb5_ap_req *ap_req,
{
*kdc_issuer = NULL;
NULL,
&authdata);
return code;
/*
* Note: a module must still implement a verify_authdata
* method, even it is a NOOP that simply records the value
* of the kdc_issued_flag.
*/
authdata[0],
return code;
}
{
int i;
unsigned int len = 0;
int j;
continue;
continue;
*(module->request_context_pp),
&authdata2);
code = 0;
else if (code != 0)
break;
continue;
;
return ENOMEM;
len += j;
}
if (code != 0) {
return code;
}
return 0;
}
const krb5_auth_context *auth_context,
const krb5_keyblock *key,
const krb5_ap_req *ap_req)
{
int i;
continue;
continue;
if (kdc_issued_authdata != NULL) {
NULL,
&authdata);
if (code != 0)
break;
}
&authdata);
if (code != 0)
break;
}
continue;
*(module->request_context_pp),
*(module->request_context_pp),
key,
ap_req);
}
code = 0;
if (code != 0)
break;
}
return code;
}
static krb5_error_code
{
unsigned int i;
krb5_data *d;
return 0;
;
if (d == NULL)
return ENOMEM;
*len += i;
*dst = d;
return 0;
}
{
int i;
unsigned int attrs_len = 0;
continue;
*(module->request_context_pp),
&attrs2))
continue;
if (code != 0) {
break;
}
}
if (code != 0) {
}
return code;
}
int *more)
{
int i;
*authenticated = FALSE;
display_value->length = 0;
/*
* NB at present a module is presumed to be authoritative for
* an attribute; not sure how to federate "more" across module
* yet
*/
continue;
*(module->request_context_pp),
more);
if (code == 0)
break;
}
if (code != 0)
*more = 0;
return code;
}
{
int i;
int found = 0;
continue;
*(module->request_context_pp),
value);
code = 0;
else if (code == 0)
found++;
else
break;
}
return code;
}
{
int i;
int found = 0;
continue;
*(module->request_context_pp),
code = 0;
else if (code == 0)
found++;
else
break;
}
return code;
}
{
if (code != 0)
return code;
return ENOMEM;
return ENOMEM;
}
if (code != 0) {
return code;
}
return 0;
}
const char *module_name,
void **ptr)
{
return ENOENT;
return ENOENT;
*(module->request_context_pp),
ptr);
return code;
}
const char *module_name,
void *ptr)
{
return ENOENT;
return ENOENT;
*(module->request_context_pp),
ptr);
return 0;
}
static krb5_error_code
struct _krb5_authdata_context_module *src_module,
{
int i;
/* XXX is this safe to assume these pointers are interned? */
dst_module = module;
break;
}
}
if (dst_module == NULL)
return ENOENT;
/* copy request context for the first instance only */
if (!IS_PRIMARY_INSTANCE(dst_module))
return 0;
/* If copy is unimplemented, externalize/internalize */
&size);
if (code != 0)
return code;
return ENOMEM;
&bp,
&remain);
if (code != 0) {
return code;
}
&bp,
&remain);
if (code != 0) {
return code;
}
} else {
}
return code;
}
{
int i;
/* XXX we need to init a new context because we can't copy plugins */
if (code != 0)
return code;
if (code != 0)
break;
}
if (code != 0) {
return code;
}
return 0;
}
/*
* Calculate size of to-be-externalized authdata context.
*/
static krb5_error_code
{
if (code != 0)
return code;
return 0;
}
/*
* Externalize an authdata context.
*/
static krb5_error_code
krb5_octet **buffer,
{
/* Our identifier */
if (code != 0)
return code;
/* The actual context data */
if (code != 0)
return code;
/* Our trailer */
if (code != 0)
return code;
return 0;
}
/*
* Internalize an authdata context.
*/
static krb5_error_code
krb5_octet **buffer,
{
if (code != 0)
return code;
if (ibuf != KV5M_AUTHDATA_CONTEXT)
return EINVAL;
if (code != 0)
return code;
if (code != 0) {
return code;
}
if (code != 0)
return code;
if (ibuf != KV5M_AUTHDATA_CONTEXT) {
return EINVAL;
}
return 0;
}
};
/*
* Register the authdata context serializer.
*/
{
return krb5_register_serializer(kcontext,
}