diff options
Diffstat (limited to 'usr/src/lib/libgss/g_dsp_name.c')
| -rw-r--r-- | usr/src/lib/libgss/g_dsp_name.c | 60 |
1 files changed, 42 insertions, 18 deletions
diff --git a/usr/src/lib/libgss/g_dsp_name.c b/usr/src/lib/libgss/g_dsp_name.c index b027ff466f..471bf38e24 100644 --- a/usr/src/lib/libgss/g_dsp_name.c +++ b/usr/src/lib/libgss/g_dsp_name.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,12 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * glue routine for gss_display_name() * @@ -38,6 +35,41 @@ #endif #include <string.h> +static OM_uint32 +val_dsp_name_args( + OM_uint32 *minor_status, + gss_name_t input_name, + gss_buffer_t output_name_buffer, + gss_OID *output_name_type) +{ + + /* Initialize outputs. */ + + if (minor_status != NULL) + *minor_status = 0; + + if (output_name_buffer != GSS_C_NO_BUFFER) { + output_name_buffer->length = 0; + output_name_buffer->value = NULL; + } + + if (output_name_type != NULL) + *output_name_type = GSS_C_NO_OID; + + /* Validate arguments. */ + + if (minor_status == NULL) + return (GSS_S_CALL_INACCESSIBLE_WRITE); + + if (output_name_buffer == GSS_C_NO_BUFFER) + return (GSS_S_CALL_INACCESSIBLE_WRITE); + + if (input_name == GSS_C_NO_NAME) + return (GSS_S_CALL_INACCESSIBLE_READ | GSS_S_BAD_NAME); + + return (GSS_S_COMPLETE); +} + OM_uint32 gss_display_name(minor_status, input_name, @@ -53,18 +85,10 @@ gss_OID * output_name_type; OM_uint32 major_status; gss_union_name_t union_name; - if (minor_status == NULL) - return (GSS_S_CALL_INACCESSIBLE_WRITE); - *minor_status = 0; - - if (input_name == 0) - return (GSS_S_CALL_INACCESSIBLE_READ | GSS_S_BAD_NAME); - - if (output_name_buffer == NULL) - return (GSS_S_CALL_INACCESSIBLE_WRITE); - - if (output_name_type) - *output_name_type = NULL; + major_status = val_dsp_name_args(minor_status, input_name, + output_name_buffer, output_name_type); + if (major_status != GSS_S_COMPLETE) + return (major_status); union_name = (gss_union_name_t)input_name; |
