annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/krb5/ccselect_plugin.h @ 69:33d812a61356

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 17:55:14 -0400
parents
children
rev   line source
jpayne@69 1 /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
jpayne@69 2 /*
jpayne@69 3 * Copyright (C) 2011 by the Massachusetts Institute of Technology.
jpayne@69 4 * All rights reserved.
jpayne@69 5 *
jpayne@69 6 * Export of this software from the United States of America may
jpayne@69 7 * require a specific license from the United States Government.
jpayne@69 8 * It is the responsibility of any person or organization contemplating
jpayne@69 9 * export to obtain such a license before exporting.
jpayne@69 10 *
jpayne@69 11 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
jpayne@69 12 * distribute this software and its documentation for any purpose and
jpayne@69 13 * without fee is hereby granted, provided that the above copyright
jpayne@69 14 * notice appear in all copies and that both that copyright notice and
jpayne@69 15 * this permission notice appear in supporting documentation, and that
jpayne@69 16 * the name of M.I.T. not be used in advertising or publicity pertaining
jpayne@69 17 * to distribution of the software without specific, written prior
jpayne@69 18 * permission. Furthermore if you modify this software you must label
jpayne@69 19 * your software as modified software and not distribute it in such a
jpayne@69 20 * fashion that it might be confused with the original M.I.T. software.
jpayne@69 21 * M.I.T. makes no representations about the suitability of
jpayne@69 22 * this software for any purpose. It is provided "as is" without express
jpayne@69 23 * or implied warranty.
jpayne@69 24 */
jpayne@69 25
jpayne@69 26 /*
jpayne@69 27 * Declarations for credential cache selection module implementors.
jpayne@69 28 *
jpayne@69 29 * The ccselect pluggable interface currently has only one supported major
jpayne@69 30 * version, which is 1. Major version 1 has a current minor version number of
jpayne@69 31 * 1.
jpayne@69 32 *
jpayne@69 33 * Credential cache selection modules should define a function named
jpayne@69 34 * ccselect_<modulename>_initvt, matching the signature:
jpayne@69 35 *
jpayne@69 36 * krb5_error_code
jpayne@69 37 * ccselect_modname_initvt(krb5_context context, int maj_ver, int min_ver,
jpayne@69 38 * krb5_plugin_vtable vtable);
jpayne@69 39 *
jpayne@69 40 * The initvt function should:
jpayne@69 41 *
jpayne@69 42 * - Check that the supplied maj_ver number is supported by the module, or
jpayne@69 43 * return KRB5_PLUGIN_VER_NOTSUPP if it is not.
jpayne@69 44 *
jpayne@69 45 * - Cast the vtable pointer as appropriate for maj_ver:
jpayne@69 46 * maj_ver == 1: Cast to krb5_ccselect_vtable
jpayne@69 47 *
jpayne@69 48 * - Initialize the methods of the vtable, stopping as appropriate for the
jpayne@69 49 * supplied min_ver. Optional methods may be left uninitialized.
jpayne@69 50 *
jpayne@69 51 * Memory for the vtable is allocated by the caller, not by the module.
jpayne@69 52 */
jpayne@69 53
jpayne@69 54 #ifndef KRB5_CCSELECT_PLUGIN_H
jpayne@69 55 #define KRB5_CCSELECT_PLUGIN_H
jpayne@69 56
jpayne@69 57 #include <krb5/krb5.h>
jpayne@69 58 #include <krb5/plugin.h>
jpayne@69 59
jpayne@69 60 /* An abstract type for credential cache selection module data. */
jpayne@69 61 typedef struct krb5_ccselect_moddata_st *krb5_ccselect_moddata;
jpayne@69 62
jpayne@69 63 #define KRB5_CCSELECT_PRIORITY_AUTHORITATIVE 2
jpayne@69 64 #define KRB5_CCSELECT_PRIORITY_HEURISTIC 1
jpayne@69 65
jpayne@69 66 /*** Method type declarations ***/
jpayne@69 67
jpayne@69 68 /*
jpayne@69 69 * Mandatory: Initialize module data and set *priority_out to one of the
jpayne@69 70 * KRB5_CCSELECT_PRIORITY constants above. Authoritative modules will be
jpayne@69 71 * consulted before heuristic ones.
jpayne@69 72 */
jpayne@69 73 typedef krb5_error_code
jpayne@69 74 (*krb5_ccselect_init_fn)(krb5_context context, krb5_ccselect_moddata *data_out,
jpayne@69 75 int *priority_out);
jpayne@69 76
jpayne@69 77 /*
jpayne@69 78 * Mandatory: Select a cache based on a server principal. Return 0 on success,
jpayne@69 79 * with *cache_out set to the selected cache and *princ_out set to its default
jpayne@69 80 * principal. Return KRB5_PLUGIN_NO_HANDLE to defer to other modules. Return
jpayne@69 81 * KRB5_CC_NOTFOUND with *princ_out set if the client principal can be
jpayne@69 82 * authoritatively determined but no cache exists for it. Return other errors
jpayne@69 83 * as appropriate.
jpayne@69 84 */
jpayne@69 85 typedef krb5_error_code
jpayne@69 86 (*krb5_ccselect_choose_fn)(krb5_context context, krb5_ccselect_moddata data,
jpayne@69 87 krb5_principal server, krb5_ccache *cache_out,
jpayne@69 88 krb5_principal *princ_out);
jpayne@69 89
jpayne@69 90 /* Optional: Release resources used by module data. */
jpayne@69 91 typedef void
jpayne@69 92 (*krb5_ccselect_fini_fn)(krb5_context context, krb5_ccselect_moddata data);
jpayne@69 93
jpayne@69 94 /*** vtable declarations **/
jpayne@69 95
jpayne@69 96 /* Credential cache selection plugin vtable for major version 1. */
jpayne@69 97 typedef struct krb5_ccselect_vtable_st {
jpayne@69 98 const char *name; /* Mandatory: name of module. */
jpayne@69 99 krb5_ccselect_init_fn init;
jpayne@69 100 krb5_ccselect_choose_fn choose;
jpayne@69 101 krb5_ccselect_fini_fn fini;
jpayne@69 102 /* Minor version 1 ends here. */
jpayne@69 103 } *krb5_ccselect_vtable;
jpayne@69 104
jpayne@69 105 #endif /* KRB5_CCSELECT_PLUGIN_H */