From 8b720c6a96ea21572adb9b73d23e7e8e99489bb9 Mon Sep 17 00:00:00 2001 From: Greg Hudson Date: Wed, 6 Apr 2011 20:06:50 +0000 Subject: [PATCH] Allow anonymous name to be imported with empty name buffer When importing a name of type GSS_C_NT_ANONYMOUS, allow the input name buffer to be null or empty (null is translated into empty before mechanisms see it). From r24820 in users/lhoward/moonshot-mechglue-fixes. ticket: 6896 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@24852 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/gssapi/mechglue/g_imp_name.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/lib/gssapi/mechglue/g_imp_name.c b/src/lib/gssapi/mechglue/g_imp_name.c index e5179e7c9..7afa188e5 100644 --- a/src/lib/gssapi/mechglue/g_imp_name.c +++ b/src/lib/gssapi/mechglue/g_imp_name.c @@ -65,15 +65,19 @@ val_imp_name_args( if (input_name_buffer == GSS_C_NO_BUFFER) return (GSS_S_CALL_INACCESSIBLE_READ | GSS_S_BAD_NAME); - if (input_name_buffer->length == 0) - return GSS_S_BAD_NAME; + if (input_name_type == GSS_C_NO_OID || + !g_OID_equal(input_name_type, GSS_C_NT_ANONYMOUS)) { + if (input_name_buffer->length == 0) + return (GSS_S_BAD_NAME); - if (input_name_buffer->value == NULL) - return (GSS_S_CALL_INACCESSIBLE_READ | GSS_S_BAD_NAME); + if (input_name_buffer->value == NULL) + return (GSS_S_CALL_INACCESSIBLE_READ | GSS_S_BAD_NAME); + } return (GSS_S_COMPLETE); } +static gss_buffer_desc emptyNameBuffer; OM_uint32 KRB5_CALLCONV gss_import_name(minor_status, @@ -90,6 +94,9 @@ gss_name_t * output_name; gss_union_name_t union_name; OM_uint32 tmp, major_status = GSS_S_FAILURE; + if (input_name_buffer == GSS_C_NO_BUFFER) + input_name_buffer = &emptyNameBuffer; + major_status = val_imp_name_args(minor_status, input_name_buffer, input_name_type, output_name); -- 2.26.2