Cleanup a number of cast away from const warnings in gssapi
authorEzra Peisach <epeisach@mit.edu>
Tue, 9 May 2006 11:31:02 +0000 (11:31 +0000)
committerEzra Peisach <epeisach@mit.edu>
Tue, 9 May 2006 11:31:02 +0000 (11:31 +0000)
Change internal token handling and oid handling functions to take a
const style gss_OID. In the krb5 dir remove casting.

This is the start of fixes in this arena.

ticket: new

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17987 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/gssapi/generic/gssapiP_generic.h
src/lib/gssapi/generic/oid_ops.c
src/lib/gssapi/generic/util_token.c
src/lib/gssapi/krb5/accept_sec_context.c
src/lib/gssapi/krb5/acquire_cred.c
src/lib/gssapi/krb5/init_sec_context.c
src/lib/gssapi/krb5/inq_cred.c
src/lib/gssapi/krb5/inq_names.c
src/lib/gssapi/krb5/k5seal.c
src/lib/gssapi/krb5/k5unseal.c
src/lib/gssapi/krb5/wrap_size_limit.c

index 8936b63f05f265ea51ec7c9d12cfe3116bff2599..ca19b18910ff049162934b09ae293f135c6973c4 100644 (file)
@@ -170,12 +170,13 @@ int g_make_string_buffer (const char *str, gss_buffer_t buffer);
 
 int g_copy_OID_set (const gss_OID_set_desc * const in, gss_OID_set *out);
 
-unsigned int g_token_size (gss_OID mech, unsigned int body_size);
+unsigned int g_token_size (const gss_OID_desc * mech, unsigned int body_size);
 
-void g_make_token_header (gss_OID mech, unsigned int body_size,
+void g_make_token_header (const gss_OID_desc * mech, unsigned int body_size,
                          unsigned char **buf, int tok_type);
 
-gss_int32 g_verify_token_header (gss_OID mech, unsigned int *body_size,
+gss_int32 g_verify_token_header (const gss_OID_desc * mech, 
+                                unsigned int *body_size,
                                 unsigned char **buf, int tok_type, 
                                 unsigned int toksize_in,
                                 int wrapper_required);
@@ -223,7 +224,7 @@ OM_uint32 generic_gss_release_oid
 
 OM_uint32 generic_gss_copy_oid
 (OM_uint32 *,  /* minor_status */
-           gss_OID,            /* oid */
+           const gss_OID_desc * const,         /* oid */
            gss_OID *           /* new_oid */
            );
 
@@ -234,20 +235,20 @@ OM_uint32 generic_gss_create_empty_oid_set
 
 OM_uint32 generic_gss_add_oid_set_member
 (OM_uint32 *,  /* minor_status */
-           gss_OID,            /* member_oid */
+           const gss_OID_desc * const,         /* member_oid */
            gss_OID_set *       /* oid_set */
           );
 
 OM_uint32 generic_gss_test_oid_set_member
 (OM_uint32 *,  /* minor_status */
-           gss_OID,            /* member */
+           const gss_OID_desc * const,         /* member */
            gss_OID_set,        /* set */
            int *               /* present */
           );
 
 OM_uint32 generic_gss_oid_to_str
 (OM_uint32 *,  /* minor_status */
-           gss_OID,            /* oid */
+           const gss_OID_desc * const,         /* oid */
            gss_buffer_t        /* oid_str */
           );
 
index a73589879d7d588d9870671a36dd56fb159af55c..1234f2ee70233d6afb0a74d730e72d80c5ae8c3c 100644 (file)
@@ -75,7 +75,8 @@ generic_gss_release_oid(minor_status, oid)
 OM_uint32
 generic_gss_copy_oid(minor_status, oid, new_oid)
        OM_uint32       *minor_status;
-       gss_OID         oid, *new_oid;
+       const gss_OID_desc * const oid;
+       gss_OID         *new_oid;
 {
        gss_OID         p;
 
@@ -116,7 +117,7 @@ generic_gss_create_empty_oid_set(minor_status, oid_set)
 OM_uint32
 generic_gss_add_oid_set_member(minor_status, member_oid, oid_set)
     OM_uint32  *minor_status;
-    gss_OID    member_oid;
+    const gss_OID_desc * const member_oid;
     gss_OID_set        *oid_set;
 {
     gss_OID    elist;
@@ -161,7 +162,7 @@ generic_gss_add_oid_set_member(minor_status, member_oid, oid_set)
 OM_uint32
 generic_gss_test_oid_set_member(minor_status, member, set, present)
     OM_uint32  *minor_status;
-    gss_OID    member;
+    const gss_OID_desc * const member;
     gss_OID_set        set;
     int                *present;
 {
@@ -189,7 +190,7 @@ generic_gss_test_oid_set_member(minor_status, member, set, present)
 OM_uint32
 generic_gss_oid_to_str(minor_status, oid, oid_str)
     OM_uint32          *minor_status;
-    gss_OID            oid;
+    const gss_OID_desc * const oid;
     gss_buffer_t       oid_str;
 {
     char               numstr[128];
index 6277e942a2d69a4de46097cd40e1adedca61ce14..7b8dfed223894bde50ddad36ccd5de0530c437df 100644 (file)
@@ -133,7 +133,7 @@ static int der_read_length(buf, bufsize)
 /* returns the length of a token, given the mech oid and the body size */
 
 unsigned int g_token_size(mech, body_size)
-     gss_OID mech;
+     const gss_OID_desc * mech;
      unsigned int body_size;
 {
    /* set body_size to sequence contents size */
@@ -145,7 +145,7 @@ unsigned int g_token_size(mech, body_size)
    be the right size.  buf is advanced past the token header */
 
 void g_make_token_header(mech, body_size, buf, tok_type)
-     gss_OID mech;
+     const gss_OID_desc * mech;
      unsigned int body_size;
      unsigned char **buf;
      int tok_type;
@@ -172,7 +172,7 @@ void g_make_token_header(mech, body_size, buf, tok_type)
 
 gss_int32 g_verify_token_header(mech, body_size, buf_in, tok_type, toksize_in,
                                wrapper_required)
-     gss_OID mech;
+     const gss_OID_desc * mech;
      unsigned int *body_size;
      unsigned char **buf_in;
      int tok_type;
index 219d9da060737867bf699717024a6890027c000b..657176b86a0a19d5f0e0d92f01b97396f1d8eeb5 100644 (file)
@@ -336,13 +336,13 @@ krb5_gss_accept_sec_context(minor_status, context_handle,
 
    ptr = (unsigned char *) input_token->value;
 
-   if (!(code = g_verify_token_header((gss_OID) gss_mech_krb5,
+   if (!(code = g_verify_token_header(gss_mech_krb5,
                                      &(ap_req.length),
                                      &ptr, KG_TOK_CTX_AP_REQ,
                                      input_token->length, 1))) {
        mech_used = gss_mech_krb5;
    } else if ((code == G_WRONG_MECH) &&
-             !(code = g_verify_token_header((gss_OID) gss_mech_krb5_old,
+             !(code = g_verify_token_header(gss_mech_krb5_old,
                                             &(ap_req.length), 
                                             &ptr, KG_TOK_CTX_AP_REQ,
                                             input_token->length, 1))) {
@@ -814,7 +814,7 @@ krb5_gss_accept_sec_context(minor_status, context_handle,
        ctx->gss_flags |= GSS_C_PROT_READY_FLAG;
        ctx->established = 1;
 
-       token.length = g_token_size((gss_OID) mech_used, ap_rep.length);
+       token.length = g_token_size(mech_used, ap_rep.length);
 
        if ((token.value = (unsigned char *) xmalloc(token.length))
           == NULL) {
@@ -823,7 +823,7 @@ krb5_gss_accept_sec_context(minor_status, context_handle,
           goto fail;
        }
        ptr3 = token.value;
-       g_make_token_header((gss_OID) mech_used, ap_rep.length,
+       g_make_token_header(mech_used, ap_rep.length,
                           &ptr3, KG_TOK_CTX_AP_REP);
 
        TWRITE_STR(ptr3, ap_rep.data, ap_rep.length);
@@ -972,7 +972,7 @@ krb5_gss_accept_sec_context(minor_status, context_handle,
        tmsglen = scratch.length;
        toktype = KG_TOK_CTX_ERROR;
 
-       token.length = g_token_size((gss_OID) mech_used, tmsglen);
+       token.length = g_token_size(mech_used, tmsglen);
        token.value = (unsigned char *) xmalloc(token.length);
        if (!token.value) {
           krb5_free_context(context);
@@ -980,7 +980,7 @@ krb5_gss_accept_sec_context(minor_status, context_handle,
        }
 
        ptr = token.value;
-       g_make_token_header((gss_OID) mech_used, tmsglen, &ptr, toktype);
+       g_make_token_header(mech_used, tmsglen, &ptr, toktype);
 
        TWRITE_STR(ptr, scratch.data, scratch.length);
        krb5_free_data_contents(context, &scratch);
index a321505fd853317f3c17f2dadc75b6f95864d314..58d3bdcabe9fa3cf3992aa87c8a692e7b225b2f5 100644 (file)
@@ -609,11 +609,11 @@ krb5_gss_acquire_cred(minor_status, desired_name, time_req,
                                                            &ret_mechs)) ||
           (cred->prerfc_mech &&
            GSS_ERROR(ret = generic_gss_add_oid_set_member(minor_status,
-                                                          (gss_OID) gss_mech_krb5_old,
+                                                          gss_mech_krb5_old,
                                                           &ret_mechs))) ||
           (cred->rfc_mech &&
            GSS_ERROR(ret = generic_gss_add_oid_set_member(minor_status,
-                                                          (gss_OID) gss_mech_krb5,
+                                                          gss_mech_krb5,
                                                           &ret_mechs)))) {
           if (cred->ccache)
               (void)krb5_cc_close(context, cred->ccache);
index 9f70da03238d965a1cecf5c4c4a9c14322871e98..91d81fb44fc45567a3ac0e7f86e247e6e6a065db 100644 (file)
@@ -325,7 +325,7 @@ make_ap_req_v1(context, ctx, cred, k_cred, chan_bindings, mech_type, token)
 
    ptr = t;
 
-   g_make_token_header((gss_OID) mech_type, ap_req.length,
+   g_make_token_header(mech_type, ap_req.length,
                       &ptr, KG_TOK_CTX_AP_REQ);
 
    TWRITE_STR(ptr, (unsigned char *) ap_req.data, ap_req.length);
@@ -720,7 +720,7 @@ mutual_auth(
 
    ptr = (unsigned char *) input_token->value;
 
-   if (g_verify_token_header((gss_OID) ctx->mech_used,
+   if (g_verify_token_header(ctx->mech_used,
                             &(ap_rep.length),
                             &ptr, KG_TOK_CTX_AP_REP,
                             input_token->length, 1)) {
index 780e798707a23d7a10721b3248f765fd739666f6..591a655c815b3525e7bde7bb07059394c6c1c95f 100644 (file)
@@ -158,11 +158,11 @@ krb5_gss_inquire_cred(minor_status, cred_handle, name, lifetime_ret,
                                                            &mechs)) ||
           (cred->prerfc_mech &&
            GSS_ERROR(ret = generic_gss_add_oid_set_member(minor_status,
-                                                          (gss_OID) gss_mech_krb5_old,
+                                                          gss_mech_krb5_old,
                                                           &mechs))) ||
           (cred->rfc_mech &&
            GSS_ERROR(ret = generic_gss_add_oid_set_member(minor_status,
-                                                          (gss_OID) gss_mech_krb5,
+                                                          gss_mech_krb5,
                                                           &mechs)))) {
           k5_mutex_unlock(&cred->lock);
           if (ret_name)
index 430132d742b99acd459cec58b4b9eaca5891a0a2..c9e3dc9ad0339087d49b5dc304f8257c8899d061 100644 (file)
@@ -53,38 +53,38 @@ krb5_gss_inquire_names_for_mech(minor_status, mechanism, name_types)
     if (major == GSS_S_COMPLETE) {
        /* Now add our members. */
        if (
-           ((major = gss_add_oid_set_member(minor_status,
-                                            (gss_OID) gss_nt_user_name,
-                                            name_types)
+           ((major = generic_gss_add_oid_set_member(minor_status,
+                                                    gss_nt_user_name,
+                                                    name_types)
              ) == GSS_S_COMPLETE) &&
-           ((major = gss_add_oid_set_member(minor_status,
-                                            (gss_OID) gss_nt_machine_uid_name,
-                                            name_types)
+           ((major = generic_gss_add_oid_set_member(minor_status,
+                                                    gss_nt_machine_uid_name,
+                                                    name_types)
              ) == GSS_S_COMPLETE) &&
-           ((major = gss_add_oid_set_member(minor_status,
-                                            (gss_OID) gss_nt_string_uid_name,
-                                            name_types)
+           ((major = generic_gss_add_oid_set_member(minor_status,
+                                                    gss_nt_string_uid_name,
+                                                    name_types)
              ) == GSS_S_COMPLETE) &&
-           ((major = gss_add_oid_set_member(minor_status,
-                                            (gss_OID) gss_nt_service_name,
-                                            name_types)
+           ((major = generic_gss_add_oid_set_member(minor_status,
+                                                    gss_nt_service_name,
+                                                    name_types)
              ) == GSS_S_COMPLETE) &&
-           ((major = gss_add_oid_set_member(minor_status,
-                                            (gss_OID) gss_nt_service_name_v2,
-                                            name_types)
+           ((major = generic_gss_add_oid_set_member(minor_status,
+                                                    gss_nt_service_name_v2,
+                                                    name_types)
              ) == GSS_S_COMPLETE) &&
-           ((major = gss_add_oid_set_member(minor_status,
-                                            (gss_OID) gss_nt_exported_name,
-                                            name_types)
+           ((major = generic_gss_add_oid_set_member(minor_status,
+                                                    gss_nt_exported_name,
+                                                    name_types)
              ) == GSS_S_COMPLETE) &&
-           ((major = gss_add_oid_set_member(minor_status,
-                                            (gss_OID) gss_nt_krb5_name,
-                                            name_types)
+           ((major = generic_gss_add_oid_set_member(minor_status,
+                                                    gss_nt_krb5_name,
+                                                    name_types)
              ) == GSS_S_COMPLETE)
            ) {
-           major = gss_add_oid_set_member(minor_status,
-                                          (gss_OID) gss_nt_krb5_principal,
-                                          name_types);
+           major = generic_gss_add_oid_set_member(minor_status,
+                                                  gss_nt_krb5_principal,
+                                                  name_types);
        }
 
        /*
index 68aa6696cbe17b6bbefa3827856dd03eac9388e9..7a904d0650b9b9c73cadca44e81002a21c90b800 100644 (file)
@@ -117,7 +117,7 @@ make_seal_token_v1 (krb5_context context,
     /*** fill in the token */
 
     ptr = t;
-    g_make_token_header((gss_OID) oid, 14+cksum_size+tmsglen, &ptr, toktype);
+    g_make_token_header(oid, 14+cksum_size+tmsglen, &ptr, toktype);
 
     /* 0..1 SIGN_ALG */
     ptr[0] = signalg & 0xff;
index 553f18b5e9704205c586346f8a65f128c30ef801..30845bd85a88f08de0623f28c54344f7d0387f82 100644 (file)
@@ -527,7 +527,7 @@ kg_unseal(minor_status, context_handle, input_token_buffer,
        }
     else
        toktype2 = toktype;
-    err = g_verify_token_header((gss_OID) ctx->mech_used,
+    err = g_verify_token_header(ctx->mech_used,
                                &bodysize, &ptr, toktype2,
                                input_token_buffer->length,
                                !ctx->proto);
index 46007063773f6a1efe5bdcb885c48177d67561b3..b875a965a099c8880f51242684d60319c10c240f 100644 (file)
@@ -145,7 +145,7 @@ krb5_gss_wrap_size_limit(minor_status, context_handle, conf_req_flag,
     data_size = req_output_size;
     conflen = kg_confounder_size(ctx->k5_context, ctx->enc);
     data_size = (conflen + data_size + 8) & (~(OM_uint32)7);
-    ohlen = g_token_size((gss_OID) ctx->mech_used,
+    ohlen = g_token_size(ctx->mech_used,
                         (unsigned int) (data_size + ctx->cksum_size + 14))
       - req_output_size;