1 /*
2 * Copyright (c) 1996,1997, by Sun Microsystems, Inc.
3 * All rights reserved.
4 */
5
6 #pragma ident "@(#)g_delete_sec_context.c 1.12 04/09/08 SMI"
7
8 /*
9 * glue routine for gss_delete_sec_context
10 */
11
12 #include <mechglueP.h>
13 #include <stdio.h>
14 #ifdef HAVE_STDLIB_H
15 #include <stdlib.h>
16 #endif
17
18 OM_uint32
19 gss_delete_sec_context(minor_status,
20 context_handle,
21 output_token)
22
23 OM_uint32 * minor_status;
24 gss_ctx_id_t * context_handle;
25 gss_buffer_t output_token;
26
27 {
28 OM_uint32 status;
29 gss_union_ctx_id_t ctx;
30 gss_mechanism mech;
31
32 gss_initialize();
33
34 /* if the context_handle is Null, return NO_CONTEXT error */
35
36 if (context_handle == NULL || *context_handle == GSS_C_NO_CONTEXT)
37 return (GSS_S_NO_CONTEXT);
38
39 /*
40 * select the approprate underlying mechanism routine and
41 * call it.
42 */
43
44 ctx = (gss_union_ctx_id_t) *context_handle;
45 mech = __gss_get_mechanism(ctx->mech_type);
46
47 if (mech) {
48
49 if (mech->gss_delete_sec_context)
50 status = mech->gss_delete_sec_context(mech->context,
51 minor_status,
52 &ctx->internal_ctx_id,
53 output_token);
54 else
55 status = GSS_S_BAD_BINDINGS;
56
57 /* now free up the space for the union context structure */
58
59 free(ctx->mech_type->elements);
60 free(ctx->mech_type);
61 free(*context_handle);
62 *context_handle = NULL;
63
64 return (status);
65 }
66
67 return (GSS_S_NO_CONTEXT);
68 }
|
1 /*
2 * Copyright (c) 1996,1997, by Sun Microsystems, Inc.
3 * All rights reserved.
4 */
5
6 #pragma ident "@(#)g_delete_sec_context.c 1.11 97/11/09 SMI"
7
8 /*
9 * glue routine for gss_delete_sec_context
10 */
11
12 #include <mechglueP.h>
13 #include <stdio.h>
14 #ifdef HAVE_STDLIB_H
15 #include <stdlib.h>
16 #endif
17
18 OM_uint32
19 gss_delete_sec_context(minor_status,
20 context_handle,
21 output_token)
22
23 OM_uint32 * minor_status;
24 gss_ctx_id_t * context_handle;
25 gss_buffer_t output_token;
26
27 {
28 OM_uint32 status;
29 gss_union_ctx_id_t ctx;
30 gss_mechanism mech;
31
32 if (minor_status == NULL)
33 return (GSS_S_CALL_INACCESSIBLE_WRITE);
34
35 /* if the context_handle is Null, return NO_CONTEXT error */
36 if (context_handle == NULL || *context_handle == GSS_C_NO_CONTEXT)
37 return (GSS_S_CALL_INACCESSIBLE_READ | GSS_S_NO_CONTEXT);
38
39 /*
40 * select the approprate underlying mechanism routine and
41 * call it.
42 */
43
44 ctx = (gss_union_ctx_id_t) *context_handle;
45 mech = __gss_get_mechanism(ctx->mech_type);
46
47 if (mech) {
48
49 if (mech->gss_delete_sec_context)
50 status = mech->gss_delete_sec_context(mech->context,
51 minor_status,
52 &ctx->internal_ctx_id,
53 output_token);
54 else
55 status = GSS_S_UNAVAILABLE;
56
57 /* now free up the space for the union context structure */
58 free(ctx->mech_type->elements);
59 free(ctx->mech_type);
60 free(*context_handle);
61 *context_handle = NULL;
62
63 return (status);
64 }
65
66 return (GSS_S_BAD_MECH);
67 }
|