]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Make gss_ctx_id_t truly opaque
authorSimo Sorce <simo@redhat.com>
Wed, 9 May 2012 18:50:35 +0000 (14:50 -0400)
committerGreg Hudson <ghudson@mit.edu>
Fri, 3 Aug 2012 19:56:25 +0000 (15:56 -0400)
This allows us to still use it for type safety in the APIs while at
the same time prevent code from trying to dereference internal_ctx_id
by mistake.

src/lib/gssapi/mechglue/g_imp_sec_context.c
src/lib/gssapi/mechglue/g_init_sec_context.c
src/lib/gssapi/mechglue/g_unwrap_aead.c
src/lib/gssapi/mechglue/g_wrap_aead.c
src/lib/gssapi/mechglue/mglueP.h

index 7679c92dede2e58906836c455bd1decccd95d2bf..45ba9d62940eb602ccdbaf4149d0f1b7be685a42 100644 (file)
@@ -148,7 +148,7 @@ gss_ctx_id_t *              context_handle;
 
     if (status == GSS_S_COMPLETE) {
        ctx->loopback = ctx;
-       *context_handle = ctx;
+       *context_handle = (gss_ctx_id_t)ctx;
        return (GSS_S_COMPLETE);
     }
     map_error(minor_status, mech);
index 21bc345e62033084c6dcbc5de330a8d360409dc7..5afea2d94c2c9697a8700265b3575700d22796ea 100644 (file)
@@ -194,7 +194,7 @@ OM_uint32 *         time_rec;
        /* copy the supplied context handle */
        union_ctx_id->internal_ctx_id = GSS_C_NO_CONTEXT;
     } else
-       union_ctx_id = *context_handle;
+       union_ctx_id = (gss_union_ctx_id_t)*context_handle;
 
     /*
      * get the appropriate cred handle from the union cred struct.
index 8be6d6ab1f91e1b169637606bb01e93d26fcf621..e78bff2d3289bf09430a0a722f1415d0ba201ce7 100644 (file)
@@ -191,7 +191,7 @@ gss_qop_t           *qop_state;
     if (!mech)
        return (GSS_S_BAD_MECH);
 
-    return gssint_unwrap_aead(mech, minor_status, context_handle,
+    return gssint_unwrap_aead(mech, minor_status, ctx,
                              input_message_buffer, input_assoc_buffer,
                              output_payload_buffer, conf_state, qop_state);
 }
index ca1ef122e6f5c7d7e568d5e66e956832f50162ff..96cdf3ce6ab86242b3f70b6e3208e2cfc45e9c7c 100644 (file)
@@ -260,7 +260,7 @@ gss_buffer_t                output_message_buffer;
     if (!mech)
        return (GSS_S_BAD_MECH);
 
-    return gssint_wrap_aead(mech, minor_status, context_handle,
+    return gssint_wrap_aead(mech, minor_status, ctx,
                            conf_req_flag, qop_req,
                            input_assoc_buffer, input_payload_buffer,
                            conf_state, output_message_buffer);
index efbb370232f706876878253464ab0ecbe208a6ab..9e87b39bc4403a11964cd54c0cfe4a21477925be 100644 (file)
@@ -23,8 +23,8 @@ do {                                                          \
 /*
  * Array of context IDs typed by mechanism OID
  */
-typedef struct gss_ctx_id_struct {
-       struct gss_ctx_id_struct *loopback;
+typedef struct gss_union_ctx_id_struct {
+       struct gss_union_ctx_id_struct *loopback;
        gss_OID                 mech_type;
        gss_ctx_id_t            internal_ctx_id;
 } gss_union_ctx_id_desc, *gss_union_ctx_id_t;