gssapi: import bugfixes from Apple Heimdal-520

* check `ctx->gc_ctx` in `gss_inquire_context()`
* check `gm_inquire_cred != NULL` in `gss_inquire_context()`
* check `min_lifetime` in `gss_inquire_cred()`
* check `gm_inquire_cred_by_mech != NULL` in `gss_inquire_cred_by_mech()`
* set mech error in `gss_inquire_cred_by_oid()`
* don't clobber error in `gss_inquire_cred_by_oid()`
* don't pass NULL minor_status to `gss_krb5_free_lucid_sec_context()`
* allow NULL ccache in `gss_krb5_ccache_name()`
* NULL names OK in `_gss_find_mn()`
* allow empty names in `gss_import_name()` (removes `input_name_buffer` length
  check). to support ANONYMOUS.  in `gss_import_name()`, ignore mech name
  import failure as long as it's possible to import the name in some other
  mechanism
* better argument validation in `gss_export_sec_context()`
* in `gss_compare_name()`, check `mn2 != NULL`
* check `gss_add_oid_set_member()` return code in `gss_indicate_mechs()`
* in `gss_destroy_cred()`, set output cred handle to `GSS_C_NO_CREDENTIAL`
* cast size_t to OM_uint32 where required
This commit is contained in:
Luke Howard
2019-01-03 09:06:46 +11:00
parent 29fe69f95f
commit ad426d0385
13 changed files with 98 additions and 26 deletions

View File

@@ -390,8 +390,9 @@ out:
krb5_free_context(context);
if (ret) {
OM_uint32 junk;
if (ctx)
gss_krb5_free_lucid_sec_context(NULL, ctx);
gss_krb5_free_lucid_sec_context(&junk, ctx);
*minor_status = ret;
return GSS_S_FAILURE;
@@ -527,8 +528,12 @@ gss_krb5_ccache_name(OM_uint32 *minor_status,
if (out_name)
*out_name = NULL;
buffer.value = rk_UNCONST(name);
buffer.length = strlen(name);
if (name) {
buffer.value = rk_UNCONST(name);
buffer.length = strlen(name);
} else {
_mg_buffer_zero(&buffer);
}
HEIM_SLIST_FOREACH(m, &_gss_mechs, gm_link) {
if (m->gm_mech.gm_set_sec_context_option == NULL)
@@ -642,7 +647,7 @@ gsskrb5_extract_authz_data_from_sec_context(OM_uint32 *minor_status,
oid.components[oid.length - 1] = ad_type;
oid_flat.length = der_length_oid(&oid);
oid_flat.length = (OM_uint32)der_length_oid(&oid);
oid_flat.elements = malloc(oid_flat.length);
if (oid_flat.elements == NULL) {
free(oid.components);