From: Ken Raeburn Date: Sun, 21 Mar 2004 02:09:21 +0000 (+0000) Subject: * rel_cred.c (krb5_gss_release_cred): Create and destroy a local krb5 context. X-Git-Tag: krb5-1.4-beta1~525 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=45e076609c6ac5e59e6ad26736f807cff3e27513;p=krb5.git * rel_cred.c (krb5_gss_release_cred): Create and destroy a local krb5 context. * rel_name.c (krb5_gss_release_name): Likewise. * val_cred.c (krb5_gss_validate_cred): Likewise. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16196 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/gssapi/krb5/ChangeLog b/src/lib/gssapi/krb5/ChangeLog index 08d2417bc..40c7c6c09 100644 --- a/src/lib/gssapi/krb5/ChangeLog +++ b/src/lib/gssapi/krb5/ChangeLog @@ -1,3 +1,10 @@ +2004-03-20 Ken Raeburn + + * rel_cred.c (krb5_gss_release_cred): Create and destroy a local + krb5 context. + * rel_name.c (krb5_gss_release_name): Likewise. + * val_cred.c (krb5_gss_validate_cred): Likewise. + 2004-03-19 Ken Raeburn * add_cred.c (krb5_gss_add_cred): Create and destroy a local krb5 diff --git a/src/lib/gssapi/krb5/rel_cred.c b/src/lib/gssapi/krb5/rel_cred.c index 43d5ca1c2..fd8bb8945 100644 --- a/src/lib/gssapi/krb5/rel_cred.c +++ b/src/lib/gssapi/krb5/rel_cred.c @@ -31,16 +31,21 @@ krb5_gss_release_cred(minor_status, cred_handle) krb5_gss_cred_id_t cred; krb5_error_code code1, code2, code3; - if (GSS_ERROR(kg_get_context(minor_status, &context))) - return(GSS_S_FAILURE); + code1 = krb5_init_context(&context); + if (code1) { + *minor_status = code1; + return GSS_S_FAILURE; + } if (*cred_handle == GSS_C_NO_CREDENTIAL) { *minor_status = 0; + krb5_free_context(context); return(GSS_S_COMPLETE); } if (! kg_delete_cred_id(*cred_handle)) { *minor_status = (OM_uint32) G_VALIDATE_FAILED; + krb5_free_context(context); return(GSS_S_CALL_BAD_STRUCTURE|GSS_S_NO_CRED); } @@ -63,6 +68,7 @@ krb5_gss_release_cred(minor_status, cred_handle) if (cred->princ) krb5_free_principal(context, cred->princ); xfree(cred); + krb5_free_context(context); *cred_handle = NULL; diff --git a/src/lib/gssapi/krb5/rel_name.c b/src/lib/gssapi/krb5/rel_name.c index 56f56d060..961ccb29c 100644 --- a/src/lib/gssapi/krb5/rel_name.c +++ b/src/lib/gssapi/krb5/rel_name.c @@ -28,18 +28,24 @@ krb5_gss_release_name(minor_status, input_name) gss_name_t *input_name; { krb5_context context; - - if (GSS_ERROR(kg_get_context(minor_status, &context))) - return(GSS_S_FAILURE); + krb5_error_code code; + + code = krb5_init_context(&context); + if (code) { + *minor_status = code; + return GSS_S_FAILURE; + } if (! kg_validate_name(*input_name)) { *minor_status = (OM_uint32) G_VALIDATE_FAILED; + krb5_free_context(context); return(GSS_S_CALL_BAD_STRUCTURE|GSS_S_BAD_NAME); } (void)kg_delete_name(*input_name); krb5_free_principal(context, (krb5_principal) *input_name); + krb5_free_context(context); *input_name = (gss_name_t) NULL; diff --git a/src/lib/gssapi/krb5/val_cred.c b/src/lib/gssapi/krb5/val_cred.c index aea1765bc..fef848044 100644 --- a/src/lib/gssapi/krb5/val_cred.c +++ b/src/lib/gssapi/krb5/val_cred.c @@ -40,27 +40,34 @@ krb5_gss_validate_cred(minor_status, cred_handle) krb5_error_code code; krb5_principal princ; - if (GSS_ERROR(kg_get_context(minor_status, &context))) - return(GSS_S_FAILURE); + code = krb5_init_context(&context); + if (code) { + *minor_status = code; + return GSS_S_FAILURE; + } if (!kg_validate_cred_id(cred_handle)) { *minor_status = (OM_uint32) G_VALIDATE_FAILED; + krb5_free_context(context); return(GSS_S_CALL_BAD_STRUCTURE|GSS_S_DEFECTIVE_CREDENTIAL); } cred = (krb5_gss_cred_id_t) cred_handle; - + if (cred->ccache) { if ((code = krb5_cc_get_principal(context, cred->ccache, &princ))) { *minor_status = code; + krb5_free_context(context); return(GSS_S_DEFECTIVE_CREDENTIAL); } if (!krb5_principal_compare(context, princ, cred->princ)) { *minor_status = KG_CCACHE_NOMATCH; + krb5_free_context(context); return(GSS_S_DEFECTIVE_CREDENTIAL); } (void)krb5_free_principal(context, princ); } + krb5_free_context(context); *minor_status = 0; return GSS_S_COMPLETE; }