diff options
author | Ken Raeburn <raeburn@mit.edu> | 2004-03-21 02:09:21 +0000 |
---|---|---|
committer | Ken Raeburn <raeburn@mit.edu> | 2004-03-21 02:09:21 +0000 |
commit | 45e076609c6ac5e59e6ad26736f807cff3e27513 (patch) | |
tree | 28f56a5229ac4177e1f5ef0894be7fc919365b39 | |
parent | 115c489c9af46ade474b7653f2a4a6131b38da83 (diff) | |
download | krb5-45e076609c6ac5e59e6ad26736f807cff3e27513.zip krb5-45e076609c6ac5e59e6ad26736f807cff3e27513.tar.gz krb5-45e076609c6ac5e59e6ad26736f807cff3e27513.tar.bz2 |
* 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
-rw-r--r-- | src/lib/gssapi/krb5/ChangeLog | 7 | ||||
-rw-r--r-- | src/lib/gssapi/krb5/rel_cred.c | 10 | ||||
-rw-r--r-- | src/lib/gssapi/krb5/rel_name.c | 12 | ||||
-rw-r--r-- | src/lib/gssapi/krb5/val_cred.c | 13 |
4 files changed, 34 insertions, 8 deletions
diff --git a/src/lib/gssapi/krb5/ChangeLog b/src/lib/gssapi/krb5/ChangeLog index 08d2417..40c7c6c 100644 --- a/src/lib/gssapi/krb5/ChangeLog +++ b/src/lib/gssapi/krb5/ChangeLog @@ -1,3 +1,10 @@ +2004-03-20 Ken Raeburn <raeburn@mit.edu> + + * 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 <raeburn@mit.edu> * 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 43d5ca1..fd8bb89 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 56f56d0..961ccb2 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 aea1765..fef8480 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; } |