1 /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ 2 /* include/CredentialsCache2.h */ 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 <CredentialsCache.h> 36 37 #if defined(macintosh) || (defined(__MACH__) && defined(__APPLE__)) 38 #include <TargetConditionals.h> 39 #include <AvailabilityMacros.h> 40 #ifdef DEPRECATED_IN_MAC_OS_X_VERSION_10_5_AND_LATER 41 #define CCAPI_DEPRECATED DEPRECATED_IN_MAC_OS_X_VERSION_10_5_AND_LATER 42 #endif 43 #endif 44 45 #ifndef CCAPI_DEPRECATED 46 #define CCAPI_DEPRECATED 47 #endif 48 49 #ifdef __cplusplus 50 extern "C" { 51 #endif /* __cplusplus */ 52 53 #if TARGET_OS_MAC 54 #pragma pack(push,2) 55 #endif 56 57 /* Some old types get directly mapped to new types */ 58 59 typedef cc_context_d apiCB; 60 typedef cc_ccache_d ccache_p; 61 typedef cc_credentials_iterator_d ccache_cit_creds; 62 typedef cc_ccache_iterator_d ccache_cit_ccache; 63 typedef cc_data cc_data_compat; 64 typedef cc_int32 cc_cred_vers; 65 typedef cc_int32 cc_result; 66 67 /* This doesn't exist in API v3 */ 68 typedef cc_uint32 cc_flags; 69 70 /* Credentials types are visible to the caller so we have to keep binary compatibility */ 71 72 typedef struct cc_credentials_v5_compat { 73 char* client; 74 char* server; 75 cc_data_compat keyblock; 76 cc_time_t authtime; 77 cc_time_t starttime; 78 cc_time_t endtime; 79 cc_time_t renew_till; 80 cc_uint32 is_skey; 81 cc_uint32 ticket_flags; 82 cc_data_compat** addresses; 83 cc_data_compat ticket; 84 cc_data_compat second_ticket; 85 cc_data_compat** authdata; 86 } cc_credentials_v5_compat; 87 88 enum { 89 KRB_NAME_SZ = 40, 90 KRB_INSTANCE_SZ = 40, 91 KRB_REALM_SZ = 40 92 }; 93 94 typedef union cred_ptr_union_compat { 95 cc_credentials_v5_compat* pV5Cred; 96 } cred_ptr_union_compat; 97 98 typedef struct cred_union { 99 cc_int32 cred_type; /* cc_cred_vers */ 100 cred_ptr_union_compat cred; 101 } cred_union; 102 103 /* NC info structure is gone in v3 */ 104 105 struct infoNC { 106 char* name; 107 char* principal; 108 cc_int32 vers; 109 }; 110 111 typedef struct infoNC infoNC; 112 113 /* Some old type names */ 114 115 typedef cc_credentials_v5_compat cc_creds; 116 struct ccache_cit; 117 typedef struct ccache_cit ccache_cit; 118 119 enum { 120 CC_API_VER_2 = ccapi_version_2 121 }; 122 123 enum { 124 CC_NOERROR, 125 CC_BADNAME, 126 CC_NOTFOUND, 127 CC_END, 128 CC_IO, 129 CC_WRITE, 130 CC_NOMEM, 131 CC_FORMAT, 132 CC_LOCKED, 133 CC_BAD_API_VERSION, 134 CC_NO_EXIST, 135 CC_NOT_SUPP, 136 CC_BAD_PARM, 137 CC_ERR_CACHE_ATTACH, 138 CC_ERR_CACHE_RELEASE, 139 CC_ERR_CACHE_FULL, 140 CC_ERR_CRED_VERSION 141 }; 142 143 enum { 144 CC_CRED_UNKNOWN, 145 /* CC_CRED_V4, */ 146 CC_CRED_V5, 147 CC_CRED_MAX 148 }; 149 150 enum { 151 CC_LOCK_UNLOCK = 1, 152 CC_LOCK_READER = 2, 153 CC_LOCK_WRITER = 3, 154 CC_LOCK_NOBLOCK = 16 155 }; 156 157 CCACHE_API cc_int32 158 cc_shutdown (apiCB **io_context) 159 CCAPI_DEPRECATED; 160 161 CCACHE_API cc_int32 162 cc_get_NC_info (apiCB *in_context, 163 infoNC ***out_info) 164 CCAPI_DEPRECATED; 165 166 CCACHE_API cc_int32 167 cc_get_change_time (apiCB *in_context, 168 cc_time_t *out_change_time) 169 CCAPI_DEPRECATED; 170 171 CCACHE_API cc_int32 172 cc_open (apiCB *in_context, 173 const char *in_name, 174 cc_int32 in_version, 175 cc_uint32 in_flags, 176 ccache_p **out_ccache) 177 CCAPI_DEPRECATED; 178 179 CCACHE_API cc_int32 180 cc_create (apiCB *in_context, 181 const char *in_name, 182 const char *in_principal, 183 cc_int32 in_version, 184 cc_uint32 in_flags, 185 ccache_p **out_ccache) 186 CCAPI_DEPRECATED; 187 188 CCACHE_API cc_int32 189 cc_close (apiCB *in_context, 190 ccache_p **ioCCache) 191 CCAPI_DEPRECATED; 192 193 CCACHE_API cc_int32 194 cc_destroy (apiCB *in_context, 195 ccache_p **io_ccache) 196 CCAPI_DEPRECATED; 197 198 CCACHE_API cc_int32 199 cc_seq_fetch_NCs_begin (apiCB *in_context, 200 ccache_cit **out_nc_iterator) 201 CCAPI_DEPRECATED; 202 203 CCACHE_API cc_int32 204 cc_seq_fetch_NCs_next (apiCB *in_context, 205 ccache_p **out_ccache, 206 ccache_cit *in_nc_iterator) 207 CCAPI_DEPRECATED; 208 209 CCACHE_API cc_int32 210 cc_seq_fetch_NCs_end (apiCB *in_context, 211 ccache_cit **io_nc_iterator) 212 CCAPI_DEPRECATED; 213 214 CCACHE_API cc_int32 215 cc_get_name (apiCB *in_context, 216 ccache_p *in_ccache, 217 char **out_name) 218 CCAPI_DEPRECATED; 219 220 CCACHE_API cc_int32 221 cc_get_cred_version (apiCB *in_context, 222 ccache_p *in_ccache, 223 cc_int32 *out_version) 224 CCAPI_DEPRECATED; 225 226 CCACHE_API cc_int32 227 cc_set_principal (apiCB *in_context, 228 ccache_p *in_ccache, 229 cc_int32 in_version, 230 char *in_principal) 231 CCAPI_DEPRECATED; 232 233 CCACHE_API cc_int32 234 cc_get_principal (apiCB *in_context, 235 ccache_p *in_ccache, 236 char **out_principal) 237 CCAPI_DEPRECATED; 238 239 CCACHE_API cc_int32 240 cc_store (apiCB *in_context, 241 ccache_p *in_ccache, 242 cred_union in_credentials) 243 CCAPI_DEPRECATED; 244 245 CCACHE_API cc_int32 246 cc_remove_cred (apiCB *in_context, 247 ccache_p *in_ccache, 248 cred_union in_credentials) 249 CCAPI_DEPRECATED; 250 251 CCACHE_API cc_int32 252 cc_seq_fetch_creds_begin (apiCB *in_context, 253 const ccache_p *in_ccache, 254 ccache_cit **out_ccache_iterator) 255 CCAPI_DEPRECATED; 256 257 CCACHE_API cc_int32 258 cc_seq_fetch_creds_next (apiCB *in_context, 259 cred_union **out_cred_union, 260 ccache_cit *in_ccache_iterator) 261 CCAPI_DEPRECATED; 262 263 CCACHE_API cc_int32 264 cc_seq_fetch_creds_end (apiCB *in_context, 265 ccache_cit **io_ccache_iterator) 266 CCAPI_DEPRECATED; 267 268 CCACHE_API cc_int32 269 cc_free_principal (apiCB *in_context, 270 char **io_principal) 271 CCAPI_DEPRECATED; 272 273 CCACHE_API cc_int32 274 cc_free_name (apiCB *in_context, 275 char **io_name) 276 CCAPI_DEPRECATED; 277 278 CCACHE_API cc_int32 279 cc_free_creds (apiCB *in_context, 280 cred_union **io_cred_union) 281 CCAPI_DEPRECATED; 282 283 CCACHE_API cc_int32 284 cc_free_NC_info (apiCB *in_context, 285 infoNC ***io_info) 286 CCAPI_DEPRECATED; 287 288 CCACHE_API cc_int32 289 cc_lock_request (apiCB *in_context, 290 const ccache_p *in_ccache, 291 const cc_int32 in_lock_type) 292 CCAPI_DEPRECATED; 293 294 #if TARGET_OS_MAC 295 #pragma pack(pop) 296 #endif 297 298 #ifdef __cplusplus 299 } 300 #endif /* __cplusplus */ 301 302 #endif /* CCAPI_V2_H */ 303