diff options
author | Peter Shoults <Peter.Shoults@Sun.COM> | 2009-05-22 10:09:37 -0400 |
---|---|---|
committer | Peter Shoults <Peter.Shoults@Sun.COM> | 2009-05-22 10:09:37 -0400 |
commit | 503a2b89eaf04b96af9e457a7806f65ce3e0b723 (patch) | |
tree | 84074541784934c8ef72a0e2709bd6080710e9ee /usr/src/lib/libgss/g_delete_sec_context.c | |
parent | 97ed649eea0490aaae8e85481e0f9c636bda74a5 (diff) | |
download | illumos-gate-503a2b89eaf04b96af9e457a7806f65ce3e0b723.tar.gz |
6510866 libgss(3LIB) input checking needs to be improved
Diffstat (limited to 'usr/src/lib/libgss/g_delete_sec_context.c')
-rw-r--r-- | usr/src/lib/libgss/g_delete_sec_context.c | 50 |
1 files changed, 37 insertions, 13 deletions
diff --git a/usr/src/lib/libgss/g_delete_sec_context.c b/usr/src/lib/libgss/g_delete_sec_context.c index bb089c08cf..149062a941 100644 --- a/usr/src/lib/libgss/g_delete_sec_context.c +++ b/usr/src/lib/libgss/g_delete_sec_context.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 (c) 1996,1997, by 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_delete_sec_context */ @@ -36,6 +33,34 @@ #include <stdlib.h> #endif +static OM_uint32 +val_del_sec_ctx_args( + OM_uint32 *minor_status, + gss_ctx_id_t *context_handle, + gss_buffer_t output_token) +{ + + /* Initialize outputs. */ + + if (minor_status != NULL) + *minor_status = 0; + + if (output_token != GSS_C_NO_BUFFER) { + output_token->length = 0; + output_token->value = NULL; + } + + /* Validate arguments. */ + + if (minor_status == NULL) + return (GSS_S_CALL_INACCESSIBLE_WRITE); + + if (context_handle == NULL || *context_handle == GSS_C_NO_CONTEXT) + return (GSS_S_CALL_INACCESSIBLE_WRITE | GSS_S_NO_CONTEXT); + + return (GSS_S_COMPLETE); +} + OM_uint32 gss_delete_sec_context(minor_status, context_handle, @@ -50,12 +75,11 @@ gss_buffer_t output_token; gss_union_ctx_id_t ctx; gss_mechanism mech; - if (minor_status == NULL) - return (GSS_S_CALL_INACCESSIBLE_WRITE); - - /* if the context_handle is Null, return NO_CONTEXT error */ - if (context_handle == NULL || *context_handle == GSS_C_NO_CONTEXT) - return (GSS_S_CALL_INACCESSIBLE_READ | GSS_S_NO_CONTEXT); + status = val_del_sec_ctx_args(minor_status, + context_handle, + output_token); + if (status != GSS_S_COMPLETE) + return (status); /* * select the approprate underlying mechanism routine and |