annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/krb5/kdcpolicy_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 /* include/krb5/kdcpolicy_plugin.h - KDC policy plugin interface */
jpayne@69 3 /*
jpayne@69 4 * Copyright (C) 2017 by Red Hat, Inc.
jpayne@69 5 * All rights reserved.
jpayne@69 6 *
jpayne@69 7 * Redistribution and use in source and binary forms, with or without
jpayne@69 8 * modification, are permitted provided that the following conditions
jpayne@69 9 * are met:
jpayne@69 10 *
jpayne@69 11 * * Redistributions of source code must retain the above copyright
jpayne@69 12 * notice, this list of conditions and the following disclaimer.
jpayne@69 13 *
jpayne@69 14 * * Redistributions in binary form must reproduce the above copyright
jpayne@69 15 * notice, this list of conditions and the following disclaimer in
jpayne@69 16 * the documentation and/or other materials provided with the
jpayne@69 17 * distribution.
jpayne@69 18 *
jpayne@69 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
jpayne@69 20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
jpayne@69 21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
jpayne@69 22 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
jpayne@69 23 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
jpayne@69 24 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
jpayne@69 25 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
jpayne@69 26 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
jpayne@69 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
jpayne@69 28 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
jpayne@69 29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
jpayne@69 30 * OF THE POSSIBILITY OF SUCH DAMAGE.
jpayne@69 31 */
jpayne@69 32
jpayne@69 33 /*
jpayne@69 34 * Declarations for kdcpolicy plugin module implementors.
jpayne@69 35 *
jpayne@69 36 * The kdcpolicy pluggable interface currently has only one supported major
jpayne@69 37 * version, which is 1. Major version 1 has a current minor version number of
jpayne@69 38 * 1.
jpayne@69 39 *
jpayne@69 40 * kdcpolicy plugin modules should define a function named
jpayne@69 41 * kdcpolicy_<modulename>_initvt, matching the signature:
jpayne@69 42 *
jpayne@69 43 * krb5_error_code
jpayne@69 44 * kdcpolicy_modname_initvt(krb5_context context, int maj_ver, int min_ver,
jpayne@69 45 * krb5_plugin_vtable vtable);
jpayne@69 46 *
jpayne@69 47 * The initvt function should:
jpayne@69 48 *
jpayne@69 49 * - Check that the supplied maj_ver number is supported by the module, or
jpayne@69 50 * return KRB5_PLUGIN_VER_NOTSUPP if it is not.
jpayne@69 51 *
jpayne@69 52 * - Cast the vtable pointer as appropriate for maj_ver:
jpayne@69 53 * maj_ver == 1: Cast to krb5_kdcpolicy_vtable
jpayne@69 54 *
jpayne@69 55 * - Initialize the methods of the vtable, stopping as appropriate for the
jpayne@69 56 * supplied min_ver. Optional methods may be left uninitialized.
jpayne@69 57 *
jpayne@69 58 * Memory for the vtable is allocated by the caller, not by the module.
jpayne@69 59 */
jpayne@69 60
jpayne@69 61 #ifndef KRB5_POLICY_PLUGIN_H
jpayne@69 62 #define KRB5_POLICY_PLUGIN_H
jpayne@69 63
jpayne@69 64 #include <krb5/krb5.h>
jpayne@69 65
jpayne@69 66 /* Abstract module datatype. */
jpayne@69 67 typedef struct krb5_kdcpolicy_moddata_st *krb5_kdcpolicy_moddata;
jpayne@69 68
jpayne@69 69 /* A module can optionally include kdb.h to inspect principal entries when
jpayne@69 70 * authorizing requests. */
jpayne@69 71 struct _krb5_db_entry_new;
jpayne@69 72
jpayne@69 73 /*
jpayne@69 74 * Optional: Initialize module data. Return 0 on success,
jpayne@69 75 * KRB5_PLUGIN_NO_HANDLE if the module is inoperable (due to configuration, for
jpayne@69 76 * example), and any other error code to abort KDC startup. Optionally set
jpayne@69 77 * *data_out to a module data object to be passed to future calls.
jpayne@69 78 */
jpayne@69 79 typedef krb5_error_code
jpayne@69 80 (*krb5_kdcpolicy_init_fn)(krb5_context context,
jpayne@69 81 krb5_kdcpolicy_moddata *data_out);
jpayne@69 82
jpayne@69 83 /* Optional: Clean up module data. */
jpayne@69 84 typedef krb5_error_code
jpayne@69 85 (*krb5_kdcpolicy_fini_fn)(krb5_context context,
jpayne@69 86 krb5_kdcpolicy_moddata moddata);
jpayne@69 87
jpayne@69 88 /*
jpayne@69 89 * Optional: return an error code and set status to an appropriate string
jpayne@69 90 * literal to deny an AS request; otherwise return 0. lifetime_out, if set,
jpayne@69 91 * restricts the ticket lifetime. renew_lifetime_out, if set, restricts the
jpayne@69 92 * ticket renewable lifetime.
jpayne@69 93 */
jpayne@69 94 typedef krb5_error_code
jpayne@69 95 (*krb5_kdcpolicy_check_as_fn)(krb5_context context,
jpayne@69 96 krb5_kdcpolicy_moddata moddata,
jpayne@69 97 const krb5_kdc_req *request,
jpayne@69 98 const struct _krb5_db_entry_new *client,
jpayne@69 99 const struct _krb5_db_entry_new *server,
jpayne@69 100 const char *const *auth_indicators,
jpayne@69 101 const char **status, krb5_deltat *lifetime_out,
jpayne@69 102 krb5_deltat *renew_lifetime_out);
jpayne@69 103
jpayne@69 104 /*
jpayne@69 105 * Optional: return an error code and set status to an appropriate string
jpayne@69 106 * literal to deny a TGS request; otherwise return 0. lifetime_out, if set,
jpayne@69 107 * restricts the ticket lifetime. renew_lifetime_out, if set, restricts the
jpayne@69 108 * ticket renewable lifetime.
jpayne@69 109 */
jpayne@69 110 typedef krb5_error_code
jpayne@69 111 (*krb5_kdcpolicy_check_tgs_fn)(krb5_context context,
jpayne@69 112 krb5_kdcpolicy_moddata moddata,
jpayne@69 113 const krb5_kdc_req *request,
jpayne@69 114 const struct _krb5_db_entry_new *server,
jpayne@69 115 const krb5_ticket *ticket,
jpayne@69 116 const char *const *auth_indicators,
jpayne@69 117 const char **status, krb5_deltat *lifetime_out,
jpayne@69 118 krb5_deltat *renew_lifetime_out);
jpayne@69 119
jpayne@69 120 typedef struct krb5_kdcpolicy_vtable_st {
jpayne@69 121 const char *name;
jpayne@69 122 krb5_kdcpolicy_init_fn init;
jpayne@69 123 krb5_kdcpolicy_fini_fn fini;
jpayne@69 124 krb5_kdcpolicy_check_as_fn check_as;
jpayne@69 125 krb5_kdcpolicy_check_tgs_fn check_tgs;
jpayne@69 126 } *krb5_kdcpolicy_vtable;
jpayne@69 127
jpayne@69 128 #endif /* KRB5_POLICY_PLUGIN_H */