static SECURITY_STATUS SEC_ENTRY kerberos_FreeCredentialsHandle(PCredHandle phCredential)
{
#ifdef WITH_GSSAPI
	KRB_CREDENTIALS* credentials;
	krb5_context ctx;

	credentials = sspi_SecureHandleGetLowerPointer(phCredential);
	if (!credentials)
		return SEC_E_INVALID_HANDLE;

	if (krb5_init_context(&ctx))
		return SEC_E_INTERNAL_ERROR;

	free(credentials->kdc_url);

	if (credentials->ccache)
		krb5_cc_close(ctx, credentials->ccache);
	if (credentials->keytab)
		krb5_kt_close(ctx, credentials->keytab);

	krb5_free_context(ctx);

	free(credentials);

	sspi_SecureHandleInvalidate(phCredential);
	return SEC_E_OK;
#else
	return SEC_E_UNSUPPORTED_FUNCTION;
#endif
}
static SECURITY_STATUS SEC_ENTRY kerberos_FreeCredentialsHandle(PCredHandle phCredential)
{
#ifdef WITH_GSSAPI
	KRB_CREDENTIALS* credentials;
	krb5_context ctx;

	credentials = sspi_SecureHandleGetLowerPointer(phCredential);
	if (!credentials)
		return SEC_E_INVALID_HANDLE;

	if (krb5_init_context(&ctx))
		return SEC_E_INTERNAL_ERROR;

	free(credentials->kdc_url);

	if (credentials->ccache)
		krb5_cc_close(ctx, credentials->ccache);
	if (credentials->keytab)
		krb5_kt_close(ctx, credentials->keytab);

	krb5_free_context(ctx);

	free(credentials);

	sspi_SecureHandleInvalidate(phCredential);
	return SEC_E_OK;
#else
	return SEC_E_UNSUPPORTED_FUNCTION;
#endif
}