133965Sjdp/* $NetBSD: krb5_ccapi.h,v 1.3 2023/06/19 21:41:44 christos Exp $ */ 233965Sjdp 333965Sjdp/* 433965Sjdp * Copyright (c) 2004 Kungliga Tekniska H��gskolan 533965Sjdp * (Royal Institute of Technology, Stockholm, Sweden). 633965Sjdp * All rights reserved. 733965Sjdp * 833965Sjdp * Redistribution and use in source and binary forms, with or without 933965Sjdp * modification, are permitted provided that the following conditions 1033965Sjdp * are met: 1133965Sjdp * 1233965Sjdp * 1. Redistributions of source code must retain the above copyright 1333965Sjdp * notice, this list of conditions and the following disclaimer. 1433965Sjdp * 1533965Sjdp * 2. Redistributions in binary form must reproduce the above copyright 1633965Sjdp * notice, this list of conditions and the following disclaimer in the 17218822Sdim * documentation and/or other materials provided with the distribution. 18218822Sdim * 1933965Sjdp * 3. Neither the name of the Institute nor the names of its contributors 20218822Sdim * may be used to endorse or promote products derived from this software 2133965Sjdp * without specific prior written permission. 2277298Sobrien * 2333965Sjdp * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 2433965Sjdp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2533965Sjdp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2633965Sjdp * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 2733965Sjdp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2833965Sjdp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2933965Sjdp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 3033965Sjdp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3133965Sjdp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3233965Sjdp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3333965Sjdp * SUCH DAMAGE. 3433965Sjdp */ 3533965Sjdp 3677298Sobrien/* Id */ 3777298Sobrien 3877298Sobrien#ifndef KRB5_CCAPI_H 3933965Sjdp#define KRB5_CCAPI_H 1 40218822Sdim 41218822Sdim#include <krb5/krb5-types.h> 4233965Sjdp 4333965Sjdp#ifdef __APPLE__ 4477298Sobrien#pragma pack(push,2) 4577298Sobrien#endif 4633965Sjdp 4733965Sjdpenum { 4833965Sjdp cc_credentials_v5 = 2 4933965Sjdp}; 5033965Sjdp 5133965Sjdpenum { 5233965Sjdp ccapi_version_3 = 3, 5333965Sjdp ccapi_version_4 = 4 5433965Sjdp}; 5533965Sjdp 5633965Sjdpenum { 5733965Sjdp ccNoError = 0, 5833965Sjdp 5933965Sjdp ccIteratorEnd = 201, 6033965Sjdp ccErrBadParam, 6133965Sjdp ccErrNoMem, 6233965Sjdp ccErrInvalidContext, 6333965Sjdp ccErrInvalidCCache, 6433965Sjdp 6533965Sjdp ccErrInvalidString, /* 206 */ 6633965Sjdp ccErrInvalidCredentials, 6733965Sjdp ccErrInvalidCCacheIterator, 6833965Sjdp ccErrInvalidCredentialsIterator, 6933965Sjdp ccErrInvalidLock, 7033965Sjdp 7133965Sjdp ccErrBadName, /* 211 */ 7233965Sjdp ccErrBadCredentialsVersion, 7333965Sjdp ccErrBadAPIVersion, 7433965Sjdp ccErrContextLocked, 7533965Sjdp ccErrContextUnlocked, 7633965Sjdp 7733965Sjdp ccErrCCacheLocked, /* 216 */ 7833965Sjdp ccErrCCacheUnlocked, 7933965Sjdp ccErrBadLockType, 8033965Sjdp ccErrNeverDefault, 8133965Sjdp ccErrCredentialsNotFound, 8233965Sjdp 8333965Sjdp ccErrCCacheNotFound, /* 221 */ 8433965Sjdp ccErrContextNotFound, 8533965Sjdp ccErrServerUnavailable, 86218822Sdim ccErrServerInsecure, 8733965Sjdp ccErrServerCantBecomeUID, 8833965Sjdp 8933965Sjdp ccErrTimeOffsetNotSet /* 226 */ 9033965Sjdp}; 9133965Sjdp 9233965Sjdptypedef int32_t cc_int32; 9333965Sjdptypedef uint32_t cc_uint32; 9433965Sjdptypedef struct cc_context_t *cc_context_t; 9533965Sjdptypedef struct cc_ccache_t *cc_ccache_t; 9633965Sjdptypedef struct cc_ccache_iterator_t *cc_ccache_iterator_t; 9733965Sjdptypedef struct cc_credentials_v5_t cc_credentials_v5_t; 9833965Sjdptypedef struct cc_credentials_t *cc_credentials_t; 9933965Sjdptypedef struct cc_credentials_iterator_t *cc_credentials_iterator_t; 10033965Sjdptypedef struct cc_string_t *cc_string_t; 10133965Sjdptypedef cc_uint32 cc_time_t; 10233965Sjdp 10333965Sjdptypedef struct cc_data { 10433965Sjdp cc_uint32 type; 10533965Sjdp cc_uint32 length; 10633965Sjdp void *data; 10733965Sjdp} cc_data; 10833965Sjdp 10933965Sjdpstruct cc_credentials_v5_t { 11033965Sjdp char *client; 11133965Sjdp char *server; 11233965Sjdp cc_data keyblock; 11333965Sjdp cc_time_t authtime; 11433965Sjdp cc_time_t starttime; 115218822Sdim cc_time_t endtime; 11633965Sjdp cc_time_t renew_till; 11733965Sjdp cc_uint32 is_skey; 11833965Sjdp cc_uint32 ticket_flags; 11933965Sjdp#define KRB5_CCAPI_TKT_FLG_FORWARDABLE 0x40000000 12033965Sjdp#define KRB5_CCAPI_TKT_FLG_FORWARDED 0x20000000 12133965Sjdp#define KRB5_CCAPI_TKT_FLG_PROXIABLE 0x10000000 12233965Sjdp#define KRB5_CCAPI_TKT_FLG_PROXY 0x08000000 12333965Sjdp#define KRB5_CCAPI_TKT_FLG_MAY_POSTDATE 0x04000000 12433965Sjdp#define KRB5_CCAPI_TKT_FLG_POSTDATED 0x02000000 12533965Sjdp#define KRB5_CCAPI_TKT_FLG_INVALID 0x01000000 12633965Sjdp#define KRB5_CCAPI_TKT_FLG_RENEWABLE 0x00800000 12733965Sjdp#define KRB5_CCAPI_TKT_FLG_INITIAL 0x00400000 12833965Sjdp#define KRB5_CCAPI_TKT_FLG_PRE_AUTH 0x00200000 12933965Sjdp#define KRB5_CCAPI_TKT_FLG_HW_AUTH 0x00100000 13033965Sjdp#define KRB5_CCAPI_TKT_FLG_TRANSIT_POLICY_CHECKED 0x00080000 13133965Sjdp#define KRB5_CCAPI_TKT_FLG_OK_AS_DELEGATE 0x00040000 13233965Sjdp#define KRB5_CCAPI_TKT_FLG_ANONYMOUS 0x00020000 13333965Sjdp cc_data **addresses; 13433965Sjdp cc_data ticket; 13533965Sjdp cc_data second_ticket; 13633965Sjdp cc_data **authdata; 13733965Sjdp}; 13833965Sjdp 13933965Sjdp 14033965Sjdptypedef struct cc_string_functions { 14133965Sjdp cc_int32 (*release)(cc_string_t); 14233965Sjdp} cc_string_functions; 14333965Sjdp 14433965Sjdpstruct cc_string_t { 14533965Sjdp const char *data; 14633965Sjdp const cc_string_functions *func; 14733965Sjdp}; 14833965Sjdp 14933965Sjdptypedef struct cc_credentials_union { 15033965Sjdp cc_int32 version; 15133965Sjdp union { 15233965Sjdp cc_credentials_v5_t* credentials_v5; 15333965Sjdp } credentials; 15433965Sjdp} cc_credentials_union; 15533965Sjdp 15633965Sjdpstruct cc_credentials_functions { 15733965Sjdp cc_int32 (*release)(cc_credentials_t); 15833965Sjdp cc_int32 (*compare)(cc_credentials_t, cc_credentials_t, cc_uint32*); 15933965Sjdp}; 16033965Sjdp 16133965Sjdpstruct cc_credentials_t { 16233965Sjdp const cc_credentials_union* data; 16333965Sjdp const struct cc_credentials_functions* func; 16433965Sjdp}; 16533965Sjdp 16633965Sjdpstruct cc_credentials_iterator_functions { 16733965Sjdp cc_int32 (*release)(cc_credentials_iterator_t); 16833965Sjdp cc_int32 (*next)(cc_credentials_iterator_t, cc_credentials_t*); 16933965Sjdp}; 170218822Sdim 17133965Sjdpstruct cc_credentials_iterator_t { 17233965Sjdp const struct cc_credentials_iterator_functions *func; 17333965Sjdp}; 17433965Sjdp 17533965Sjdpstruct cc_ccache_iterator_functions { 17633965Sjdp cc_int32 (*release) (cc_ccache_iterator_t); 17733965Sjdp cc_int32 (*next)(cc_ccache_iterator_t, cc_ccache_t*); 17833965Sjdp}; 17933965Sjdp 18033965Sjdpstruct cc_ccache_iterator_t { 18133965Sjdp const struct cc_ccache_iterator_functions* func; 18233965Sjdp}; 18333965Sjdp 18433965Sjdptypedef struct cc_ccache_functions { 18533965Sjdp cc_int32 (*release)(cc_ccache_t); 18633965Sjdp cc_int32 (*destroy)(cc_ccache_t); 18733965Sjdp cc_int32 (*set_default)(cc_ccache_t); 18833965Sjdp cc_int32 (*get_credentials_version)(cc_ccache_t, cc_uint32*); 18933965Sjdp cc_int32 (*get_name)(cc_ccache_t, cc_string_t*); 19033965Sjdp cc_int32 (*get_principal)(cc_ccache_t, cc_uint32, cc_string_t*); 191218822Sdim cc_int32 (*set_principal)(cc_ccache_t, cc_uint32, const char*); 19233965Sjdp cc_int32 (*store_credentials)(cc_ccache_t, const cc_credentials_union*); 19333965Sjdp cc_int32 (*remove_credentials)(cc_ccache_t, cc_credentials_t); 19433965Sjdp cc_int32 (*new_credentials_iterator)(cc_ccache_t, 19533965Sjdp cc_credentials_iterator_t*); 19633965Sjdp cc_int32 (*move)(cc_ccache_t, cc_ccache_t); 19733965Sjdp cc_int32 (*lock)(cc_ccache_t, cc_uint32, cc_uint32); 19833965Sjdp cc_int32 (*unlock)(cc_ccache_t); 19933965Sjdp cc_int32 (*get_last_default_time)(cc_ccache_t, cc_time_t*); 20033965Sjdp cc_int32 (*get_change_time)(cc_ccache_t, cc_time_t*); 20133965Sjdp cc_int32 (*compare)(cc_ccache_t, cc_ccache_t, cc_uint32*); 20233965Sjdp cc_int32 (*get_kdc_time_offset)(cc_ccache_t, cc_int32, cc_time_t *); 20333965Sjdp cc_int32 (*set_kdc_time_offset)(cc_ccache_t, cc_int32, cc_time_t); 20433965Sjdp cc_int32 (*clear_kdc_time_offset)(cc_ccache_t, cc_int32); 20533965Sjdp} cc_ccache_functions; 20633965Sjdp 20733965Sjdpstruct cc_ccache_t { 20833965Sjdp const cc_ccache_functions *func; 20933965Sjdp}; 21033965Sjdp 21133965Sjdpstruct cc_context_functions { 21233965Sjdp cc_int32 (*release)(cc_context_t); 21333965Sjdp cc_int32 (*get_change_time)(cc_context_t, cc_time_t *); 21433965Sjdp cc_int32 (*get_default_ccache_name)(cc_context_t, cc_string_t*); 21533965Sjdp cc_int32 (*open_ccache)(cc_context_t, const char*, cc_ccache_t *); 21633965Sjdp cc_int32 (*open_default_ccache)(cc_context_t, cc_ccache_t*); 21733965Sjdp cc_int32 (*create_ccache)(cc_context_t,const char*, cc_uint32, 21833965Sjdp const char*, cc_ccache_t*); 21933965Sjdp cc_int32 (*create_default_ccache)(cc_context_t, cc_uint32, 22033965Sjdp const char*, cc_ccache_t*); 22133965Sjdp cc_int32 (*create_new_ccache)(cc_context_t, cc_uint32, 22233965Sjdp const char*, cc_ccache_t*); 22333965Sjdp cc_int32 (*new_ccache_iterator)(cc_context_t, cc_ccache_iterator_t*); 22433965Sjdp cc_int32 (*lock)(cc_context_t, cc_uint32, cc_uint32); 22533965Sjdp cc_int32 (*unlock)(cc_context_t); 22633965Sjdp cc_int32 (*compare)(cc_context_t, cc_context_t, cc_uint32*); 22733965Sjdp}; 22833965Sjdp 22933965Sjdpstruct cc_context_t { 23033965Sjdp const struct cc_context_functions* func; 23133965Sjdp}; 23233965Sjdp 23333965Sjdptypedef cc_int32 23433965Sjdp(*cc_initialize_func)(cc_context_t*, cc_int32, cc_int32 *, char const **); 23533965Sjdp 23633965Sjdp#if defined(__APPLE__) 23733965Sjdp#pragma pack(pop) 23833965Sjdp#endif 23933965Sjdp 24033965Sjdp 24133965Sjdp#endif /* KRB5_CCAPI_H */ 24233965Sjdp