1 /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 /* lib/krb5/ccache/cc-int.h */
4 * Copyright 1990,1991 by the 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.
27 /* This file contains constant and function declarations used in the
28 * file-based credential cache routines. */
30 #ifndef __KRB5_CCACHE_H__
31 #define __KRB5_CCACHE_H__
37 const struct _krb5_cc_ops *ops;
42 k5_cc_retrieve_cred_default(krb5_context, krb5_ccache, krb5_flags,
43 krb5_creds *, krb5_creds *);
46 krb5int_cc_creds_match_request(krb5_context, krb5_flags whichfields, krb5_creds *mcreds, krb5_creds *creds);
49 krb5int_cc_initialize(void);
52 krb5int_cc_finalize(void);
55 * Cursor for iterating over ccache types
57 struct krb5_cc_typecursor;
58 typedef struct krb5_cc_typecursor *krb5_cc_typecursor;
61 krb5int_cc_typecursor_new(krb5_context context, krb5_cc_typecursor *cursor);
64 krb5int_cc_typecursor_next(
66 krb5_cc_typecursor cursor,
67 const struct _krb5_cc_ops **ops);
70 krb5int_cc_typecursor_free(
72 krb5_cc_typecursor *cursor);
74 /* reentrant mutex used by krb5_cc_* functions */
75 typedef struct _k5_cc_mutex {
81 #define K5_CC_MUTEX_PARTIAL_INITIALIZER \
82 { K5_MUTEX_PARTIAL_INITIALIZER, NULL, 0 }
85 k5_cc_mutex_init(k5_cc_mutex *m);
88 k5_cc_mutex_finish_init(k5_cc_mutex *m);
90 #define k5_cc_mutex_destroy(M) \
91 k5_mutex_destroy(&(M)->lock);
94 k5_cc_mutex_assert_locked(krb5_context context, k5_cc_mutex *m);
97 k5_cc_mutex_assert_unlocked(krb5_context context, k5_cc_mutex *m);
100 k5_cc_mutex_lock(krb5_context context, k5_cc_mutex *m);
103 k5_cc_mutex_unlock(krb5_context context, k5_cc_mutex *m);
105 extern k5_cc_mutex krb5int_mcc_mutex;
106 extern k5_cc_mutex krb5int_krcc_mutex;
107 extern k5_cc_mutex krb5int_cc_file_mutex;
110 extern krb5_error_code KRB5_CALLCONV krb5_stdccv3_context_lock
111 (krb5_context context);
113 extern krb5_error_code KRB5_CALLCONV krb5_stdccv3_context_unlock
114 (krb5_context context);
118 k5_cc_mutex_force_unlock(k5_cc_mutex *m);
121 k5_cccol_force_unlock(void);
124 krb5int_fcc_new_unique(krb5_context context, char *template, krb5_ccache *id);
127 ccselect_realm_initvt(krb5_context context, int maj_ver, int min_ver,
128 krb5_plugin_vtable vtable);
131 ccselect_k5identity_initvt(krb5_context context, int maj_ver, int min_ver,
132 krb5_plugin_vtable vtable);
135 k5_unmarshal_cred(const unsigned char *data, size_t len, int version,
139 k5_unmarshal_princ(const unsigned char *data, size_t len, int version,
140 krb5_principal *princ_out);
143 k5_marshal_cred(struct k5buf *buf, int version, krb5_creds *creds);
146 k5_marshal_mcred(struct k5buf *buf, krb5_creds *mcred);
149 k5_marshal_princ(struct k5buf *buf, int version, krb5_principal princ);
152 * Per-type ccache cursor.
154 struct krb5_cc_ptcursor_s {
155 const struct _krb5_cc_ops *ops;
158 typedef struct krb5_cc_ptcursor_s *krb5_cc_ptcursor;
160 struct _krb5_cc_ops {
163 const char * (KRB5_CALLCONV *get_name)(krb5_context, krb5_ccache);
164 krb5_error_code (KRB5_CALLCONV *resolve)(krb5_context, krb5_ccache *,
166 krb5_error_code (KRB5_CALLCONV *gen_new)(krb5_context, krb5_ccache *);
167 krb5_error_code (KRB5_CALLCONV *init)(krb5_context, krb5_ccache,
169 krb5_error_code (KRB5_CALLCONV *destroy)(krb5_context, krb5_ccache);
170 krb5_error_code (KRB5_CALLCONV *close)(krb5_context, krb5_ccache);
171 krb5_error_code (KRB5_CALLCONV *store)(krb5_context, krb5_ccache,
173 krb5_error_code (KRB5_CALLCONV *retrieve)(krb5_context, krb5_ccache,
174 krb5_flags, krb5_creds *,
176 krb5_error_code (KRB5_CALLCONV *get_princ)(krb5_context, krb5_ccache,
178 krb5_error_code (KRB5_CALLCONV *get_first)(krb5_context, krb5_ccache,
180 krb5_error_code (KRB5_CALLCONV *get_next)(krb5_context, krb5_ccache,
181 krb5_cc_cursor *, krb5_creds *);
182 krb5_error_code (KRB5_CALLCONV *end_get)(krb5_context, krb5_ccache,
184 krb5_error_code (KRB5_CALLCONV *remove_cred)(krb5_context, krb5_ccache,
185 krb5_flags, krb5_creds *);
186 krb5_error_code (KRB5_CALLCONV *set_flags)(krb5_context, krb5_ccache,
188 krb5_error_code (KRB5_CALLCONV *get_flags)(krb5_context, krb5_ccache,
190 krb5_error_code (KRB5_CALLCONV *ptcursor_new)(krb5_context,
192 krb5_error_code (KRB5_CALLCONV *ptcursor_next)(krb5_context,
195 krb5_error_code (KRB5_CALLCONV *ptcursor_free)(krb5_context,
197 krb5_error_code (KRB5_CALLCONV *move)(krb5_context, krb5_ccache,
199 krb5_error_code (KRB5_CALLCONV *lastchange)(krb5_context,
200 krb5_ccache, krb5_timestamp *);
201 krb5_error_code (KRB5_CALLCONV *wasdefault)(krb5_context, krb5_ccache,
203 krb5_error_code (KRB5_CALLCONV *lock)(krb5_context, krb5_ccache);
204 krb5_error_code (KRB5_CALLCONV *unlock)(krb5_context, krb5_ccache);
205 krb5_error_code (KRB5_CALLCONV *switch_to)(krb5_context, krb5_ccache);
208 extern const krb5_cc_ops *krb5_cc_dfl_ops;
210 #endif /* __KRB5_CCACHE_H__ */