krb5 commit: Make krb5_preauth_context a pointer type

Greg Hudson ghudson at mit.edu
Thu Jan 26 18:34:08 EST 2017


https://github.com/krb5/krb5/commit/459a081dec6e91ae480a37acb805631742afe1e2
commit 459a081dec6e91ae480a37acb805631742afe1e2
Author: Greg Hudson <ghudson at mit.edu>
Date:   Tue Dec 20 15:25:29 2016 -0500

    Make krb5_preauth_context a pointer type
    
    For consistency with krb5_context and krb5_init_creds_context, make
    krb5_preauth_context a pointer type.  In preauth2.c, use the typedef
    name rather than the structure tag except when defining the structure.

 src/include/k5-int.h        |    4 ++--
 src/lib/krb5/krb/preauth2.c |   22 +++++++++++-----------
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/include/k5-int.h b/src/include/k5-int.h
index 6499173..2d1d293 100644
--- a/src/include/k5-int.h
+++ b/src/include/k5-int.h
@@ -1194,7 +1194,7 @@ k5_plugin_free_context(krb5_context context);
 struct _kdb5_dal_handle;        /* private, in kdb5.h */
 typedef struct _kdb5_dal_handle kdb5_dal_handle;
 struct _kdb_log_context;
-typedef struct krb5_preauth_context_st krb5_preauth_context;
+typedef struct krb5_preauth_context_st *krb5_preauth_context;
 struct ccselect_module_handle;
 struct localauth_module_handle;
 struct hostrealm_module_handle;
@@ -1231,7 +1231,7 @@ struct _krb5_context {
     struct plugin_dir_handle libkrb5_plugins;
 
     /* preauth module stuff */
-    krb5_preauth_context *preauth_context;
+    krb5_preauth_context preauth_context;
 
     /* cache module stuff */
     struct ccselect_module_handle **ccselect_handles;
diff --git a/src/lib/krb5/krb/preauth2.c b/src/lib/krb5/krb/preauth2.c
index ca26fb0..b04d148 100644
--- a/src/lib/krb5/krb/preauth2.c
+++ b/src/lib/krb5/krb/preauth2.c
@@ -161,7 +161,7 @@ k5_init_preauth_context(krb5_context context)
     list[count] = NULL;
 
     /* Place the constructed preauth context into the krb5 context. */
-    context->preauth_context = malloc(sizeof(struct krb5_preauth_context_st));
+    context->preauth_context = malloc(sizeof(*context->preauth_context));
     if (context->preauth_context == NULL)
         goto cleanup;
     context->preauth_context->tried = NULL;
@@ -181,7 +181,7 @@ cleanup:
 void
 k5_reset_preauth_types_tried(krb5_context context)
 {
-    struct krb5_preauth_context_st *pctx = context->preauth_context;
+    krb5_preauth_context pctx = context->preauth_context;
 
     if (pctx == NULL)
         return;
@@ -196,7 +196,7 @@ k5_reset_preauth_types_tried(krb5_context context)
 void
 k5_free_preauth_context(krb5_context context)
 {
-    struct krb5_preauth_context_st *pctx = context->preauth_context;
+    krb5_preauth_context pctx = context->preauth_context;
 
     if (pctx == NULL)
         return;
@@ -211,7 +211,7 @@ k5_free_preauth_context(krb5_context context)
 void
 k5_preauth_request_context_init(krb5_context context)
 {
-    struct krb5_preauth_context_st *pctx = context->preauth_context;
+    krb5_preauth_context pctx = context->preauth_context;
     clpreauth_handle *hp, h;
 
     if (pctx == NULL) {
@@ -233,7 +233,7 @@ k5_preauth_request_context_init(krb5_context context)
 void
 k5_preauth_request_context_fini(krb5_context context)
 {
-    struct krb5_preauth_context_st *pctx = context->preauth_context;
+    krb5_preauth_context pctx = context->preauth_context;
     clpreauth_handle *hp, h;
 
     if (pctx == NULL)
@@ -495,7 +495,7 @@ void
 k5_preauth_prepare_request(krb5_context context, krb5_get_init_creds_opt *opt,
                            krb5_kdc_req *req)
 {
-    struct krb5_preauth_context_st *pctx = context->preauth_context;
+    krb5_preauth_context pctx = context->preauth_context;
     clpreauth_handle *hp, h;
     krb5_enctype *ep;
 
@@ -556,7 +556,7 @@ pa_type_allowed(krb5_init_creds_context ctx, krb5_preauthtype pa_type)
 static krb5_boolean
 already_tried(krb5_context context, krb5_preauthtype pa_type)
 {
-    struct krb5_preauth_context_st *pctx = context->preauth_context;
+    krb5_preauth_context pctx = context->preauth_context;
     size_t count;
     krb5_preauthtype *newptr;
 
@@ -580,7 +580,7 @@ process_pa_data(krb5_context context, krb5_init_creds_context ctx,
                 krb5_pa_data ***out_pa_list, int *out_pa_list_size,
                 krb5_preauthtype *out_type)
 {
-    struct krb5_preauth_context_st *pctx = context->preauth_context;
+    krb5_preauth_context pctx = context->preauth_context;
     struct errinfo save = EMPTY_ERRINFO;
     krb5_pa_data *pa, **pa_ptr, **mod_pa;
     krb5_error_code ret = 0;
@@ -858,7 +858,7 @@ krb5_error_code
 k5_preauth_tryagain(krb5_context context, krb5_init_creds_context ctx,
                     krb5_pa_data **in_padata, krb5_pa_data ***padata_out)
 {
-    struct krb5_preauth_context_st *pctx = context->preauth_context;
+    krb5_preauth_context pctx = context->preauth_context;
     krb5_error_code ret;
     krb5_pa_data **mod_pa;
     clpreauth_handle h;
@@ -897,7 +897,7 @@ static krb5_error_code
 fill_response_items(krb5_context context, krb5_init_creds_context ctx,
                     krb5_pa_data **in_padata)
 {
-    struct krb5_preauth_context_st *pctx = context->preauth_context;
+    krb5_preauth_context pctx = context->preauth_context;
     krb5_error_code ret;
     krb5_pa_data *pa;
     clpreauth_handle h;
@@ -1004,7 +1004,7 @@ krb5_preauth_supply_preauth_data(krb5_context context,
                                  krb5_get_init_creds_opt *opt,
                                  const char *attr, const char *value)
 {
-    struct krb5_preauth_context_st *pctx = context->preauth_context;
+    krb5_preauth_context pctx = context->preauth_context;
     clpreauth_handle *hp, h;
     krb5_error_code ret;
 


More information about the cvs-krb5 mailing list