1 /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
5 * Copyright 2006 Massachusetts Institute of Technology.
8 * Export of this software from the United States of America may
9 * require a specific license from the United States Government.
10 * It is the responsibility of any person or organization contemplating
11 * export to obtain such a license before exporting.
13 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
14 * distribute this software and its documentation for any purpose and
15 * without fee is hereby granted, provided that the above copyright
16 * notice appear in all copies and that both that copyright notice and
17 * this permission notice appear in supporting documentation, and that
18 * the name of M.I.T. not be used in advertising or publicity pertaining
19 * to distribution of the software without specific, written prior
20 * permission. Furthermore if you modify this software you must label
21 * your software as modified software and not distribute it in such a
22 * fashion that it might be confused with the original M.I.T. software.
23 * M.I.T. makes no representations about the suitability of
24 * this software for any purpose. It is provided "as is" without express
25 * or implied warranty.
29 * This is backwards compatibility for CCache API v2 clients to be able to run
30 * against the CCache API v3 library
36 #include <CredentialsCache.h>
38 #if defined(macintosh) || (defined(__MACH__) && defined(__APPLE__))
39 #include <TargetConditionals.h>
40 #include <AvailabilityMacros.h>
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
46 #ifndef CCAPI_DEPRECATED
47 #define CCAPI_DEPRECATED
52 #endif /* __cplusplus */
58 /* Some old types get directly mapped to new types */
60 typedef cc_context_d apiCB;
61 typedef cc_ccache_d ccache_p;
62 typedef cc_credentials_iterator_d ccache_cit_creds;
63 typedef cc_ccache_iterator_d ccache_cit_ccache;
64 typedef cc_data cc_data_compat;
65 typedef cc_int32 cc_cred_vers;
66 typedef cc_int32 cc_result;
68 /* This doesn't exist in API v3 */
69 typedef cc_uint32 cc_flags;
71 /* Credentials types are visible to the caller so we have to keep binary compatibility */
73 typedef struct cc_credentials_v5_compat {
76 cc_data_compat keyblock;
82 cc_uint32 ticket_flags;
83 cc_data_compat** addresses;
84 cc_data_compat ticket;
85 cc_data_compat second_ticket;
86 cc_data_compat** authdata;
87 } cc_credentials_v5_compat;
90 MAX_V4_CRED_LEN = 1250
99 typedef struct cc_credentials_v4_compat {
100 unsigned char kversion;
101 char principal[KRB_NAME_SZ+1];
102 char principal_instance[KRB_INSTANCE_SZ+1];
103 char service[KRB_NAME_SZ+1];
104 char service_instance[KRB_INSTANCE_SZ+1];
105 char realm[KRB_REALM_SZ+1];
106 unsigned char session_key[8];
113 unsigned char ticket[MAX_V4_CRED_LEN];
115 } cc_credentials_v4_compat;
117 typedef union cred_ptr_union_compat {
118 cc_credentials_v4_compat* pV4Cred;
119 cc_credentials_v5_compat* pV5Cred;
120 } cred_ptr_union_compat;
122 typedef struct cred_union {
123 cc_int32 cred_type; /* cc_cred_vers */
124 cred_ptr_union_compat cred;
127 /* NC info structure is gone in v3 */
135 typedef struct infoNC infoNC;
137 /* Some old type names */
139 typedef cc_credentials_v4_compat V4Cred_type;
140 typedef cc_credentials_v5_compat cc_creds;
142 typedef struct ccache_cit ccache_cit;
145 CC_API_VER_2 = ccapi_version_2
163 CC_ERR_CACHE_RELEASE,
183 cc_shutdown (apiCB **io_context)
187 cc_get_NC_info (apiCB *in_context,
192 cc_get_change_time (apiCB *in_context,
193 cc_time_t *out_change_time)
197 cc_open (apiCB *in_context,
201 ccache_p **out_ccache)
205 cc_create (apiCB *in_context,
207 const char *in_principal,
210 ccache_p **out_ccache)
214 cc_close (apiCB *in_context,
219 cc_destroy (apiCB *in_context,
220 ccache_p **io_ccache)
224 cc_seq_fetch_NCs_begin (apiCB *in_context,
225 ccache_cit **out_nc_iterator)
229 cc_seq_fetch_NCs_next (apiCB *in_context,
230 ccache_p **out_ccache,
231 ccache_cit *in_nc_iterator)
235 cc_seq_fetch_NCs_end (apiCB *in_context,
236 ccache_cit **io_nc_iterator)
240 cc_get_name (apiCB *in_context,
246 cc_get_cred_version (apiCB *in_context,
248 cc_int32 *out_version)
252 cc_set_principal (apiCB *in_context,
259 cc_get_principal (apiCB *in_context,
261 char **out_principal)
265 cc_store (apiCB *in_context,
267 cred_union in_credentials)
271 cc_remove_cred (apiCB *in_context,
273 cred_union in_credentials)
277 cc_seq_fetch_creds_begin (apiCB *in_context,
278 const ccache_p *in_ccache,
279 ccache_cit **out_ccache_iterator)
283 cc_seq_fetch_creds_next (apiCB *in_context,
284 cred_union **out_cred_union,
285 ccache_cit *in_ccache_iterator)
289 cc_seq_fetch_creds_end (apiCB *in_context,
290 ccache_cit **io_ccache_iterator)
294 cc_free_principal (apiCB *in_context,
299 cc_free_name (apiCB *in_context,
304 cc_free_creds (apiCB *in_context,
305 cred_union **io_cred_union)
309 cc_free_NC_info (apiCB *in_context,
314 cc_lock_request (apiCB *in_context,
315 const ccache_p *in_ccache,
316 const cc_int32 in_lock_type)
325 #endif /* __cplusplus */
327 #endif /* CCAPI_V2_H */