1ba7b222eSGlenn Barry /*
2ba7b222eSGlenn Barry  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
3ba7b222eSGlenn Barry  * Use is subject to license terms.
4ba7b222eSGlenn Barry  */
57c478bd9Sstevel@tonic-gate /*
6ab9b2e15Sgtb  * Copyright 1996 by Sun Microsystems, Inc.
7*55fea89dSDan Cross  *
8ab9b2e15Sgtb  * Permission to use, copy, modify, distribute, and sell this software
9ab9b2e15Sgtb  * and its documentation for any purpose is hereby granted without fee,
10ab9b2e15Sgtb  * provided that the above copyright notice appears in all copies and
11ab9b2e15Sgtb  * that both that copyright notice and this permission notice appear in
12ab9b2e15Sgtb  * supporting documentation, and that the name of Sun Microsystems not be used
13ab9b2e15Sgtb  * in advertising or publicity pertaining to distribution of the software
14ab9b2e15Sgtb  * without specific, written prior permission. Sun Microsystems makes no
15ab9b2e15Sgtb  * representations about the suitability of this software for any
16ab9b2e15Sgtb  * purpose.  It is provided "as is" without express or implied warranty.
17*55fea89dSDan Cross  *
18ab9b2e15Sgtb  * SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
19ab9b2e15Sgtb  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
20ab9b2e15Sgtb  * EVENT SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
21ab9b2e15Sgtb  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
22ab9b2e15Sgtb  * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
23ab9b2e15Sgtb  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
24ab9b2e15Sgtb  * PERFORMANCE OF THIS SOFTWARE.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate /*
287c478bd9Sstevel@tonic-gate  *  glue routine for gss_release_buffer
297c478bd9Sstevel@tonic-gate  */
307c478bd9Sstevel@tonic-gate 
31ba7b222eSGlenn Barry /* SUNW17PACresync - gssapi.h allows us to build in libgss also */
32ba7b222eSGlenn Barry #include "gssapi.h"
337c478bd9Sstevel@tonic-gate 
347c478bd9Sstevel@tonic-gate #include <stdio.h>
357c478bd9Sstevel@tonic-gate #ifdef HAVE_STDLIB_H
367c478bd9Sstevel@tonic-gate #include <stdlib.h>
377c478bd9Sstevel@tonic-gate #endif
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate OM_uint32
generic_gss_release_buffer(minor_status,buffer)407c478bd9Sstevel@tonic-gate generic_gss_release_buffer (minor_status,
417c478bd9Sstevel@tonic-gate 			    buffer)
427c478bd9Sstevel@tonic-gate      OM_uint32 *		minor_status;
437c478bd9Sstevel@tonic-gate      gss_buffer_t		buffer;
447c478bd9Sstevel@tonic-gate {
457c478bd9Sstevel@tonic-gate     if (minor_status)
467c478bd9Sstevel@tonic-gate 	*minor_status = 0;
477c478bd9Sstevel@tonic-gate 
487c478bd9Sstevel@tonic-gate     /* if buffer is NULL, return */
497c478bd9Sstevel@tonic-gate 
507c478bd9Sstevel@tonic-gate     if (buffer == GSS_C_NO_BUFFER)
517c478bd9Sstevel@tonic-gate 	return(GSS_S_COMPLETE);
527c478bd9Sstevel@tonic-gate 
53ab9b2e15Sgtb     if (buffer->value) {
547c478bd9Sstevel@tonic-gate 	free(buffer->value);
557c478bd9Sstevel@tonic-gate 	buffer->length = 0;
567c478bd9Sstevel@tonic-gate 	buffer->value = NULL;
577c478bd9Sstevel@tonic-gate     }
587c478bd9Sstevel@tonic-gate 
597c478bd9Sstevel@tonic-gate     return (GSS_S_COMPLETE);
607c478bd9Sstevel@tonic-gate }
61