From ad2a35260060d5a03bcd992904a4208cccaad27f Mon Sep 17 00:00:00 2001 From: Luke Howard Date: Sun, 12 Jul 2020 15:55:02 +1000 Subject: [PATCH] gssapi/krb5: treat empty padding buffers as absent For compatibility with SSPI, treat an empty padding buffer as equivalent to an absent padding buffer (unelss the caller is requesting allocation). --- lib/gssapi/krb5/cfx.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/gssapi/krb5/cfx.c b/lib/gssapi/krb5/cfx.c index 72a5bba43..8d806f9fb 100644 --- a/lib/gssapi/krb5/cfx.c +++ b/lib/gssapi/krb5/cfx.c @@ -224,6 +224,17 @@ _gk_find_buffer(gss_iov_buffer_desc *iov, int iov_count, OM_uint32 type) } } + /* + * For compatibility with SSPI, an empty padding buffer is treated + * equivalent to an absent padding buffer (unless the caller is + * requesting that a padding buffer be allocated). + */ + if (iovp && + iovp->buffer.length == 0 && + type == GSS_IOV_BUFFER_TYPE_PADDING && + (GSS_IOV_BUFFER_FLAGS(iovp->type) & GSS_IOV_BUFFER_FLAG_ALLOCATE) == 0) + iovp = NULL; + return iovp; }