]> git.decadent.org.uk Git - nfs-utils.git/blob - support/gssapi/mglueP.h
Merge commit 'debian/1.0.7-2'
[nfs-utils.git] / support / gssapi / mglueP.h
1 /* #ident  "@(#)mglueP.h 1.2     96/01/18 SMI" */
2
3 /*
4  * This header contains the private mechglue definitions.
5  *
6  * Copyright (c) 1995, by Sun Microsystems, Inc.
7  * All rights reserved.
8  */
9
10 #ifndef _GSS_MECHGLUEP_H
11 #define _GSS_MECHGLUEP_H
12
13 #include "mechglue.h"
14
15 /*
16  * Array of context IDs typed by mechanism OID
17  */
18 typedef struct gss_union_ctx_id_t {
19         gss_OID                 mech_type;
20         gss_ctx_id_t            internal_ctx_id;
21 } gss_union_ctx_id_desc, *gss_union_ctx_id_t;
22
23 /*
24  * Structure for holding list of mechanism-specific name types
25  */
26 typedef struct gss_mech_spec_name_t {
27     gss_OID     name_type;
28     gss_OID     mech;
29     struct gss_mech_spec_name_t *next, *prev;
30 } gss_mech_spec_name_desc, *gss_mech_spec_name;
31
32 /*
33  * Credential auxiliary info, used in the credential structure
34  */
35 typedef struct gss_union_cred_auxinfo {
36         gss_buffer_desc         name;
37         gss_OID                 name_type;
38         time_t                  creation_time;
39         OM_uint32               time_rec;
40         int                     cred_usage;
41 } gss_union_cred_auxinfo;
42
43 /*
44  * Set of Credentials typed on mechanism OID
45  */
46 typedef struct gss_union_cred_t {
47         int                     count;
48         gss_OID                 mechs_array;
49         gss_cred_id_t *         cred_array;
50         gss_union_cred_auxinfo  auxinfo;
51 } gss_union_cred_desc, *gss_union_cred_t;
52
53 /********************************************************/
54 /* The Mechanism Dispatch Table -- a mechanism needs to */
55 /* define one of these and provide a function to return */
56 /* it to initialize the GSSAPI library                  */
57
58 /*
59  * This is the definition of the mechs_array struct, which is used to
60  * define the mechs array table. This table is used to indirectly
61  * access mechanism specific versions of the gssapi routines through
62  * the routines in the glue module (gssd_mech_glue.c)
63  *
64  * This contants all of the functions defined in gssapi.h except for
65  * gss_release_buffer() and gss_release_oid_set(), which I am
66  * assuming, for now, to be equal across mechanisms.
67  */
68
69 typedef struct gss_config {
70     gss_OID_desc    mech_type;
71     void *          context;
72     OM_uint32       (*gss_acquire_cred)
73         (
74 #ifdef USE_MECH_CONTEXT
75                     void*,              /* context */
76 #endif
77                     OM_uint32*,         /* minor_status */
78                     gss_name_t,         /* desired_name */
79                     OM_uint32,          /* time_req */
80                     gss_OID_set,        /* desired_mechs */
81                     int,                /* cred_usage */
82                     gss_cred_id_t*,     /* output_cred_handle */
83                     gss_OID_set*,       /* actual_mechs */
84                     OM_uint32*          /* time_rec */
85                     );
86     OM_uint32       (*gss_release_cred)
87         (
88 #ifdef USE_MECH_CONTEXT
89                     void*,              /* context */
90 #endif
91                     OM_uint32*,         /* minor_status */
92                     gss_cred_id_t*      /* cred_handle */
93                     );
94     OM_uint32       (*gss_init_sec_context)
95         (
96 #ifdef USE_MECH_CONTEXT
97                     void*,                      /* context */
98 #endif
99                     OM_uint32*,                 /* minor_status */
100                     gss_cred_id_t,              /* claimant_cred_handle */
101                     gss_ctx_id_t*,              /* context_handle */
102                     gss_name_t,                 /* target_name */
103                     gss_OID,                    /* mech_type */
104                     OM_uint32,                  /* req_flags */
105                     OM_uint32,                  /* time_req */
106                     gss_channel_bindings_t,     /* input_chan_bindings */
107                     gss_buffer_t,               /* input_token */
108                     gss_OID*,                   /* actual_mech_type */
109                     gss_buffer_t,               /* output_token */
110                     OM_uint32*,                 /* ret_flags */
111                     OM_uint32*                  /* time_rec */
112                     );
113     OM_uint32       (*gss_accept_sec_context)
114         (
115 #ifdef USE_MECH_CONTEXT
116                     void*,                      /* context */
117 #endif
118                     OM_uint32*,                 /* minor_status */
119                     gss_ctx_id_t*,              /* context_handle */
120                     gss_cred_id_t,              /* verifier_cred_handle */
121                     gss_buffer_t,               /* input_token_buffer */
122                     gss_channel_bindings_t,     /* input_chan_bindings */
123                     gss_name_t*,                /* src_name */
124                     gss_OID*,                   /* mech_type */
125                     gss_buffer_t,               /* output_token */
126                     OM_uint32*,                 /* ret_flags */
127                     OM_uint32*,                 /* time_rec */
128                     gss_cred_id_t*              /* delegated_cred_handle */
129                     );
130     OM_uint32       (*gss_process_context_token)
131         (
132 #ifdef USE_MECH_CONTEXT
133                     void*,              /* context */
134 #endif
135                     OM_uint32*,         /* minor_status */
136                     gss_ctx_id_t,       /* context_handle */
137                     gss_buffer_t        /* token_buffer */
138                     );
139     OM_uint32       (*gss_delete_sec_context)
140         (
141 #ifdef USE_MECH_CONTEXT
142                     void*,              /* context */
143 #endif
144                     OM_uint32*,         /* minor_status */
145                     gss_ctx_id_t*,      /* context_handle */
146                     gss_buffer_t        /* output_token */
147                     );
148     OM_uint32       (*gss_context_time)
149         (
150 #ifdef USE_MECH_CONTEXT
151                     void*,              /* context */
152 #endif
153                     OM_uint32*,         /* minor_status */
154                     gss_ctx_id_t,       /* context_handle */
155                     OM_uint32*          /* time_rec */
156                     );
157     OM_uint32       (*gss_sign)
158         (
159 #ifdef USE_MECH_CONTEXT
160                     void*,              /* context */
161 #endif
162                     OM_uint32*,         /* minor_status */
163                     gss_ctx_id_t,       /* context_handle */
164                     int,                /* qop_req */
165                     gss_buffer_t,       /* message_buffer */
166                     gss_buffer_t        /* message_token */
167                     );
168     OM_uint32       (*gss_verify)
169         (
170 #ifdef USE_MECH_CONTEXT
171                     void*,              /* context */
172 #endif
173                     OM_uint32*,         /* minor_status */
174                     gss_ctx_id_t,       /* context_handle */
175                     gss_buffer_t,       /* message_buffer */
176                     gss_buffer_t,       /* token_buffer */
177                     int*                /* qop_state */
178                     );
179     OM_uint32       (*gss_seal)
180         (
181 #ifdef USE_MECH_CONTEXT
182                     void*,              /* context */
183 #endif
184                     OM_uint32*,         /* minor_status */
185                     gss_ctx_id_t,       /* context_handle */
186                     int,                /* conf_req_flag */
187                     int,                /* qop_req */
188                     gss_buffer_t,       /* input_message_buffer */
189                     int*,               /* conf_state */
190                     gss_buffer_t        /* output_message_buffer */
191                     );
192     OM_uint32       (*gss_unseal)
193         (
194 #ifdef USE_MECH_CONTEXT
195                     void*,              /* context */
196 #endif
197                     OM_uint32*,         /* minor_status */
198                     gss_ctx_id_t,       /* context_handle */
199                     gss_buffer_t,       /* input_message_buffer */
200                     gss_buffer_t,       /* output_message_buffer */
201                     int*,               /* conf_state */
202                     int*                /* qop_state */
203                     );
204     OM_uint32       (*gss_display_status)
205         (
206 #ifdef USE_MECH_CONTEXT
207                     void*,              /* context */
208 #endif
209                     OM_uint32*,         /* minor_status */
210                     OM_uint32,          /* status_value */
211                     int,                /* status_type */
212                     gss_OID,            /* mech_type */
213                     OM_uint32*,         /* message_context */
214                     gss_buffer_t        /* status_string */
215                     );
216     OM_uint32       (*gss_indicate_mechs)
217         (
218 #ifdef USE_MECH_CONTEXT
219                     void*,              /* context */
220 #endif
221                     OM_uint32*,         /* minor_status */
222                     gss_OID_set*        /* mech_set */
223                     );
224     OM_uint32       (*gss_compare_name)
225         (
226 #ifdef USE_MECH_CONTEXT
227                     void*,              /* context */
228 #endif
229                     OM_uint32*,         /* minor_status */
230                     gss_name_t,         /* name1 */
231                     gss_name_t,         /* name2 */
232                     int*                /* name_equal */
233                     );
234     OM_uint32       (*gss_display_name)
235         (
236 #ifdef USE_MECH_CONTEXT
237                     void*,              /* context */
238 #endif
239                     OM_uint32*,         /* minor_status */
240                     gss_name_t,         /* input_name */
241                     gss_buffer_t,       /* output_name_buffer */
242                     gss_OID*            /* output_name_type */
243                     );
244     OM_uint32       (*gss_import_name)
245         (
246 #ifdef USE_MECH_CONTEXT
247                     void*,              /* context */
248 #endif
249                     OM_uint32*,         /* minor_status */
250                     gss_buffer_t,       /* input_name_buffer */
251                     gss_OID,            /* input_name_type */
252                     gss_name_t*         /* output_name */
253                     );
254     OM_uint32       (*gss_release_name)
255         (
256 #ifdef USE_MECH_CONTEXT
257                     void*,              /* context */
258 #endif
259                     OM_uint32*,         /* minor_status */
260                     gss_name_t*         /* input_name */
261                     );
262     OM_uint32       (*gss_inquire_cred)
263         (
264 #ifdef USE_MECH_CONTEXT
265                     void*,                      /* context */
266 #endif
267                     OM_uint32 *,                /* minor_status */
268                     gss_cred_id_t,              /* cred_handle */
269                     gss_name_t *,               /* name */
270                     OM_uint32 *,                /* lifetime */
271                     int *,                      /* cred_usage */
272                     gss_OID_set *               /* mechanisms */
273                     );
274     OM_uint32       (*gss_add_cred)
275         (
276 #ifdef USE_MECH_CONTEXT
277                     void*,              /* context */
278 #endif
279                     OM_uint32 *,        /* minor_status */
280                     gss_cred_id_t,      /* input_cred_handle */
281                     gss_name_t,         /* desired_name */
282                     gss_OID,            /* desired_mech */
283                     gss_cred_usage_t,   /* cred_usage */
284                     OM_uint32,          /* initiator_time_req */
285                     OM_uint32,          /* acceptor_time_req */
286                     gss_cred_id_t *,    /* output_cred_handle */
287                     gss_OID_set *,      /* actual_mechs */
288                     OM_uint32 *,        /* initiator_time_rec */
289                     OM_uint32 *         /* acceptor_time_rec */
290                     );
291     OM_uint32       (*gss_export_sec_context)
292         (
293 #ifdef USE_MECH_CONTEXT
294                     void*,              /* context */
295 #endif
296                     OM_uint32 *,        /* minor_status */
297                     gss_ctx_id_t *,     /* context_handle */
298                     gss_buffer_t        /* interprocess_token */
299                     );
300     OM_uint32       (*gss_import_sec_context)
301         (
302 #ifdef USE_MECH_CONTEXT
303                     void *,             /* context */
304 #endif
305                     OM_uint32 *,        /* minor_status */
306                     gss_buffer_t,       /* interprocess_token */
307                     gss_ctx_id_t *      /* context_handle */
308                     );
309     OM_uint32       (*gss_inquire_cred_by_mech)
310         (
311 #ifdef USE_MECH_CONTEXT
312                     void *,             /* context */
313 #endif
314                     OM_uint32 *,        /* minor_status */
315                     gss_cred_id_t,      /* cred_handle */
316                     gss_OID,            /* mech_type */
317                     gss_name_t *,       /* name */
318                     OM_uint32 *,        /* initiator_lifetime */
319                     OM_uint32 *,        /* acceptor_lifetime */
320                     gss_cred_usage_t *  /* cred_usage */
321                     );
322     OM_uint32       (*gss_inquire_names_for_mech)
323         (
324 #ifdef USE_MECH_CONTEXT
325                     void *,             /* context */
326 #endif
327                     OM_uint32 *,        /* minor_status */
328                     gss_OID,            /* mechanism */
329                     gss_OID_set *       /* name_types */
330                     );
331     OM_uint32   (*gss_inquire_context)
332         (
333 #ifdef USE_MECH_CONTEXT
334                     void *,             /* context */
335 #endif
336                     OM_uint32 *,        /* minor_status */
337                     gss_ctx_id_t,       /* context_handle */
338                     gss_name_t *,       /* src_name */
339                     gss_name_t *,       /* targ_name */
340                     OM_uint32 *,        /* lifetime_rec */
341                     gss_OID *,          /* mech_type */
342                     OM_uint32 *,        /* ctx_flags */
343                     int *,              /* locally_initiated */
344                     int *               /* open */
345                     );
346     OM_uint32       (*gss_internal_release_oid)
347         (
348 #ifdef USE_MECH_CONTEXT
349                     void *,             /* context */
350 #endif
351                     OM_uint32 *,        /* minor_status */
352                     gss_OID *           /* OID */
353          );
354     OM_uint32        (*gss_wrap_size_limit)
355         (
356 #ifdef USE_MECH_CONTEXT
357                     void *,             /* context */
358 #endif
359                     OM_uint32 *,        /* minor_status */
360                     gss_ctx_id_t,       /* context_handle */
361                     int,                /* conf_req_flag */
362                     gss_qop_t,          /* qop_req */
363                     OM_uint32,          /* req_output_size */
364                     OM_uint32 *         /* max_input_size */
365          );
366     OM_uint32        (*pname_to_uid)
367         (
368 #ifdef USE_MECH_CONTEXT
369                     void *,             /* context */
370 #endif
371                     char *,             /* pname */
372                     gss_OID,            /* name type */
373                     gss_OID,            /* mech type */
374                     uid_t *             /* uid */
375                     );
376     OM_uint32        (*gss_duplicate_name)
377         (
378 #ifdef USE_MECH_CONTEXT
379                     void *,             /* context */
380 #endif
381                     OM_uint32  *,       /* minor_status */
382                     const gss_name_t,   /* input_name */
383                     gss_name_t *        /* dest_name */
384         );
385     OM_uint32        (*gss_set_allowable_enctypes)
386         (
387 #ifdef USE_MECH_CONTEXT
388                     void *,             /* context */
389 #endif
390                     OM_uint32  *,       /* minor_status */
391                     gss_cred_id_t,      /* cred_handle */
392                     OM_uint32,          /* num_ktypes */
393                     void *              /* ktypes */
394         );
395     OM_uint32       (*gss_verify_mic)
396         (
397 #ifdef USE_MECH_CONTEXT
398                     void*,              /* context */
399 #endif
400                     OM_uint32*,         /* minor_status */
401                     gss_ctx_id_t,       /* context_handle */
402                     gss_buffer_t,       /* message_buffer */
403                     gss_buffer_t,       /* token_buffer */
404                     int*                /* qop_state */
405                     );
406
407 } *gss_mechanism;
408
409 /*
410  * Generic GSSAPI names.  A name can either be a generic name, or a
411  * mechanism specific name....
412  */
413 typedef struct gss_union_name_t {
414         gss_mechanism           gss_mech;
415         gss_OID                 name_type;
416         gss_buffer_t            external_name;
417         /*
418          * These last two fields are only filled in for mechanism
419          * names.
420          */
421         gss_OID                 mech_type;
422         gss_name_t              mech_name;
423 } gss_union_name_desc, *gss_union_name_t;
424
425 /********************************************************/
426 /* Internal mechglue routines */
427
428 gss_mechanism __gss_get_mechanism (gss_OID);
429 OM_uint32 __gss_get_mech_type (gss_OID, gss_buffer_t);
430 OM_uint32 __gss_import_internal_name (OM_uint32 *, gss_OID, gss_union_name_t,
431                                       gss_name_t *);
432 OM_uint32 __gss_display_internal_name (OM_uint32 *, gss_OID, gss_name_t,
433                                        gss_buffer_t, gss_OID *);
434 OM_uint32 __gss_release_internal_name (OM_uint32 *, gss_OID, gss_name_t *);
435
436 OM_uint32 __gss_convert_name_to_union_name
437           (OM_uint32 *,         /* minor_status */
438            gss_mechanism,       /* mech */
439            gss_name_t,          /* internal_name */
440            gss_name_t *         /* external_name */
441            );
442 gss_cred_id_t __gss_get_mechanism_cred
443           (gss_union_cred_t,    /* union_cred */
444            gss_OID              /* mech_type */
445            );
446
447 OM_uint32 generic_gss_release_oid
448            (OM_uint32 *,        /* minor_status */
449             gss_OID *           /* oid */
450            );
451
452 OM_uint32 mech_gss_release_oid
453            (OM_uint32 *,        /* minor_status */
454             gss_OID *,          /* oid */
455             gss_mechanism       /* gss_mech */
456            );
457
458 OM_uint32 generic_gss_copy_oid
459            (OM_uint32 *,        /* minor_status */
460             gss_OID,            /* oid */
461             gss_OID *           /* new_oid */
462             );
463
464 OM_uint32 generic_gss_create_empty_oid_set
465            (OM_uint32 *,        /* minor_status */
466             gss_OID_set *       /* oid_set */
467            );
468
469 OM_uint32 generic_gss_add_oid_set_member
470            (OM_uint32 *,        /* minor_status */
471             gss_OID,            /* member_oid */
472             gss_OID_set *       /* oid_set */
473            );
474
475 OM_uint32 generic_gss_test_oid_set_member
476            (OM_uint32 *,        /* minor_status */
477             gss_OID,            /* member */
478             gss_OID_set,        /* set */
479             int *               /* present */
480            );
481
482 OM_uint32 generic_gss_oid_to_str
483  (OM_uint32 *,  /* minor_status */
484             gss_OID,            /* oid */
485             gss_buffer_t        /* oid_str */
486            );
487
488 OM_uint32 generic_gss_str_to_oid
489            (OM_uint32 *,        /* minor_status */
490             gss_buffer_t,       /* oid_str */
491             gss_OID *           /* oid */
492            );
493
494
495 gss_OID gss_find_mechanism_from_name_type (gss_OID); /* name_type */
496
497 OM_uint32 gss_add_mech_name_type
498            (OM_uint32 *,        /* minor_status */
499             gss_OID,            /* name_type */
500             gss_OID             /* mech */
501                );
502
503 #endif /* _GSS_MECHGLUEP_H */