1/* 2 * $Header$ 3 * 4 * Copyright 2006 Massachusetts Institute of Technology. 5 * All Rights Reserved. 6 * 7 * Export of this software from the United States of America may 8 * require a specific license from the United States Government. 9 * It is the responsibility of any person or organization contemplating 10 * export to obtain such a license before exporting. 11 * 12 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and 13 * distribute this software and its documentation for any purpose and 14 * without fee is hereby granted, provided that the above copyright 15 * notice appear in all copies and that both that copyright notice and 16 * this permission notice appear in supporting documentation, and that 17 * the name of M.I.T. not be used in advertising or publicity pertaining 18 * to distribution of the software without specific, written prior 19 * permission. Furthermore if you modify this software you must label 20 * your software as modified software and not distribute it in such a 21 * fashion that it might be confused with the original M.I.T. software. 22 * M.I.T. makes no representations about the suitability of 23 * this software for any purpose. It is provided "as is" without express 24 * or implied warranty. 25 */ 26 27/* 28 * This is backwards compatibility for CCache API v2 clients to be able to run 29 * against the CCache API v3 library 30 */ 31 32#ifndef CCAPI_V2_H 33#define CCAPI_V2_H 34 35#include "mit-CredentialsCache.h" 36 37#if defined(macintosh) || (defined(__MACH__) && defined(__APPLE__)) 38#include <TargetConditionals.h> 39#include <AvailabilityMacros.h> 40#ifndef CCAPI_DEPRECATED 41#ifdef DEPRECATED_IN_MAC_OS_X_VERSION_10_5_AND_LATER 42#define CCAPI_DEPRECATED DEPRECATED_IN_MAC_OS_X_VERSION_10_5_AND_LATER 43#endif 44#endif 45#endif 46 47#ifndef CCAPI_DEPRECATED 48#define CCAPI_DEPRECATED 49#endif 50 51#ifdef __cplusplus 52extern "C" { 53#endif /* __cplusplus */ 54 55#if TARGET_OS_MAC 56#pragma pack(push,2) 57#endif 58 59/* Some old types get directly mapped to new types */ 60 61typedef cc_context_d apiCB; 62typedef cc_ccache_d ccache_p; 63typedef cc_credentials_iterator_d ccache_cit_creds; 64typedef cc_ccache_iterator_d ccache_cit_ccache; 65typedef cc_data cc_data_compat; 66typedef cc_int32 cc_cred_vers; 67typedef cc_int32 cc_result; 68 69/* This doesn't exist in API v3 */ 70typedef cc_uint32 cc_flags; 71 72/* Credentials types are visible to the caller so we have to keep binary compatibility */ 73 74typedef struct cc_credentials_v5_compat { 75 char* client; 76 char* server; 77 cc_data_compat keyblock; 78 cc_time_t authtime; 79 cc_time_t starttime; 80 cc_time_t endtime; 81 cc_time_t renew_till; 82 cc_uint32 is_skey; 83 cc_uint32 ticket_flags; 84 cc_data_compat** addresses; 85 cc_data_compat ticket; 86 cc_data_compat second_ticket; 87 cc_data_compat** authdata; 88} cc_credentials_v5_compat; 89 90enum { 91 MAX_V4_CRED_LEN = 1250 92}; 93 94enum { 95 KRB_NAME_SZ = 40, 96 KRB_INSTANCE_SZ = 40, 97 KRB_REALM_SZ = 40 98}; 99 100typedef struct cc_credentials_v4_compat { 101 unsigned char kversion; 102 char principal[KRB_NAME_SZ+1]; 103 char principal_instance[KRB_INSTANCE_SZ+1]; 104 char service[KRB_NAME_SZ+1]; 105 char service_instance[KRB_INSTANCE_SZ+1]; 106 char realm[KRB_REALM_SZ+1]; 107 unsigned char session_key[8]; 108 cc_int32 kvno; 109 cc_int32 str_to_key; 110 long issue_date; 111 cc_int32 lifetime; 112 cc_uint32 address; 113 cc_int32 ticket_sz; 114 unsigned char ticket[MAX_V4_CRED_LEN]; 115 unsigned long oops; 116} cc_credentials_v4_compat; 117 118typedef union cred_ptr_union_compat { 119 cc_credentials_v4_compat* pV4Cred; 120 cc_credentials_v5_compat* pV5Cred; 121} cred_ptr_union_compat; 122 123typedef struct cred_union { 124 cc_int32 cred_type; /* cc_cred_vers */ 125 cred_ptr_union_compat cred; 126} cred_union; 127 128/* NC info structure is gone in v3 */ 129 130struct infoNC { 131 char* name; 132 char* principal; 133 cc_int32 vers; 134}; 135 136typedef struct infoNC infoNC; 137 138/* Some old type names */ 139 140typedef cc_credentials_v4_compat V4Cred_type; 141typedef cc_credentials_v5_compat cc_creds; 142struct ccache_cit; 143typedef struct ccache_cit ccache_cit; 144 145enum { 146 CC_API_VER_2 = ccapi_version_2 147}; 148 149enum { 150 CC_NOERROR, 151 CC_BADNAME, 152 CC_NOTFOUND, 153 CC_END, 154 CC_IO, 155 CC_WRITE, 156 CC_NOMEM, 157 CC_FORMAT, 158 CC_LOCKED, 159 CC_BAD_API_VERSION, 160 CC_NO_EXIST, 161 CC_NOT_SUPP, 162 CC_BAD_PARM, 163 CC_ERR_CACHE_ATTACH, 164 CC_ERR_CACHE_RELEASE, 165 CC_ERR_CACHE_FULL, 166 CC_ERR_CRED_VERSION 167}; 168 169enum { 170 CC_CRED_UNKNOWN, 171 CC_CRED_V4, 172 CC_CRED_V5, 173 CC_CRED_MAX 174}; 175 176enum { 177 CC_LOCK_UNLOCK = 1, 178 CC_LOCK_READER = 2, 179 CC_LOCK_WRITER = 3, 180 CC_LOCK_NOBLOCK = 16 181}; 182 183CCACHE_API cc_int32 184cc_shutdown (apiCB **io_context) 185CCAPI_DEPRECATED; 186 187CCACHE_API cc_int32 188cc_get_NC_info (apiCB *in_context, 189 infoNC ***out_info) 190CCAPI_DEPRECATED; 191 192CCACHE_API cc_int32 193cc_get_change_time (apiCB *in_context, 194 cc_time_t *out_change_time) 195CCAPI_DEPRECATED; 196 197CCACHE_API cc_int32 198cc_open (apiCB *in_context, 199 const char *in_name, 200 cc_int32 in_version, 201 cc_uint32 in_flags, 202 ccache_p **out_ccache) 203CCAPI_DEPRECATED; 204 205CCACHE_API cc_int32 206cc_create (apiCB *in_context, 207 const char *in_name, 208 const char *in_principal, 209 cc_int32 in_version, 210 cc_uint32 in_flags, 211 ccache_p **out_ccache) 212CCAPI_DEPRECATED; 213 214CCACHE_API cc_int32 215cc_close (apiCB *in_context, 216 ccache_p **ioCCache) 217CCAPI_DEPRECATED; 218 219CCACHE_API cc_int32 220cc_destroy (apiCB *in_context, 221 ccache_p **io_ccache) 222CCAPI_DEPRECATED; 223 224CCACHE_API cc_int32 225cc_seq_fetch_NCs_begin (apiCB *in_context, 226 ccache_cit **out_nc_iterator) 227CCAPI_DEPRECATED; 228 229CCACHE_API cc_int32 230cc_seq_fetch_NCs_next (apiCB *in_context, 231 ccache_p **out_ccache, 232 ccache_cit *in_nc_iterator) 233CCAPI_DEPRECATED; 234 235CCACHE_API cc_int32 236cc_seq_fetch_NCs_end (apiCB *in_context, 237 ccache_cit **io_nc_iterator) 238CCAPI_DEPRECATED; 239 240CCACHE_API cc_int32 241cc_get_name (apiCB *in_context, 242 ccache_p *in_ccache, 243 char **out_name) 244CCAPI_DEPRECATED; 245 246CCACHE_API cc_int32 247cc_get_cred_version (apiCB *in_context, 248 ccache_p *in_ccache, 249 cc_int32 *out_version) 250CCAPI_DEPRECATED; 251 252CCACHE_API cc_int32 253cc_set_principal (apiCB *in_context, 254 ccache_p *in_ccache, 255 cc_int32 in_version, 256 char *in_principal) 257CCAPI_DEPRECATED; 258 259CCACHE_API cc_int32 260cc_get_principal (apiCB *in_context, 261 ccache_p *in_ccache, 262 char **out_principal) 263CCAPI_DEPRECATED; 264 265CCACHE_API cc_int32 266cc_store (apiCB *in_context, 267 ccache_p *in_ccache, 268 cred_union in_credentials) 269CCAPI_DEPRECATED; 270 271CCACHE_API cc_int32 272cc_remove_cred (apiCB *in_context, 273 ccache_p *in_ccache, 274 cred_union in_credentials) 275CCAPI_DEPRECATED; 276 277CCACHE_API cc_int32 278cc_seq_fetch_creds_begin (apiCB *in_context, 279 const ccache_p *in_ccache, 280 ccache_cit **out_ccache_iterator) 281CCAPI_DEPRECATED; 282 283CCACHE_API cc_int32 284cc_seq_fetch_creds_next (apiCB *in_context, 285 cred_union **out_cred_union, 286 ccache_cit *in_ccache_iterator) 287CCAPI_DEPRECATED; 288 289CCACHE_API cc_int32 290cc_seq_fetch_creds_end (apiCB *in_context, 291 ccache_cit **io_ccache_iterator) 292CCAPI_DEPRECATED; 293 294CCACHE_API cc_int32 295cc_free_principal (apiCB *in_context, 296 char **io_principal) 297CCAPI_DEPRECATED; 298 299CCACHE_API cc_int32 300cc_free_name (apiCB *in_context, 301 char **io_name) 302CCAPI_DEPRECATED; 303 304CCACHE_API cc_int32 305cc_free_creds (apiCB *in_context, 306 cred_union **io_cred_union) 307CCAPI_DEPRECATED; 308 309CCACHE_API cc_int32 310cc_free_NC_info (apiCB *in_context, 311 infoNC ***io_info) 312CCAPI_DEPRECATED; 313 314CCACHE_API cc_int32 315cc_lock_request (apiCB *in_context, 316 const ccache_p *in_ccache, 317 const cc_int32 in_lock_type) 318CCAPI_DEPRECATED; 319 320#if TARGET_OS_MAC 321#pragma pack(pop) 322#endif 323 324#ifdef __cplusplus 325} 326#endif /* __cplusplus */ 327 328#endif /* CCAPI_V2_H */ 329