Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-21 10:04:38

0001 /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
0002 /*
0003  * Copyright (C) 2013 by the Massachusetts Institute of Technology.
0004  * All rights reserved.
0005  *
0006  * Redistribution and use in source and binary forms, with or without
0007  * modification, are permitted provided that the following conditions
0008  * are met:
0009  *
0010  * * Redistributions of source code must retain the above copyright
0011  *   notice, this list of conditions and the following disclaimer.
0012  *
0013  * * Redistributions in binary form must reproduce the above copyright
0014  *   notice, this list of conditions and the following disclaimer in
0015  *   the documentation and/or other materials provided with the
0016  *   distribution.
0017  *
0018  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0019  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0020  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
0021  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
0022  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
0023  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
0024  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
0025  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
0026  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
0027  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0028  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
0029  * OF THE POSSIBILITY OF SUCH DAMAGE.
0030  */
0031 
0032 /*
0033  * Declarations for hostrealm plugin module implementors.
0034  *
0035  * The hostrealm pluggable interface currently has only one supported major
0036  * version, which is 1.  Major version 1 has a current minor version number of
0037  * 1.
0038  *
0039  * Hostrealm plugin modules should define a function named
0040  * hostrealm_<modulename>_initvt, matching the signature:
0041  *
0042  *   krb5_error_code
0043  *   hostrealm_modname_initvt(krb5_context context, int maj_ver, int min_ver,
0044  *                            krb5_plugin_vtable vtable);
0045  *
0046  * The initvt function should:
0047  *
0048  * - Check that the supplied maj_ver number is supported by the module, or
0049  *   return KRB5_PLUGIN_VER_NOTSUPP if it is not.
0050  *
0051  * - Cast the vtable pointer as appropriate for maj_ver:
0052  *     maj_ver == 1: Cast to krb5_hostrealm_vtable
0053  *
0054  * - Initialize the methods of the vtable, stopping as appropriate for the
0055  *   supplied min_ver.  Optional methods may be left uninitialized.
0056  *
0057  * Memory for the vtable is allocated by the caller, not by the module.
0058  */
0059 
0060 #ifndef KRB5_HOSTREALM_PLUGIN_H
0061 #define KRB5_HOSTREALM_PLUGIN_H
0062 
0063 #include <krb5/krb5.h>
0064 #include <krb5/plugin.h>
0065 
0066 /* An abstract type for hostrealm module data. */
0067 typedef struct krb5_hostrealm_moddata_st *krb5_hostrealm_moddata;
0068 
0069 /*** Method type declarations ***/
0070 
0071 /* Optional: Initialize module data. */
0072 typedef krb5_error_code
0073 (*krb5_hostrealm_init_fn)(krb5_context context,
0074                           krb5_hostrealm_moddata *data);
0075 
0076 /*
0077  * Optional: Determine the possible realms of a hostname, using only secure,
0078  * authoritative mechanisms (ones which should be used prior to trying
0079  * referrals when getting a service ticket).  Return success with a
0080  * null-terminated list of realms in *realms_out, KRB5_PLUGIN_NO_HANDLE to
0081  * defer to later modules, or another error to terminate processing.
0082  */
0083 typedef krb5_error_code
0084 (*krb5_hostrealm_host_realm_fn)(krb5_context context,
0085                                 krb5_hostrealm_moddata data,
0086                                 const char *host, char ***realms_out);
0087 
0088 /*
0089  * Optional: Determine the possible realms of a hostname, using heuristic or
0090  * less secure mechanisms (ones which should be used after trying referrals
0091  * when getting a service ticket).  Return success with a null-terminated list
0092  * of realms in *realms_out, KRB5_PLUGIN_NO_HANDLE to defer to later modules,
0093  * or another error to terminate processing.
0094  */
0095 typedef krb5_error_code
0096 (*krb5_hostrealm_fallback_realm_fn)(krb5_context context,
0097                                     krb5_hostrealm_moddata data,
0098                                     const char *host, char ***realms_out);
0099 
0100 /*
0101  * Optional: Determine the possible default realms of the local host.  Return
0102  * success with a null-terminated list of realms in *realms_out,
0103  * KRB5_PLUGIN_NO_HANDLE to defer to later modules, or another error to
0104  * terminate processing.
0105  */
0106 typedef krb5_error_code
0107 (*krb5_hostrealm_default_realm_fn)(krb5_context context,
0108                                    krb5_hostrealm_moddata data,
0109                                    char ***realms_out);
0110 
0111 /*
0112  * Mandatory (if any of the query methods are implemented): Release the memory
0113  * returned by one of the interface methods.
0114  */
0115 typedef void
0116 (*krb5_hostrealm_free_list_fn)(krb5_context context,
0117                                krb5_hostrealm_moddata data, char **list);
0118 
0119 /* Optional: Release resources used by module data. */
0120 typedef void
0121 (*krb5_hostrealm_fini_fn)(krb5_context context, krb5_hostrealm_moddata data);
0122 
0123 /* hostrealm vtable for major version 1. */
0124 typedef struct krb5_hostrealm_vtable_st {
0125     const char *name;           /* Mandatory: name of module. */
0126     krb5_hostrealm_init_fn init;
0127     krb5_hostrealm_fini_fn fini;
0128     krb5_hostrealm_host_realm_fn host_realm;
0129     krb5_hostrealm_fallback_realm_fn fallback_realm;
0130     krb5_hostrealm_default_realm_fn default_realm;
0131     krb5_hostrealm_free_list_fn free_list;
0132     /* Minor version 1 ends here. */
0133 } *krb5_hostrealm_vtable;
0134 
0135 #endif /* KRB5_HOSTREALM_PLUGIN_H */