gss: merge enhanced Apple mechglue logging

Add _gss_mg_log() and friends for logging from within the mechanism glue and
SPNEGO. These APIs wrap around the libkrb5 logging APIs.
This commit is contained in:
Luke Howard
2019-12-28 16:45:47 +11:00
parent 31af9ba703
commit 6af3ea9099
13 changed files with 315 additions and 15 deletions

View File

@@ -66,6 +66,9 @@ gss_export_cred(OM_uint32 * minor_status,
HEIM_TAILQ_FOREACH(mc, &cred->gc_mc, gmc_link) {
if (mc->gmc_mech->gm_export_cred == NULL) {
*minor_status = 0;
gss_mg_set_error_string(&mc->gmc_mech->gm_mech_oid,
GSS_S_NO_CRED, *minor_status,
"Credential doesn't support exporting");
return GSS_S_NO_CRED;
}
}
@@ -77,7 +80,6 @@ gss_export_cred(OM_uint32 * minor_status,
}
HEIM_TAILQ_FOREACH(mc, &cred->gc_mc, gmc_link) {
major = mc->gmc_mech->gm_export_cred(minor_status,
mc->gmc_cred, &buffer);
if (major) {
@@ -85,12 +87,14 @@ gss_export_cred(OM_uint32 * minor_status,
return major;
}
bytes = krb5_storage_write(sp, buffer.value, buffer.length);
if (bytes < 0 || (size_t)bytes != buffer.length) {
gss_release_buffer(minor_status, &buffer);
krb5_storage_free(sp);
*minor_status = EINVAL;
return GSS_S_FAILURE;
if (buffer.length) {
bytes = krb5_storage_write(sp, buffer.value, buffer.length);
if (bytes < 0 || (size_t)bytes != buffer.length) {
gss_release_buffer(minor_status, &buffer);
krb5_storage_free(sp);
*minor_status = EINVAL;
return GSS_S_FAILURE;
}
}
gss_release_buffer(minor_status, &buffer);
}
@@ -102,6 +106,14 @@ gss_export_cred(OM_uint32 * minor_status,
return GSS_S_FAILURE;
}
if (data.length == 0) {
*minor_status = 0;
gss_mg_set_error_string(GSS_C_NO_OID,
GSS_S_NO_CRED, *minor_status,
"Credential was not exportable");
return GSS_S_NO_CRED;
}
token->value = data.data;
token->length = data.length;