2N/A/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2N/A/*
2N/A * krb5/authdata_plugin.h
2N/A *
2N/A * Copyright (C) 2007 Apple Inc. All Rights Reserved.
2N/A *
2N/A * Export of this software from the United States of America may
2N/A * require a specific license from the United States Government.
2N/A * It is the responsibility of any person or organization contemplating
2N/A * export to obtain such a license before exporting.
2N/A *
2N/A * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
2N/A * distribute this software and its documentation for any purpose and
2N/A * without fee is hereby granted, provided that the above copyright
2N/A * notice appear in all copies and that both that copyright notice and
2N/A * this permission notice appear in supporting documentation, and that
2N/A * the name of M.I.T. not be used in advertising or publicity pertaining
2N/A * to distribution of the software without specific, written prior
2N/A * permission. Furthermore if you modify this software you must label
2N/A * your software as modified software and not distribute it in such a
2N/A * fashion that it might be confused with the original M.I.T. software.
2N/A * M.I.T. makes no representations about the suitability of
2N/A * this software for any purpose. It is provided "as is" without express
2N/A * or implied warranty.
2N/A *
2N/A * AuthorizationData plugin definitions for Kerberos 5.
2N/A */
2N/A
2N/A/*
2N/A * This is considered an INTERNAL interface at this time.
2N/A *
2N/A * Some work is needed before exporting it:
2N/A *
2N/A * + Documentation.
2N/A * + Sample code.
2N/A * + Test cases (preferably automated testing under "make check").
2N/A * + Hook into TGS exchange too; will change API.
2N/A * + Examine memory management issues, especially for Windows; may
2N/A * change API.
2N/A *
2N/A * Other changes that would be nice to have, but not necessarily
2N/A * before making this interface public:
2N/A *
2N/A * + Library support for AD-IF-RELEVANT and similar wrappers. (We can
2N/A * make the plugin construct them if it wants them.)
2N/A * + KDC could combine/optimize wrapped AD elements provided by
2N/A * multiple plugins, e.g., two IF-RELEVANT sequences could be
2N/A * merged. (The preauth plugin API also has this bug, we're going
2N/A * to need a general fix.)
2N/A */
2N/A
2N/A#ifndef KRB5_AUTHDATA_PLUGIN_H_INCLUDED
2N/A#define KRB5_AUTHDATA_PLUGIN_H_INCLUDED
2N/A#include <krb5.h>
2N/A
2N/A/*
2N/A * While arguments of these types are passed-in, for the most part a
2N/A * authorization data module can treat them as opaque. If we need
2N/A * keying data, we can ask for it directly.
2N/A */
2N/Astruct _krb5_db_entry_new;
2N/A
2N/A/*
2N/A * The function table / structure which an authdata server module must export as
2N/A * "authdata_server_0". NOTE: replace "0" with "1" for the type and
2N/A * variable names if this gets picked up by upstream. If the interfaces work
2N/A * correctly, future versions of the table will add either more callbacks or
2N/A * more arguments to callbacks, and in both cases we'll be able to wrap the v0
2N/A * functions.
2N/A */
2N/A/* extern krb5plugin_authdata_ftable_v0 authdata_server_0; */
2N/Atypedef struct krb5plugin_authdata_server_ftable_v0 {
2N/A /* Not-usually-visible name. */
2N/A char *name;
2N/A
2N/A /*
2N/A * Per-plugin initialization/cleanup. The init function is called
2N/A * by the KDC when the plugin is loaded, and the fini function is
2N/A * called before the plugin is unloaded. Both are optional.
2N/A */
2N/A krb5_error_code (*init_proc)(krb5_context, void **);
2N/A void (*fini_proc)(krb5_context, void *);
2N/A /*
2N/A * Actual authorization data handling function. If this field
2N/A * holds a null pointer, this mechanism will be skipped, and the
2N/A * init/fini functions will not be run.
2N/A *
2N/A * This function should only modify the field
2N/A * enc_tkt_reply->authorization_data. All other values should be
2N/A * considered inputs only. And, it should *modify* the field, not
2N/A * overwrite it and assume that there are no other authdata
2N/A * plugins in use.
2N/A *
2N/A * Memory management: authorization_data is a malloc-allocated,
2N/A * null-terminated sequence of malloc-allocated pointers to
2N/A * authorization data structures. This plugin code currently
2N/A * assumes the libraries, KDC, and plugin all use the same malloc
2N/A * pool, which may be a problem if/when we get the KDC code
2N/A * running on Windows.
2N/A *
2N/A * If this function returns a non-zero error code, a message
2N/A * is logged, but no other action is taken. Other authdata
2N/A * plugins will be called, and a response will be sent to the
2N/A * client (barring other problems).
2N/A */
2N/A krb5_error_code (*authdata_proc)(krb5_context,
2N/A struct _krb5_db_entry_new *client,
2N/A krb5_data *req_pkt,
2N/A krb5_kdc_req *request,
2N/A krb5_enc_tkt_part *enc_tkt_reply);
2N/A} krb5plugin_server_authdata_ftable_v0;
2N/A
2N/Atypedef krb5plugin_server_authdata_ftable_v0 krb5plugin_authdata_ftable_v0;
2N/A
2N/Atypedef struct krb5plugin_authdata_server_ftable_v2 {
2N/A /* Not-usually-visible name. */
2N/A char *name;
2N/A
2N/A /*
2N/A * Per-plugin initialization/cleanup. The init function is called
2N/A * by the KDC when the plugin is loaded, and the fini function is
2N/A * called before the plugin is unloaded. Both are optional.
2N/A */
2N/A krb5_error_code (*init_proc)(krb5_context, void **);
2N/A void (*fini_proc)(krb5_context, void *);
2N/A /*
2N/A * Actual authorization data handling function. If this field
2N/A * holds a null pointer, this mechanism will be skipped, and the
2N/A * init/fini functions will not be run.
2N/A *
2N/A * This function should only modify the field
2N/A * enc_tkt_reply->authorization_data. All other values should be
2N/A * considered inputs only. And, it should *modify* the field, not
2N/A * overwrite it and assume that there are no other authdata
2N/A * plugins in use.
2N/A *
2N/A * Memory management: authorization_data is a malloc-allocated,
2N/A * null-terminated sequence of malloc-allocated pointers to
2N/A * authorization data structures. This plugin code currently
2N/A * assumes the libraries, KDC, and plugin all use the same malloc
2N/A * pool, which may be a problem if/when we get the KDC code
2N/A * running on Windows.
2N/A *
2N/A * If this function returns a non-zero error code, a message
2N/A * is logged, but no other action is taken. Other authdata
2N/A * plugins will be called, and a response will be sent to the
2N/A * client (barring other problems).
2N/A */
2N/A krb5_error_code (*authdata_proc)(krb5_context,
2N/A unsigned int flags,
2N/A struct _krb5_db_entry_new *client,
2N/A struct _krb5_db_entry_new *server,
2N/A struct _krb5_db_entry_new *tgs,
2N/A krb5_keyblock *client_key,
2N/A krb5_keyblock *server_key,
2N/A krb5_keyblock *tgs_key,
2N/A krb5_data *req_pkt,
2N/A krb5_kdc_req *request,
2N/A krb5_const_principal for_user_princ,
2N/A krb5_enc_tkt_part *enc_tkt_request,
2N/A krb5_enc_tkt_part *enc_tkt_reply);
2N/A} krb5plugin_authdata_server_ftable_v2;
2N/A
2N/Atypedef krb5plugin_authdata_server_ftable_v2 krb5plugin_authdata_ftable_v2;
2N/A
2N/Atypedef krb5_error_code
2N/A(*authdata_client_plugin_init_proc)(krb5_context context,
2N/A void **plugin_context);
2N/A
2N/A#define AD_USAGE_AS_REQ 0x01
2N/A#define AD_USAGE_TGS_REQ 0x02
2N/A#define AD_USAGE_AP_REQ 0x04
2N/A#define AD_USAGE_KDC_ISSUED 0x08
2N/A#define AD_USAGE_MASK 0x0F
2N/A#define AD_INFORMATIONAL 0x10
2N/A
2N/Astruct _krb5_authdata_context;
2N/A
2N/Atypedef void
2N/A(*authdata_client_plugin_flags_proc)(krb5_context kcontext,
2N/A void *plugin_context,
2N/A krb5_authdatatype ad_type,
2N/A krb5_flags *flags);
2N/A
2N/Atypedef void
2N/A(*authdata_client_plugin_fini_proc)(krb5_context kcontext,
2N/A void *plugin_context);
2N/A
2N/Atypedef krb5_error_code
2N/A(*authdata_client_request_init_proc)(krb5_context kcontext,
2N/A struct _krb5_authdata_context *context,
2N/A void *plugin_context,
2N/A void **request_context);
2N/A
2N/Atypedef void
2N/A(*authdata_client_request_fini_proc)(krb5_context kcontext,
2N/A struct _krb5_authdata_context *context,
2N/A void *plugin_context,
2N/A void *request_context);
2N/A
2N/Atypedef krb5_error_code
2N/A(*authdata_client_import_authdata_proc)(krb5_context kcontext,
2N/A struct _krb5_authdata_context *context,
2N/A void *plugin_context,
2N/A void *request_context,
2N/A krb5_authdata **authdata,
2N/A krb5_boolean kdc_issued_flag,
2N/A krb5_const_principal issuer);
2N/A
2N/Atypedef krb5_error_code
2N/A(*authdata_client_export_authdata_proc)(krb5_context kcontext,
2N/A struct _krb5_authdata_context *context,
2N/A void *plugin_context,
2N/A void *request_context,
2N/A krb5_flags usage,
2N/A krb5_authdata ***authdata);
2N/A
2N/Atypedef krb5_error_code
2N/A(*authdata_client_get_attribute_types_proc)(krb5_context kcontext,
2N/A struct _krb5_authdata_context *context,
2N/A void *plugin_context,
2N/A void *request_context,
2N/A krb5_data **attrs);
2N/A
2N/Atypedef krb5_error_code
2N/A(*authdata_client_get_attribute_proc)(krb5_context kcontext,
2N/A struct _krb5_authdata_context *context,
2N/A void *plugin_context,
2N/A void *request_context,
2N/A const krb5_data *attribute,
2N/A krb5_boolean *authenticated,
2N/A krb5_boolean *complete,
2N/A krb5_data *value,
2N/A krb5_data *display_value,
2N/A int *more);
2N/A
2N/Atypedef krb5_error_code
2N/A(*authdata_client_set_attribute_proc)(krb5_context kcontext,
2N/A struct _krb5_authdata_context *context,
2N/A void *plugin_context,
2N/A void *request_context,
2N/A krb5_boolean complete,
2N/A const krb5_data *attribute,
2N/A const krb5_data *value);
2N/A
2N/Atypedef krb5_error_code
2N/A(*authdata_client_delete_attribute_proc)(krb5_context kcontext,
2N/A struct _krb5_authdata_context *context,
2N/A void *plugin_context,
2N/A void *request_context,
2N/A const krb5_data *attribute);
2N/A
2N/Atypedef krb5_error_code
2N/A(*authdata_client_export_internal_proc)(krb5_context kcontext,
2N/A struct _krb5_authdata_context *context,
2N/A void *plugin_context,
2N/A void *request_context,
2N/A krb5_boolean restrict_authenticated,
2N/A void **ptr);
2N/A
2N/Atypedef void
2N/A(*authdata_client_free_internal_proc)(krb5_context kcontext,
2N/A struct _krb5_authdata_context *context,
2N/A void *plugin_context,
2N/A void *request_context,
2N/A void *ptr);
2N/A
2N/Atypedef krb5_error_code
2N/A(*authdata_client_verify_proc)(krb5_context kcontext,
2N/A struct _krb5_authdata_context *context,
2N/A void *plugin_context,
2N/A void *request_context,
2N/A const krb5_auth_context *auth_context,
2N/A const krb5_keyblock *key,
2N/A const krb5_ap_req *req);
2N/A
2N/Atypedef krb5_error_code
2N/A(*authdata_client_size_proc)(krb5_context kcontext,
2N/A struct _krb5_authdata_context *context,
2N/A void *plugin_context,
2N/A void *request_context,
2N/A size_t *sizep);
2N/A
2N/Atypedef krb5_error_code
2N/A(*authdata_client_externalize_proc)(krb5_context kcontext,
2N/A struct _krb5_authdata_context *context,
2N/A void *plugin_context,
2N/A void *request_context,
2N/A krb5_octet **buffer,
2N/A size_t *lenremain);
2N/A
2N/Atypedef krb5_error_code
2N/A(*authdata_client_internalize_proc)(krb5_context kcontext,
2N/A struct _krb5_authdata_context *context,
2N/A void *plugin_context,
2N/A void *request_context,
2N/A krb5_octet **buffer,
2N/A size_t *lenremain);
2N/A
2N/Atypedef krb5_error_code
2N/A(*authdata_client_copy_proc)(krb5_context kcontext,
2N/A struct _krb5_authdata_context *context,
2N/A void *plugin_context,
2N/A void *request_context,
2N/A void *dst_plugin_context,
2N/A void *dst_request_context);
2N/A
2N/Atypedef struct krb5plugin_authdata_client_ftable_v0 {
2N/A char *name;
2N/A krb5_authdatatype *ad_type_list;
2N/A authdata_client_plugin_init_proc init;
2N/A authdata_client_plugin_fini_proc fini;
2N/A authdata_client_plugin_flags_proc flags;
2N/A authdata_client_request_init_proc request_init;
2N/A authdata_client_request_fini_proc request_fini;
2N/A authdata_client_get_attribute_types_proc get_attribute_types;
2N/A authdata_client_get_attribute_proc get_attribute;
2N/A authdata_client_set_attribute_proc set_attribute;
2N/A authdata_client_delete_attribute_proc delete_attribute;
2N/A authdata_client_export_authdata_proc export_authdata;
2N/A authdata_client_import_authdata_proc import_authdata;
2N/A authdata_client_export_internal_proc export_internal;
2N/A authdata_client_free_internal_proc free_internal;
2N/A authdata_client_verify_proc verify;
2N/A authdata_client_size_proc size;
2N/A authdata_client_externalize_proc externalize;
2N/A authdata_client_internalize_proc internalize;
2N/A authdata_client_copy_proc copy; /* optional */
2N/A} krb5plugin_authdata_client_ftable_v0;
2N/A
2N/A#endif /* KRB5_AUTHDATA_PLUGIN_H_INCLUDED */