1 /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 /* include/CredentialsCache2.h */
4 * Copyright 2006 Massachusetts Institute of Technology.
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.
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.
28 * This is backwards compatibility for CCache API v2 clients to be able to run
29 * against the CCache API v3 library
35 #include <CredentialsCache.h>
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
45 #ifndef CCAPI_DEPRECATED
46 #define CCAPI_DEPRECATED
51 #endif /* __cplusplus */
57 /* Some old types get directly mapped to new types */
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;
67 /* This doesn't exist in API v3 */
68 typedef cc_uint32 cc_flags;
70 /* Credentials types are visible to the caller so we have to keep binary compatibility */
72 typedef struct cc_credentials_v5_compat {
75 cc_data_compat keyblock;
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;
89 MAX_V4_CRED_LEN = 1250
98 typedef struct cc_credentials_v4_compat {
99 unsigned char kversion;
100 char principal[KRB_NAME_SZ+1];
101 char principal_instance[KRB_INSTANCE_SZ+1];
102 char service[KRB_NAME_SZ+1];
103 char service_instance[KRB_INSTANCE_SZ+1];
104 char realm[KRB_REALM_SZ+1];
105 unsigned char session_key[8];
112 unsigned char ticket[MAX_V4_CRED_LEN];
114 } cc_credentials_v4_compat;
116 typedef union cred_ptr_union_compat {
117 cc_credentials_v4_compat* pV4Cred;
118 cc_credentials_v5_compat* pV5Cred;
119 } cred_ptr_union_compat;
121 typedef struct cred_union {
122 cc_int32 cred_type; /* cc_cred_vers */
123 cred_ptr_union_compat cred;
126 /* NC info structure is gone in v3 */
134 typedef struct infoNC infoNC;
136 /* Some old type names */
138 typedef cc_credentials_v4_compat V4Cred_type;
139 typedef cc_credentials_v5_compat cc_creds;
141 typedef struct ccache_cit ccache_cit;
144 CC_API_VER_2 = ccapi_version_2
162 CC_ERR_CACHE_RELEASE,
182 cc_shutdown (apiCB **io_context)
186 cc_get_NC_info (apiCB *in_context,
191 cc_get_change_time (apiCB *in_context,
192 cc_time_t *out_change_time)
196 cc_open (apiCB *in_context,
200 ccache_p **out_ccache)
204 cc_create (apiCB *in_context,
206 const char *in_principal,
209 ccache_p **out_ccache)
213 cc_close (apiCB *in_context,
218 cc_destroy (apiCB *in_context,
219 ccache_p **io_ccache)
223 cc_seq_fetch_NCs_begin (apiCB *in_context,
224 ccache_cit **out_nc_iterator)
228 cc_seq_fetch_NCs_next (apiCB *in_context,
229 ccache_p **out_ccache,
230 ccache_cit *in_nc_iterator)
234 cc_seq_fetch_NCs_end (apiCB *in_context,
235 ccache_cit **io_nc_iterator)
239 cc_get_name (apiCB *in_context,
245 cc_get_cred_version (apiCB *in_context,
247 cc_int32 *out_version)
251 cc_set_principal (apiCB *in_context,
258 cc_get_principal (apiCB *in_context,
260 char **out_principal)
264 cc_store (apiCB *in_context,
266 cred_union in_credentials)
270 cc_remove_cred (apiCB *in_context,
272 cred_union in_credentials)
276 cc_seq_fetch_creds_begin (apiCB *in_context,
277 const ccache_p *in_ccache,
278 ccache_cit **out_ccache_iterator)
282 cc_seq_fetch_creds_next (apiCB *in_context,
283 cred_union **out_cred_union,
284 ccache_cit *in_ccache_iterator)
288 cc_seq_fetch_creds_end (apiCB *in_context,
289 ccache_cit **io_ccache_iterator)
293 cc_free_principal (apiCB *in_context,
298 cc_free_name (apiCB *in_context,
303 cc_free_creds (apiCB *in_context,
304 cred_union **io_cred_union)
308 cc_free_NC_info (apiCB *in_context,
313 cc_lock_request (apiCB *in_context,
314 const ccache_p *in_ccache,
315 const cc_int32 in_lock_type)
324 #endif /* __cplusplus */
326 #endif /* CCAPI_V2_H */