jpayne@69: /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ jpayne@69: /* jpayne@69: * Copyright (C) 2011 by the Massachusetts Institute of Technology. jpayne@69: * All rights reserved. jpayne@69: * jpayne@69: * Export of this software from the United States of America may jpayne@69: * require a specific license from the United States Government. jpayne@69: * It is the responsibility of any person or organization contemplating jpayne@69: * export to obtain such a license before exporting. jpayne@69: * jpayne@69: * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and jpayne@69: * distribute this software and its documentation for any purpose and jpayne@69: * without fee is hereby granted, provided that the above copyright jpayne@69: * notice appear in all copies and that both that copyright notice and jpayne@69: * this permission notice appear in supporting documentation, and that jpayne@69: * the name of M.I.T. not be used in advertising or publicity pertaining jpayne@69: * to distribution of the software without specific, written prior jpayne@69: * permission. Furthermore if you modify this software you must label jpayne@69: * your software as modified software and not distribute it in such a jpayne@69: * fashion that it might be confused with the original M.I.T. software. jpayne@69: * M.I.T. makes no representations about the suitability of jpayne@69: * this software for any purpose. It is provided "as is" without express jpayne@69: * or implied warranty. jpayne@69: */ jpayne@69: jpayne@69: /* jpayne@69: * Declarations for credential cache selection module implementors. jpayne@69: * jpayne@69: * The ccselect pluggable interface currently has only one supported major jpayne@69: * version, which is 1. Major version 1 has a current minor version number of jpayne@69: * 1. jpayne@69: * jpayne@69: * Credential cache selection modules should define a function named jpayne@69: * ccselect__initvt, matching the signature: jpayne@69: * jpayne@69: * krb5_error_code jpayne@69: * ccselect_modname_initvt(krb5_context context, int maj_ver, int min_ver, jpayne@69: * krb5_plugin_vtable vtable); jpayne@69: * jpayne@69: * The initvt function should: jpayne@69: * jpayne@69: * - Check that the supplied maj_ver number is supported by the module, or jpayne@69: * return KRB5_PLUGIN_VER_NOTSUPP if it is not. jpayne@69: * jpayne@69: * - Cast the vtable pointer as appropriate for maj_ver: jpayne@69: * maj_ver == 1: Cast to krb5_ccselect_vtable jpayne@69: * jpayne@69: * - Initialize the methods of the vtable, stopping as appropriate for the jpayne@69: * supplied min_ver. Optional methods may be left uninitialized. jpayne@69: * jpayne@69: * Memory for the vtable is allocated by the caller, not by the module. jpayne@69: */ jpayne@69: jpayne@69: #ifndef KRB5_CCSELECT_PLUGIN_H jpayne@69: #define KRB5_CCSELECT_PLUGIN_H jpayne@69: jpayne@69: #include jpayne@69: #include jpayne@69: jpayne@69: /* An abstract type for credential cache selection module data. */ jpayne@69: typedef struct krb5_ccselect_moddata_st *krb5_ccselect_moddata; jpayne@69: jpayne@69: #define KRB5_CCSELECT_PRIORITY_AUTHORITATIVE 2 jpayne@69: #define KRB5_CCSELECT_PRIORITY_HEURISTIC 1 jpayne@69: jpayne@69: /*** Method type declarations ***/ jpayne@69: jpayne@69: /* jpayne@69: * Mandatory: Initialize module data and set *priority_out to one of the jpayne@69: * KRB5_CCSELECT_PRIORITY constants above. Authoritative modules will be jpayne@69: * consulted before heuristic ones. jpayne@69: */ jpayne@69: typedef krb5_error_code jpayne@69: (*krb5_ccselect_init_fn)(krb5_context context, krb5_ccselect_moddata *data_out, jpayne@69: int *priority_out); jpayne@69: jpayne@69: /* jpayne@69: * Mandatory: Select a cache based on a server principal. Return 0 on success, jpayne@69: * with *cache_out set to the selected cache and *princ_out set to its default jpayne@69: * principal. Return KRB5_PLUGIN_NO_HANDLE to defer to other modules. Return jpayne@69: * KRB5_CC_NOTFOUND with *princ_out set if the client principal can be jpayne@69: * authoritatively determined but no cache exists for it. Return other errors jpayne@69: * as appropriate. jpayne@69: */ jpayne@69: typedef krb5_error_code jpayne@69: (*krb5_ccselect_choose_fn)(krb5_context context, krb5_ccselect_moddata data, jpayne@69: krb5_principal server, krb5_ccache *cache_out, jpayne@69: krb5_principal *princ_out); jpayne@69: jpayne@69: /* Optional: Release resources used by module data. */ jpayne@69: typedef void jpayne@69: (*krb5_ccselect_fini_fn)(krb5_context context, krb5_ccselect_moddata data); jpayne@69: jpayne@69: /*** vtable declarations **/ jpayne@69: jpayne@69: /* Credential cache selection plugin vtable for major version 1. */ jpayne@69: typedef struct krb5_ccselect_vtable_st { jpayne@69: const char *name; /* Mandatory: name of module. */ jpayne@69: krb5_ccselect_init_fn init; jpayne@69: krb5_ccselect_choose_fn choose; jpayne@69: krb5_ccselect_fini_fn fini; jpayne@69: /* Minor version 1 ends here. */ jpayne@69: } *krb5_ccselect_vtable; jpayne@69: jpayne@69: #endif /* KRB5_CCSELECT_PLUGIN_H */