xref: /onnv-gate/usr/src/lib/gss_mechs/mech_krb5/mech/rel_buffer.c (revision 10598:6f30db2c2cd0)
1*10598SGlenn.Barry@Sun.COM /*
2*10598SGlenn.Barry@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
3*10598SGlenn.Barry@Sun.COM  * Use is subject to license terms.
4*10598SGlenn.Barry@Sun.COM  */
50Sstevel@tonic-gate /*
65053Sgtb  * Copyright 1996 by Sun Microsystems, Inc.
75053Sgtb  *
85053Sgtb  * Permission to use, copy, modify, distribute, and sell this software
95053Sgtb  * and its documentation for any purpose is hereby granted without fee,
105053Sgtb  * provided that the above copyright notice appears in all copies and
115053Sgtb  * that both that copyright notice and this permission notice appear in
125053Sgtb  * supporting documentation, and that the name of Sun Microsystems not be used
135053Sgtb  * in advertising or publicity pertaining to distribution of the software
145053Sgtb  * without specific, written prior permission. Sun Microsystems makes no
155053Sgtb  * representations about the suitability of this software for any
165053Sgtb  * purpose.  It is provided "as is" without express or implied warranty.
175053Sgtb  *
185053Sgtb  * SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
195053Sgtb  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
205053Sgtb  * EVENT SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
215053Sgtb  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
225053Sgtb  * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
235053Sgtb  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
245053Sgtb  * PERFORMANCE OF THIS SOFTWARE.
250Sstevel@tonic-gate  */
260Sstevel@tonic-gate 
270Sstevel@tonic-gate /*
280Sstevel@tonic-gate  *  glue routine for gss_release_buffer
290Sstevel@tonic-gate  */
300Sstevel@tonic-gate 
31*10598SGlenn.Barry@Sun.COM /* SUNW17PACresync - gssapi.h allows us to build in libgss also */
32*10598SGlenn.Barry@Sun.COM #include "gssapi.h"
330Sstevel@tonic-gate 
340Sstevel@tonic-gate #include <stdio.h>
350Sstevel@tonic-gate #ifdef HAVE_STDLIB_H
360Sstevel@tonic-gate #include <stdlib.h>
370Sstevel@tonic-gate #endif
380Sstevel@tonic-gate 
390Sstevel@tonic-gate OM_uint32
generic_gss_release_buffer(minor_status,buffer)400Sstevel@tonic-gate generic_gss_release_buffer (minor_status,
410Sstevel@tonic-gate 			    buffer)
420Sstevel@tonic-gate      OM_uint32 *		minor_status;
430Sstevel@tonic-gate      gss_buffer_t		buffer;
440Sstevel@tonic-gate {
450Sstevel@tonic-gate     if (minor_status)
460Sstevel@tonic-gate 	*minor_status = 0;
470Sstevel@tonic-gate 
480Sstevel@tonic-gate     /* if buffer is NULL, return */
490Sstevel@tonic-gate 
500Sstevel@tonic-gate     if (buffer == GSS_C_NO_BUFFER)
510Sstevel@tonic-gate 	return(GSS_S_COMPLETE);
520Sstevel@tonic-gate 
535053Sgtb     if (buffer->value) {
540Sstevel@tonic-gate 	free(buffer->value);
550Sstevel@tonic-gate 	buffer->length = 0;
560Sstevel@tonic-gate 	buffer->value = NULL;
570Sstevel@tonic-gate     }
580Sstevel@tonic-gate 
590Sstevel@tonic-gate     return (GSS_S_COMPLETE);
600Sstevel@tonic-gate }
61