gssapi: import mechglue allocation utility functions from Heimdal-520

Apple's Heimdal impelmentation uses a number of utility functions for
allocating names and credentials, to avoid calling malloc or calloc directly.
Import them.
This commit is contained in:
Luke Howard
2019-01-03 10:17:26 +11:00
committed by Nico Williams
parent e0bb9c10ca
commit 83f15553e0
22 changed files with 163 additions and 86 deletions

View File

@@ -54,18 +54,11 @@ GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL
gss_release_cred(OM_uint32 *minor_status, gss_cred_id_t *cred_handle)
{
struct _gss_cred *cred = (struct _gss_cred *) *cred_handle;
struct _gss_mechanism_cred *mc;
if (*cred_handle == GSS_C_NO_CREDENTIAL)
if (cred == NULL)
return (GSS_S_COMPLETE);
while (HEIM_SLIST_FIRST(&cred->gc_mc)) {
mc = HEIM_SLIST_FIRST(&cred->gc_mc);
HEIM_SLIST_REMOVE_HEAD(&cred->gc_mc, gmc_link);
mc->gmc_mech->gm_release_cred(minor_status, &mc->gmc_cred);
free(mc);
}
free(cred);
_gss_mg_release_cred(cred);
*minor_status = 0;
*cred_handle = GSS_C_NO_CREDENTIAL;