~ubuntu-branches/ubuntu/maverick/krb5/maverick

« back to all changes in this revision

Viewing changes to src/lib/gssapi/krb5/krb5_gss_glue.c

  • Committer: Bazaar Package Importer
  • Author(s): Sam Hartman, Russ Allbery, Sam Hartman
  • Date: 2008-08-21 10:41:41 UTC
  • mfrom: (11.1.15 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080821104141-a0f9c4o4cpo8xd0o
Tags: 1.6.dfsg.4~beta1-4
[ Russ Allbery ]
* Translation updates:
  - Swedish, thanks Martin Bagge.  (Closes: #487669, #491774)
  - Italian, thanks Luca Monducci.  (Closes: #493962)

[ Sam Hartman ]
* Translation Updates:
    - Dutch, Thanks Vincent Zweije, Closes: #495733

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 */
22
22
 
23
23
/*
24
 
 * $Id: krb5_gss_glue.c 16268 2004-04-24 21:09:44Z raeburn $
 
24
 * $Id: krb5_gss_glue.c 18262 2006-06-29 04:38:48Z tlyu $
25
25
 */
26
26
 
27
27
#include "gssapiP_krb5.h"
28
 
 
29
 
OM_uint32 KRB5_CALLCONV
30
 
gss_accept_sec_context(minor_status, context_handle, verifier_cred_handle,
 
28
#include "mglueP.h"
 
29
 
 
30
/** mechglue wrappers **/
 
31
 
 
32
static OM_uint32 k5glue_acquire_cred
 
33
(void *, OM_uint32*,       /* minor_status */
 
34
            gss_name_t,       /* desired_name */
 
35
            OM_uint32,        /* time_req */
 
36
            gss_OID_set,      /* desired_mechs */
 
37
            gss_cred_usage_t, /* cred_usage */
 
38
            gss_cred_id_t*,   /* output_cred_handle */
 
39
            gss_OID_set*,     /* actual_mechs */
 
40
            OM_uint32*        /* time_rec */
 
41
           );
 
42
 
 
43
static OM_uint32 k5glue_release_cred
 
44
(void *, OM_uint32*,       /* minor_status */
 
45
            gss_cred_id_t*    /* cred_handle */
 
46
           );
 
47
 
 
48
static OM_uint32 k5glue_init_sec_context
 
49
(void *, OM_uint32*,       /* minor_status */
 
50
            gss_cred_id_t,    /* claimant_cred_handle */
 
51
            gss_ctx_id_t*,    /* context_handle */
 
52
            gss_name_t,       /* target_name */
 
53
            gss_OID,          /* mech_type */
 
54
            OM_uint32,        /* req_flags */
 
55
            OM_uint32,        /* time_req */
 
56
            gss_channel_bindings_t,
 
57
                              /* input_chan_bindings */
 
58
            gss_buffer_t,     /* input_token */
 
59
            gss_OID*,         /* actual_mech_type */
 
60
            gss_buffer_t,     /* output_token */
 
61
            OM_uint32*,       /* ret_flags */
 
62
            OM_uint32*        /* time_rec */
 
63
           );
 
64
 
 
65
static OM_uint32 k5glue_accept_sec_context
 
66
(void *, OM_uint32*,       /* minor_status */
 
67
            gss_ctx_id_t*,    /* context_handle */
 
68
            gss_cred_id_t,    /* verifier_cred_handle */
 
69
            gss_buffer_t,     /* input_token_buffer */
 
70
            gss_channel_bindings_t,
 
71
                              /* input_chan_bindings */
 
72
            gss_name_t*,      /* src_name */
 
73
            gss_OID*,         /* mech_type */
 
74
            gss_buffer_t,     /* output_token */
 
75
            OM_uint32*,       /* ret_flags */
 
76
            OM_uint32*,       /* time_rec */
 
77
            gss_cred_id_t*    /* delegated_cred_handle */
 
78
           );
 
79
 
 
80
static OM_uint32 k5glue_process_context_token
 
81
(void *, OM_uint32*,       /* minor_status */
 
82
            gss_ctx_id_t,     /* context_handle */
 
83
            gss_buffer_t      /* token_buffer */
 
84
           );
 
85
 
 
86
static OM_uint32 k5glue_delete_sec_context
 
87
(void *, OM_uint32*,       /* minor_status */
 
88
            gss_ctx_id_t*,    /* context_handle */
 
89
            gss_buffer_t      /* output_token */
 
90
           );
 
91
 
 
92
static OM_uint32 k5glue_context_time
 
93
(void *, OM_uint32*,       /* minor_status */
 
94
            gss_ctx_id_t,     /* context_handle */
 
95
            OM_uint32*        /* time_rec */
 
96
           );
 
97
 
 
98
static OM_uint32 k5glue_sign
 
99
(void *, OM_uint32*,       /* minor_status */
 
100
            gss_ctx_id_t,     /* context_handle */
 
101
            int,              /* qop_req */
 
102
            gss_buffer_t,     /* message_buffer */
 
103
            gss_buffer_t      /* message_token */
 
104
           );
 
105
 
 
106
static OM_uint32 k5glue_verify
 
107
(void *, OM_uint32*,       /* minor_status */
 
108
            gss_ctx_id_t,     /* context_handle */
 
109
            gss_buffer_t,     /* message_buffer */
 
110
            gss_buffer_t,     /* token_buffer */
 
111
            int*              /* qop_state */
 
112
           );
 
113
 
 
114
static OM_uint32 k5glue_seal
 
115
(void *, OM_uint32*,       /* minor_status */
 
116
            gss_ctx_id_t,     /* context_handle */
 
117
            int,              /* conf_req_flag */
 
118
            int,              /* qop_req */
 
119
            gss_buffer_t,     /* input_message_buffer */
 
120
            int*,             /* conf_state */
 
121
            gss_buffer_t      /* output_message_buffer */
 
122
           );
 
123
 
 
124
static OM_uint32 k5glue_unseal
 
125
(void *, OM_uint32*,       /* minor_status */
 
126
            gss_ctx_id_t,     /* context_handle */
 
127
            gss_buffer_t,     /* input_message_buffer */
 
128
            gss_buffer_t,     /* output_message_buffer */
 
129
            int*,             /* conf_state */
 
130
            int*              /* qop_state */
 
131
           );
 
132
 
 
133
static OM_uint32 k5glue_display_status
 
134
(void *, OM_uint32*,       /* minor_status */
 
135
            OM_uint32,        /* status_value */
 
136
            int,              /* status_type */
 
137
            gss_OID,          /* mech_type */
 
138
            OM_uint32*,       /* message_context */
 
139
            gss_buffer_t      /* status_string */
 
140
           );
 
141
 
 
142
static OM_uint32 k5glue_indicate_mechs
 
143
(void *, OM_uint32*,       /* minor_status */
 
144
            gss_OID_set*      /* mech_set */
 
145
           );
 
146
 
 
147
static OM_uint32 k5glue_compare_name
 
148
(void *, OM_uint32*,       /* minor_status */
 
149
            gss_name_t,       /* name1 */
 
150
            gss_name_t,       /* name2 */
 
151
            int*              /* name_equal */
 
152
           );
 
153
 
 
154
static OM_uint32 k5glue_display_name
 
155
(void *, OM_uint32*,      /* minor_status */
 
156
            gss_name_t,      /* input_name */
 
157
            gss_buffer_t,    /* output_name_buffer */
 
158
            gss_OID*         /* output_name_type */
 
159
           );
 
160
 
 
161
static OM_uint32 k5glue_import_name
 
162
(void *, OM_uint32*,       /* minor_status */
 
163
            gss_buffer_t,     /* input_name_buffer */
 
164
            gss_OID,          /* input_name_type */
 
165
            gss_name_t*       /* output_name */
 
166
           );
 
167
 
 
168
static OM_uint32 k5glue_release_name
 
169
(void *, OM_uint32*,       /* minor_status */
 
170
            gss_name_t*       /* input_name */
 
171
           );
 
172
 
 
173
static OM_uint32 k5glue_inquire_cred
 
174
(void *, OM_uint32 *,      /* minor_status */
 
175
            gss_cred_id_t,    /* cred_handle */
 
176
            gss_name_t *,     /* name */
 
177
            OM_uint32 *,      /* lifetime */
 
178
            gss_cred_usage_t*,/* cred_usage */
 
179
            gss_OID_set *     /* mechanisms */
 
180
           );
 
181
 
 
182
static OM_uint32 k5glue_inquire_context
 
183
(void *, OM_uint32*,       /* minor_status */
 
184
            gss_ctx_id_t,     /* context_handle */
 
185
            gss_name_t*,      /* initiator_name */
 
186
            gss_name_t*,      /* acceptor_name */
 
187
            OM_uint32*,       /* lifetime_rec */
 
188
            gss_OID*,         /* mech_type */
 
189
            OM_uint32*,       /* ret_flags */
 
190
            int*,             /* locally_initiated */
 
191
            int*              /* open */
 
192
           );
 
193
 
 
194
#if 0
 
195
/* New V2 entry points */
 
196
static OM_uint32 k5glue_get_mic
 
197
(void *, OM_uint32 *,           /* minor_status */
 
198
            gss_ctx_id_t,               /* context_handle */
 
199
            gss_qop_t,                  /* qop_req */
 
200
            gss_buffer_t,               /* message_buffer */
 
201
            gss_buffer_t                /* message_token */
 
202
           );
 
203
 
 
204
static OM_uint32 k5glue_verify_mic
 
205
(void *, OM_uint32 *,           /* minor_status */
 
206
            gss_ctx_id_t,               /* context_handle */
 
207
            gss_buffer_t,               /* message_buffer */
 
208
            gss_buffer_t,               /* message_token */
 
209
            gss_qop_t *                 /* qop_state */
 
210
           );
 
211
 
 
212
static OM_uint32 k5glue_wrap
 
213
(void *, OM_uint32 *,           /* minor_status */
 
214
            gss_ctx_id_t,               /* context_handle */
 
215
            int,                        /* conf_req_flag */
 
216
            gss_qop_t,                  /* qop_req */
 
217
            gss_buffer_t,               /* input_message_buffer */
 
218
            int *,                      /* conf_state */
 
219
            gss_buffer_t                /* output_message_buffer */
 
220
           );
 
221
 
 
222
static OM_uint32 k5glue_unwrap
 
223
(void *, OM_uint32 *,           /* minor_status */
 
224
            gss_ctx_id_t,               /* context_handle */
 
225
            gss_buffer_t,               /* input_message_buffer */
 
226
            gss_buffer_t,               /* output_message_buffer */
 
227
            int *,                      /* conf_state */
 
228
            gss_qop_t *                 /* qop_state */
 
229
           );
 
230
#endif
 
231
 
 
232
static OM_uint32 k5glue_wrap_size_limit
 
233
(void *, OM_uint32 *,           /* minor_status */
 
234
            gss_ctx_id_t,               /* context_handle */
 
235
            int,                        /* conf_req_flag */
 
236
            gss_qop_t,                  /* qop_req */
 
237
            OM_uint32,                  /* req_output_size */
 
238
            OM_uint32 *                 /* max_input_size */
 
239
           );
 
240
 
 
241
#if 0
 
242
static OM_uint32 k5glue_import_name_object
 
243
(void *, OM_uint32 *,           /* minor_status */
 
244
            void *,                     /* input_name */
 
245
            gss_OID,                    /* input_name_type */
 
246
            gss_name_t *                /* output_name */
 
247
           );
 
248
 
 
249
static OM_uint32 k5glue_export_name_object
 
250
(void *, OM_uint32 *,           /* minor_status */
 
251
            gss_name_t,                 /* input_name */
 
252
            gss_OID,                    /* desired_name_type */
 
253
            void * *                    /* output_name */
 
254
           );
 
255
#endif
 
256
 
 
257
static OM_uint32 k5glue_add_cred
 
258
(void *, OM_uint32 *,           /* minor_status */
 
259
            gss_cred_id_t,              /* input_cred_handle */
 
260
            gss_name_t,                 /* desired_name */
 
261
            gss_OID,                    /* desired_mech */
 
262
            gss_cred_usage_t,           /* cred_usage */
 
263
            OM_uint32,                  /* initiator_time_req */
 
264
            OM_uint32,                  /* acceptor_time_req */
 
265
            gss_cred_id_t *,            /* output_cred_handle */
 
266
            gss_OID_set *,              /* actual_mechs */
 
267
            OM_uint32 *,                /* initiator_time_rec */
 
268
            OM_uint32 *                 /* acceptor_time_rec */
 
269
           );
 
270
 
 
271
static OM_uint32 k5glue_inquire_cred_by_mech
 
272
(void *, OM_uint32  *,          /* minor_status */
 
273
            gss_cred_id_t,              /* cred_handle */
 
274
            gss_OID,                    /* mech_type */
 
275
            gss_name_t *,               /* name */
 
276
            OM_uint32 *,                /* initiator_lifetime */
 
277
            OM_uint32 *,                /* acceptor_lifetime */
 
278
            gss_cred_usage_t *          /* cred_usage */
 
279
           );
 
280
 
 
281
static OM_uint32 k5glue_export_sec_context
 
282
(void *, OM_uint32 *,           /* minor_status */
 
283
            gss_ctx_id_t *,             /* context_handle */
 
284
            gss_buffer_t                /* interprocess_token */
 
285
            );
 
286
 
 
287
static OM_uint32 k5glue_import_sec_context
 
288
(void *, OM_uint32 *,           /* minor_status */
 
289
            gss_buffer_t,               /* interprocess_token */
 
290
            gss_ctx_id_t *              /* context_handle */
 
291
            );
 
292
 
 
293
krb5_error_code k5glue_ser_init(krb5_context);
 
294
 
 
295
static OM_uint32 k5glue_internal_release_oid
 
296
(void *, OM_uint32 *,           /* minor_status */
 
297
            gss_OID *                   /* oid */
 
298
           );
 
299
 
 
300
static OM_uint32 k5glue_inquire_names_for_mech
 
301
(void *, OM_uint32 *,           /* minor_status */
 
302
            gss_OID,                    /* mechanism */
 
303
            gss_OID_set *               /* name_types */
 
304
           );
 
305
 
 
306
#if 0
 
307
static OM_uint32 k5glue_canonicalize_name
 
308
(void *, OM_uint32  *,          /* minor_status */
 
309
            const gss_name_t,           /* input_name */
 
310
            const gss_OID,              /* mech_type */
 
311
            gss_name_t *                /* output_name */
 
312
         );
 
313
#endif
 
314
 
 
315
static OM_uint32 k5glue_export_name
 
316
(void *, OM_uint32  *,          /* minor_status */
 
317
            const gss_name_t,           /* input_name */
 
318
            gss_buffer_t                /* exported_name */
 
319
         );
 
320
 
 
321
#if 0
 
322
static OM_uint32 k5glue_duplicate_name
 
323
(void *, OM_uint32  *,          /* minor_status */
 
324
            const gss_name_t,           /* input_name */
 
325
            gss_name_t *                /* dest_name */
 
326
         );
 
327
#endif
 
328
 
 
329
#if 0
 
330
static OM_uint32 k5glue_validate_cred
 
331
(void *, OM_uint32 *,           /* minor_status */
 
332
            gss_cred_id_t               /* cred */
 
333
         );
 
334
#endif
 
335
 
 
336
/*
 
337
 * The krb5 mechanism provides two mech OIDs; use this initializer to
 
338
 * ensure that both dispatch tables contain identical function
 
339
 * pointers.
 
340
 */
 
341
#define KRB5_GSS_CONFIG_INIT                            \
 
342
    NULL,                                               \
 
343
    k5glue_acquire_cred,                                \
 
344
    k5glue_release_cred,                                \
 
345
    k5glue_init_sec_context,                            \
 
346
    k5glue_accept_sec_context,                          \
 
347
    k5glue_process_context_token,                       \
 
348
    k5glue_delete_sec_context,                          \
 
349
    k5glue_context_time,                                \
 
350
    k5glue_sign,                                        \
 
351
    k5glue_verify,                                      \
 
352
    k5glue_seal,                                        \
 
353
    k5glue_unseal,                                      \
 
354
    k5glue_display_status,                              \
 
355
    k5glue_indicate_mechs,                              \
 
356
    k5glue_compare_name,                                \
 
357
    k5glue_display_name,                                \
 
358
    k5glue_import_name,                                 \
 
359
    k5glue_release_name,                                \
 
360
    k5glue_inquire_cred,                                \
 
361
    k5glue_add_cred,                                    \
 
362
    k5glue_export_sec_context,                          \
 
363
    k5glue_import_sec_context,                          \
 
364
    k5glue_inquire_cred_by_mech,                        \
 
365
    k5glue_inquire_names_for_mech,                      \
 
366
    k5glue_inquire_context,                             \
 
367
    k5glue_internal_release_oid,                        \
 
368
    k5glue_wrap_size_limit,                             \
 
369
    k5glue_export_name,                                 \
 
370
    NULL                        /* store_cred */
 
371
 
 
372
static struct gss_config krb5_mechanism = {
 
373
    100, "kerberos_v5",
 
374
    { GSS_MECH_KRB5_OID_LENGTH, GSS_MECH_KRB5_OID },
 
375
    KRB5_GSS_CONFIG_INIT
 
376
};
 
377
 
 
378
static struct gss_config krb5_mechanism_old = {
 
379
    200, "kerberos_v5 (pre-RFC OID)",
 
380
    { GSS_MECH_KRB5_OLD_OID_LENGTH, GSS_MECH_KRB5_OLD_OID },
 
381
    KRB5_GSS_CONFIG_INIT
 
382
};
 
383
 
 
384
static struct gss_config krb5_mechanism_wrong = {
 
385
    300, "kerberos_v5 (wrong OID)",
 
386
    { GSS_MECH_KRB5_WRONG_OID_LENGTH, GSS_MECH_KRB5_WRONG_OID },
 
387
    KRB5_GSS_CONFIG_INIT
 
388
};
 
389
 
 
390
static gss_mechanism krb5_mech_configs[] = {
 
391
    &krb5_mechanism, &krb5_mechanism_old, &krb5_mechanism_wrong, NULL
 
392
};
 
393
 
 
394
#ifdef MS_BUG_TEST
 
395
static gss_mechanism krb5_mech_configs_hack[] = {
 
396
    &krb5_mechanism, &krb5_mechanism_old, NULL
 
397
};
 
398
#endif
 
399
 
 
400
#if 1
 
401
#define gssint_get_mech_configs krb5_gss_get_mech_configs
 
402
#endif
 
403
 
 
404
gss_mechanism *
 
405
gssint_get_mech_configs(void)
 
406
{
 
407
#ifdef MS_BUG_TEST
 
408
    char *envstr = getenv("MS_FORCE_NO_MSOID");
 
409
 
 
410
    if (envstr != NULL && strcmp(envstr, "1") == 0) {
 
411
        return krb5_mech_configs_hack;
 
412
    }
 
413
#endif
 
414
    return krb5_mech_configs;
 
415
}
 
416
 
 
417
static OM_uint32
 
418
k5glue_accept_sec_context(ctx, minor_status, context_handle, verifier_cred_handle,
31
419
                       input_token, input_chan_bindings, src_name, mech_type, 
32
420
                       output_token, ret_flags, time_rec, delegated_cred_handle)
 
421
    void *ctx;
33
422
     OM_uint32 *minor_status;
34
423
     gss_ctx_id_t *context_handle;
35
424
     gss_cred_id_t verifier_cred_handle;
55
444
                                      delegated_cred_handle));
56
445
}
57
446
 
58
 
OM_uint32 KRB5_CALLCONV
59
 
gss_acquire_cred(minor_status, desired_name, time_req, desired_mechs,
 
447
static OM_uint32
 
448
k5glue_acquire_cred(ctx, minor_status, desired_name, time_req, desired_mechs,
60
449
                 cred_usage, output_cred_handle, actual_mechs, time_rec)
 
450
    void *ctx;
61
451
     OM_uint32 *minor_status;
62
452
     gss_name_t desired_name;
63
453
     OM_uint32 time_req;
78
468
}
79
469
 
80
470
/* V2 */
81
 
OM_uint32 KRB5_CALLCONV
82
 
gss_add_cred(minor_status, input_cred_handle, desired_name, desired_mech,
 
471
static OM_uint32
 
472
k5glue_add_cred(ctx, minor_status, input_cred_handle, desired_name, desired_mech,
83
473
             cred_usage, initiator_time_req, acceptor_time_req,
84
474
             output_cred_handle, actual_mechs, initiator_time_rec,
85
475
             acceptor_time_rec)
 
476
    void *ctx;
86
477
    OM_uint32            *minor_status;
87
478
    gss_cred_id_t       input_cred_handle;
88
479
    gss_name_t          desired_name;
102
493
                             acceptor_time_rec));
103
494
}
104
495
 
 
496
#if 0
105
497
/* V2 */
106
 
OM_uint32 KRB5_CALLCONV
107
 
gss_add_oid_set_member(minor_status, member_oid, oid_set)
 
498
static OM_uint32
 
499
k5glue_add_oid_set_member(ctx, minor_status, member_oid, oid_set)
 
500
    void *ctx;
108
501
    OM_uint32    *minor_status;
109
502
    gss_OID     member_oid;
110
503
    gss_OID_set  *oid_set;
111
504
{
112
505
    return(generic_gss_add_oid_set_member(minor_status, member_oid, oid_set));
113
506
}
 
507
#endif
114
508
 
115
 
OM_uint32 KRB5_CALLCONV
116
 
gss_compare_name(minor_status, name1, name2, name_equal)
 
509
static OM_uint32
 
510
k5glue_compare_name(ctx, minor_status, name1, name2, name_equal)
 
511
    void *ctx;
117
512
     OM_uint32 *minor_status;
118
513
     gss_name_t name1;
119
514
     gss_name_t name2;
123
518
                                name2, name_equal));
124
519
}
125
520
 
126
 
OM_uint32 KRB5_CALLCONV
127
 
gss_context_time(minor_status, context_handle, time_rec)
 
521
static OM_uint32
 
522
k5glue_context_time(ctx, minor_status, context_handle, time_rec)
 
523
    void *ctx;
128
524
     OM_uint32 *minor_status;
129
525
     gss_ctx_id_t context_handle;
130
526
     OM_uint32 *time_rec;
133
529
                                time_rec));
134
530
}
135
531
 
 
532
#if 0
136
533
/* V2 */
137
 
OM_uint32 KRB5_CALLCONV
138
 
gss_create_empty_oid_set(minor_status, oid_set)
 
534
static OM_uint32
 
535
k5glue_create_empty_oid_set(ctx, minor_status, oid_set)
 
536
    void *ctx;
139
537
    OM_uint32    *minor_status;
140
538
    gss_OID_set  *oid_set;
141
539
{
142
540
    return(generic_gss_create_empty_oid_set(minor_status, oid_set));
143
541
}
 
542
#endif
144
543
 
145
 
OM_uint32 KRB5_CALLCONV
146
 
gss_delete_sec_context(minor_status, context_handle, output_token)
 
544
static OM_uint32
 
545
k5glue_delete_sec_context(ctx, minor_status, context_handle, output_token)
 
546
    void *ctx;
147
547
     OM_uint32 *minor_status;
148
548
     gss_ctx_id_t *context_handle;
149
549
     gss_buffer_t output_token;
152
552
                                      context_handle, output_token));
153
553
}
154
554
 
155
 
OM_uint32 KRB5_CALLCONV
156
 
gss_display_name(minor_status, input_name, output_name_buffer, output_name_type)
 
555
static OM_uint32
 
556
k5glue_display_name(ctx, minor_status, input_name, output_name_buffer, output_name_type)
 
557
    void *ctx;
157
558
     OM_uint32 *minor_status;
158
559
     gss_name_t input_name;
159
560
     gss_buffer_t output_name_buffer;
163
564
                                output_name_buffer, output_name_type));
164
565
}
165
566
 
166
 
OM_uint32 KRB5_CALLCONV
167
 
gss_display_status(minor_status, status_value, status_type,
 
567
static OM_uint32
 
568
k5glue_display_status(ctx, minor_status, status_value, status_type,
168
569
                   mech_type, message_context, status_string)
 
570
    void *ctx;
169
571
     OM_uint32 *minor_status;
170
572
     OM_uint32 status_value;
171
573
     int status_type;
179
581
}
180
582
 
181
583
/* V2 */
182
 
OM_uint32 KRB5_CALLCONV
183
 
gss_export_sec_context(minor_status, context_handle, interprocess_token)
 
584
static OM_uint32
 
585
k5glue_export_sec_context(ctx, minor_status, context_handle, interprocess_token)
 
586
    void *ctx;
184
587
     OM_uint32           *minor_status;
185
588
     gss_ctx_id_t        *context_handle;
186
589
     gss_buffer_t       interprocess_token;
190
593
                                      interprocess_token));
191
594
}
192
595
 
 
596
#if 0
193
597
/* V2 */
194
 
OM_uint32 KRB5_CALLCONV
195
 
gss_get_mic(minor_status, context_handle, qop_req,
 
598
static OM_uint32
 
599
k5glue_get_mic(ctx, minor_status, context_handle, qop_req,
196
600
            message_buffer, message_token)
 
601
    void *ctx;
197
602
     OM_uint32           *minor_status;
198
603
     gss_ctx_id_t       context_handle;
199
604
     gss_qop_t          qop_req;
203
608
    return(krb5_gss_get_mic(minor_status, context_handle,
204
609
                            qop_req, message_buffer, message_token));
205
610
}
 
611
#endif
206
612
 
207
 
OM_uint32 KRB5_CALLCONV
208
 
gss_import_name(minor_status, input_name_buffer, input_name_type, output_name)
 
613
static OM_uint32
 
614
k5glue_import_name(ctx, minor_status, input_name_buffer, input_name_type, output_name)
 
615
    void *ctx;
209
616
     OM_uint32 *minor_status;
210
617
     gss_buffer_t input_name_buffer;
211
618
     gss_OID input_name_type;
212
619
     gss_name_t *output_name;
213
620
{
 
621
#if 0
214
622
    OM_uint32 err;
215
623
    err = gssint_initialize_library();
216
624
    if (err) {
217
625
        *minor_status = err;
218
626
        return GSS_S_FAILURE;
219
627
    }
 
628
#endif
220
629
    return(krb5_gss_import_name(minor_status, input_name_buffer,
221
630
                                input_name_type, output_name));
222
631
}
223
632
 
224
633
/* V2 */
225
 
OM_uint32 KRB5_CALLCONV
226
 
gss_import_sec_context(minor_status, interprocess_token, context_handle)
 
634
static OM_uint32
 
635
k5glue_import_sec_context(ctx, minor_status, interprocess_token, context_handle)
 
636
    void *ctx;
227
637
     OM_uint32           *minor_status;
228
638
     gss_buffer_t       interprocess_token;
229
639
     gss_ctx_id_t        *context_handle;
233
643
                                      context_handle));
234
644
}
235
645
 
236
 
OM_uint32 KRB5_CALLCONV
237
 
gss_indicate_mechs(minor_status, mech_set)
 
646
static OM_uint32
 
647
k5glue_indicate_mechs(ctx, minor_status, mech_set)
 
648
    void *ctx;
238
649
     OM_uint32 *minor_status;
239
650
     gss_OID_set *mech_set;
240
651
{
241
652
   return(krb5_gss_indicate_mechs(minor_status, mech_set));
242
653
}
243
654
 
244
 
OM_uint32 KRB5_CALLCONV
245
 
gss_init_sec_context(minor_status, claimant_cred_handle, context_handle,
 
655
static OM_uint32
 
656
k5glue_init_sec_context(ctx, minor_status, claimant_cred_handle, context_handle,
246
657
                     target_name, mech_type, req_flags, time_req,
247
658
                     input_chan_bindings, input_token, actual_mech_type,
248
659
                     output_token, ret_flags, time_rec)
 
660
    void *ctx;
249
661
     OM_uint32 *minor_status;
250
662
     gss_cred_id_t claimant_cred_handle;
251
663
     gss_ctx_id_t *context_handle;
268
680
                                    time_rec));
269
681
}
270
682
 
271
 
OM_uint32 KRB5_CALLCONV
272
 
gss_inquire_context(minor_status, context_handle, initiator_name, acceptor_name,
 
683
static OM_uint32
 
684
k5glue_inquire_context(ctx, minor_status, context_handle, initiator_name, acceptor_name,
273
685
                    lifetime_rec, mech_type, ret_flags,
274
686
                    locally_initiated, open)
 
687
    void *ctx;
275
688
     OM_uint32 *minor_status;
276
689
     gss_ctx_id_t context_handle;
277
690
     gss_name_t *initiator_name;
288
701
                                   open));
289
702
}
290
703
 
291
 
OM_uint32 KRB5_CALLCONV
292
 
gss_inquire_cred(minor_status, cred_handle, name, lifetime_ret,
 
704
static OM_uint32
 
705
k5glue_inquire_cred(ctx, minor_status, cred_handle, name, lifetime_ret,
293
706
                 cred_usage, mechanisms)
 
707
    void *ctx;
294
708
     OM_uint32 *minor_status;
295
709
     gss_cred_id_t cred_handle;
296
710
     gss_name_t *name;
303
717
}
304
718
 
305
719
/* V2 */
306
 
OM_uint32 KRB5_CALLCONV
307
 
gss_inquire_cred_by_mech(minor_status, cred_handle, mech_type, name,
 
720
static OM_uint32
 
721
k5glue_inquire_cred_by_mech(ctx, minor_status, cred_handle, mech_type, name,
308
722
                         initiator_lifetime, acceptor_lifetime, cred_usage)
 
723
    void *ctx;
309
724
     OM_uint32           *minor_status;
310
725
     gss_cred_id_t      cred_handle;
311
726
     gss_OID            mech_type;
320
735
}
321
736
 
322
737
/* V2 */
323
 
OM_uint32 KRB5_CALLCONV
324
 
gss_inquire_names_for_mech(minor_status, mechanism, name_types)
 
738
static OM_uint32
 
739
k5glue_inquire_names_for_mech(ctx, minor_status, mechanism, name_types)
 
740
    void *ctx;
325
741
    OM_uint32    *minor_status;
326
742
    gss_OID     mechanism;
327
743
    gss_OID_set  *name_types;
331
747
                                           name_types));
332
748
}
333
749
 
 
750
#if 0
334
751
/* V2 */
335
 
OM_uint32 KRB5_CALLCONV
336
 
gss_oid_to_str(minor_status, oid, oid_str)
 
752
static OM_uint32
 
753
k5glue_oid_to_str(ctx, minor_status, oid, oid_str)
 
754
    void *ctx;
337
755
    OM_uint32            *minor_status;
338
756
    gss_OID             oid;
339
757
    gss_buffer_t        oid_str;
340
758
{
341
759
    return(generic_gss_oid_to_str(minor_status, oid, oid_str));
342
760
}
 
761
#endif
343
762
 
344
 
OM_uint32 KRB5_CALLCONV
345
 
gss_process_context_token(minor_status, context_handle, token_buffer)
 
763
static OM_uint32
 
764
k5glue_process_context_token(ctx, minor_status, context_handle, token_buffer)
 
765
    void *ctx;
346
766
     OM_uint32 *minor_status;
347
767
     gss_ctx_id_t context_handle;
348
768
     gss_buffer_t token_buffer;
351
771
                                         context_handle, token_buffer));
352
772
}
353
773
 
354
 
OM_uint32 KRB5_CALLCONV
355
 
gss_release_cred(minor_status, cred_handle)
 
774
static OM_uint32
 
775
k5glue_release_cred(ctx, minor_status, cred_handle)
 
776
    void *ctx;
356
777
     OM_uint32 *minor_status;
357
778
     gss_cred_id_t *cred_handle;
358
779
{
359
780
   return(krb5_gss_release_cred(minor_status, cred_handle));
360
781
}
361
782
 
362
 
OM_uint32 KRB5_CALLCONV
363
 
gss_release_name(minor_status, input_name)
 
783
static OM_uint32
 
784
k5glue_release_name(ctx, minor_status, input_name)
 
785
    void *ctx;
364
786
     OM_uint32 *minor_status;
365
787
     gss_name_t *input_name;
366
788
{
367
789
   return(krb5_gss_release_name(minor_status, input_name));
368
790
}
369
791
 
370
 
OM_uint32 KRB5_CALLCONV
371
 
gss_release_buffer(minor_status, buffer)
 
792
#if 0
 
793
static OM_uint32
 
794
k5glue_release_buffer(ctx, minor_status, buffer)
 
795
    void *ctx;
372
796
     OM_uint32 *minor_status;
373
797
     gss_buffer_t buffer;
374
798
{
375
799
   return(generic_gss_release_buffer(minor_status,
376
800
                                     buffer));
377
801
}
 
802
#endif
378
803
 
379
804
/* V2 */
380
 
OM_uint32 KRB5_CALLCONV
381
 
gss_release_oid(minor_status, oid)
 
805
static OM_uint32
 
806
k5glue_internal_release_oid(ctx, minor_status, oid)
 
807
    void *ctx;
382
808
     OM_uint32   *minor_status;
383
809
     gss_OID     *oid;
384
810
{
385
 
    return(krb5_gss_release_oid(minor_status, oid));
 
811
    return(krb5_gss_internal_release_oid(minor_status, oid));
386
812
}
387
813
 
388
 
OM_uint32 KRB5_CALLCONV
389
 
gss_release_oid_set(minor_status, set)
 
814
#if 0
 
815
static OM_uint32
 
816
k5glue_release_oid_set(ctx, minor_status, set)
 
817
    void *ctx;
390
818
     OM_uint32 * minor_status;
391
819
     gss_OID_set *set;
392
820
{
393
821
   return(generic_gss_release_oid_set(minor_status, set));
394
822
}
 
823
#endif
395
824
 
396
825
/* V1 only */
397
 
OM_uint32 KRB5_CALLCONV
398
 
gss_seal(minor_status, context_handle, conf_req_flag, qop_req,
 
826
static OM_uint32
 
827
k5glue_seal(ctx, minor_status, context_handle, conf_req_flag, qop_req,
399
828
         input_message_buffer, conf_state, output_message_buffer)
 
829
    void *ctx;
400
830
     OM_uint32 *minor_status;
401
831
     gss_ctx_id_t context_handle;
402
832
     int conf_req_flag;
410
840
                        conf_state, output_message_buffer));
411
841
}
412
842
 
413
 
OM_uint32 KRB5_CALLCONV
414
 
gss_sign(minor_status, context_handle,
 
843
static OM_uint32
 
844
k5glue_sign(ctx, minor_status, context_handle,
415
845
              qop_req, message_buffer, 
416
846
              message_token)
 
847
    void *ctx;
417
848
     OM_uint32 *minor_status;
418
849
     gss_ctx_id_t context_handle;
419
850
     int qop_req;
424
855
                        qop_req, message_buffer, message_token));
425
856
}
426
857
 
 
858
#if 0
427
859
/* V2 */
428
 
OM_uint32 KRB5_CALLCONV
429
 
gss_verify_mic(minor_status, context_handle,
 
860
static OM_uint32
 
861
k5glue_verify_mic(ctx, minor_status, context_handle,
430
862
               message_buffer, token_buffer, qop_state)
 
863
    void *ctx;
431
864
     OM_uint32           *minor_status;
432
865
     gss_ctx_id_t       context_handle;
433
866
     gss_buffer_t       message_buffer;
439
872
}
440
873
 
441
874
/* V2 */
442
 
OM_uint32 KRB5_CALLCONV
443
 
gss_wrap(minor_status, context_handle, conf_req_flag, qop_req,
 
875
static OM_uint32
 
876
k5glue_wrap(ctx, minor_status, context_handle, conf_req_flag, qop_req,
444
877
         input_message_buffer, conf_state, output_message_buffer)
 
878
    void *ctx;
445
879
    OM_uint32            *minor_status;
446
880
    gss_ctx_id_t        context_handle;
447
881
    int                 conf_req_flag;
456
890
}
457
891
 
458
892
/* V2 */
459
 
OM_uint32 KRB5_CALLCONV
460
 
gss_str_to_oid(minor_status, oid_str, oid)
 
893
static OM_uint32
 
894
k5glue_str_to_oid(ctx, minor_status, oid_str, oid)
 
895
    void *ctx;
461
896
    OM_uint32            *minor_status;
462
897
    gss_buffer_t        oid_str;
463
898
    gss_OID              *oid;
466
901
}
467
902
 
468
903
/* V2 */
469
 
OM_uint32 KRB5_CALLCONV
470
 
gss_test_oid_set_member(minor_status, member, set, present)
 
904
static OM_uint32
 
905
k5glue_test_oid_set_member(ctx, minor_status, member, set, present)
 
906
    void *ctx;
471
907
    OM_uint32    *minor_status;
472
908
    gss_OID     member;
473
909
    gss_OID_set set;
476
912
    return(generic_gss_test_oid_set_member(minor_status, member, set,
477
913
                                           present));
478
914
}
 
915
#endif
479
916
 
480
917
/* V1 only */
481
 
OM_uint32 KRB5_CALLCONV
482
 
gss_unseal(minor_status, context_handle, input_message_buffer,
 
918
static OM_uint32
 
919
k5glue_unseal(ctx, minor_status, context_handle, input_message_buffer,
483
920
           output_message_buffer, conf_state, qop_state)
 
921
    void *ctx;
484
922
     OM_uint32 *minor_status;
485
923
     gss_ctx_id_t context_handle;
486
924
     gss_buffer_t input_message_buffer;
493
931
                          conf_state, qop_state));
494
932
}
495
933
 
 
934
#if 0
496
935
/* V2 */
497
 
OM_uint32 KRB5_CALLCONV
498
 
gss_unwrap(minor_status, context_handle, input_message_buffer, 
 
936
static OM_uint32
 
937
k5glue_unwrap(ctx, minor_status, context_handle, input_message_buffer, 
499
938
           output_message_buffer, conf_state, qop_state)
 
939
    void *ctx;
500
940
    OM_uint32            *minor_status;
501
941
    gss_ctx_id_t        context_handle;
502
942
    gss_buffer_t        input_message_buffer;
507
947
    return(krb5_gss_unwrap(minor_status, context_handle, input_message_buffer,
508
948
                           output_message_buffer, conf_state, qop_state));
509
949
}
 
950
#endif
510
951
 
511
952
/* V1 only */
512
 
OM_uint32 KRB5_CALLCONV
513
 
gss_verify(minor_status, context_handle, message_buffer,
 
953
static OM_uint32
 
954
k5glue_verify(ctx, minor_status, context_handle, message_buffer,
514
955
           token_buffer, qop_state)
 
956
    void *ctx;
515
957
     OM_uint32 *minor_status;
516
958
     gss_ctx_id_t context_handle;
517
959
     gss_buffer_t message_buffer;
526
968
}
527
969
 
528
970
/* V2 interface */
529
 
OM_uint32 KRB5_CALLCONV
530
 
gss_wrap_size_limit(minor_status, context_handle, conf_req_flag,
 
971
static OM_uint32
 
972
k5glue_wrap_size_limit(ctx, minor_status, context_handle, conf_req_flag,
531
973
                    qop_req, req_output_size, max_input_size)
 
974
    void *ctx;
532
975
    OM_uint32            *minor_status;
533
976
    gss_ctx_id_t        context_handle;
534
977
    int                 conf_req_flag;
541
984
                                   req_output_size, max_input_size));
542
985
}
543
986
 
 
987
#if 0
544
988
/* V2 interface */
545
 
OM_uint32 KRB5_CALLCONV
546
 
gss_canonicalize_name(minor_status, input_name, mech_type, output_name)
 
989
static OM_uint32
 
990
k5glue_canonicalize_name(ctx, minor_status, input_name, mech_type, output_name)
 
991
    void *ctx;
547
992
        OM_uint32  *minor_status;
548
993
        const gss_name_t input_name;
549
994
        const gss_OID mech_type;
552
997
        return krb5_gss_canonicalize_name(minor_status, input_name,
553
998
                                          mech_type, output_name);
554
999
}
555
 
 
 
1000
#endif
556
1001
 
557
1002
/* V2 interface */
558
 
OM_uint32 KRB5_CALLCONV
559
 
gss_export_name(minor_status, input_name, exported_name)
 
1003
static OM_uint32
 
1004
k5glue_export_name(ctx, minor_status, input_name, exported_name)
 
1005
    void *ctx;
560
1006
        OM_uint32  *minor_status;
561
1007
        const gss_name_t input_name;
562
1008
        gss_buffer_t exported_name;
564
1010
        return krb5_gss_export_name(minor_status, input_name, exported_name);
565
1011
}
566
1012
 
 
1013
#if 0
567
1014
/* V2 interface */
568
 
OM_uint32 KRB5_CALLCONV
569
 
gss_duplicate_name(minor_status, input_name, dest_name)
 
1015
static OM_uint32
 
1016
k5glue_duplicate_name(ctx, minor_status, input_name, dest_name)
 
1017
    void *ctx;
570
1018
        OM_uint32  *minor_status;
571
1019
        const gss_name_t input_name;
572
1020
        gss_name_t *dest_name;
573
1021
{
574
1022
        return krb5_gss_duplicate_name(minor_status, input_name, dest_name);
575
1023
}
576
 
 
577
 
 
578
 
 
 
1024
#endif
 
1025
 
 
1026
OM_uint32 KRB5_CALLCONV
 
1027
gss_krb5_get_tkt_flags(
 
1028
    OM_uint32 *minor_status,
 
1029
    gss_ctx_id_t context_handle,
 
1030
    krb5_flags *ticket_flags)
 
1031
{
 
1032
    gss_union_ctx_id_t uctx;
 
1033
 
 
1034
    uctx = (gss_union_ctx_id_t)context_handle;
 
1035
    if (!g_OID_equal(uctx->mech_type, &krb5_mechanism.mech_type) &&
 
1036
        !g_OID_equal(uctx->mech_type, &krb5_mechanism_old.mech_type))
 
1037
        return GSS_S_BAD_MECH;
 
1038
    return gss_krb5int_get_tkt_flags(minor_status, uctx->internal_ctx_id,
 
1039
                                     ticket_flags);
 
1040
}
 
1041
 
 
1042
OM_uint32 KRB5_CALLCONV 
 
1043
gss_krb5_copy_ccache(
 
1044
    OM_uint32 *minor_status,
 
1045
    gss_cred_id_t cred_handle,
 
1046
    krb5_ccache out_ccache)
 
1047
{
 
1048
    gss_union_cred_t ucred;
 
1049
    gss_cred_id_t mcred;
 
1050
 
 
1051
    ucred = (gss_union_cred_t)cred_handle;
 
1052
 
 
1053
    mcred = gssint_get_mechanism_cred(ucred, &krb5_mechanism.mech_type);
 
1054
    if (mcred != GSS_C_NO_CREDENTIAL)
 
1055
        return gss_krb5int_copy_ccache(minor_status, mcred, out_ccache);
 
1056
 
 
1057
    mcred = gssint_get_mechanism_cred(ucred, &krb5_mechanism_old.mech_type);
 
1058
    if (mcred != GSS_C_NO_CREDENTIAL)
 
1059
        return gss_krb5int_copy_ccache(minor_status, mcred, out_ccache);
 
1060
 
 
1061
    return GSS_S_DEFECTIVE_CREDENTIAL;
 
1062
}
 
1063
 
 
1064
/* XXX need to delete mechglue ctx too */
 
1065
OM_uint32 KRB5_CALLCONV
 
1066
gss_krb5_export_lucid_sec_context(
 
1067
    OM_uint32 *minor_status,
 
1068
    gss_ctx_id_t *context_handle,
 
1069
    OM_uint32 version,
 
1070
    void **kctx)
 
1071
{
 
1072
    gss_union_ctx_id_t uctx;
 
1073
 
 
1074
    uctx = (gss_union_ctx_id_t)*context_handle;
 
1075
    if (!g_OID_equal(uctx->mech_type, &krb5_mechanism.mech_type) &&
 
1076
        !g_OID_equal(uctx->mech_type, &krb5_mechanism_old.mech_type))
 
1077
        return GSS_S_BAD_MECH;
 
1078
    return gss_krb5int_export_lucid_sec_context(minor_status,
 
1079
                                                &uctx->internal_ctx_id,
 
1080
                                                version, kctx);
 
1081
}
 
1082
 
 
1083
OM_uint32 KRB5_CALLCONV
 
1084
gss_krb5_set_allowable_enctypes(
 
1085
    OM_uint32 *minor_status, 
 
1086
    gss_cred_id_t cred,
 
1087
    OM_uint32 num_ktypes,
 
1088
    krb5_enctype *ktypes)
 
1089
{
 
1090
    gss_union_cred_t ucred;
 
1091
    gss_cred_id_t mcred;
 
1092
 
 
1093
    ucred = (gss_union_cred_t)cred;
 
1094
    mcred = gssint_get_mechanism_cred(ucred, &krb5_mechanism.mech_type);
 
1095
    if (mcred != GSS_C_NO_CREDENTIAL)
 
1096
        return gss_krb5int_set_allowable_enctypes(minor_status, mcred,
 
1097
                                                  num_ktypes, ktypes);
 
1098
 
 
1099
    mcred = gssint_get_mechanism_cred(ucred, &krb5_mechanism_old.mech_type);
 
1100
    if (mcred != GSS_C_NO_CREDENTIAL)
 
1101
        return gss_krb5int_set_allowable_enctypes(minor_status, mcred,
 
1102
                                                  num_ktypes, ktypes);
 
1103
 
 
1104
    return GSS_S_DEFECTIVE_CREDENTIAL;
 
1105
}