xref: /titanic_41/usr/src/lib/gss_mechs/mech_krb5/mech/rel_buffer.c (revision ba7b222e36bac28710a7f43739283302b617e7f5)
1 /*
2  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 /*
6  * Copyright 1996 by Sun Microsystems, Inc.
7  *
8  * Permission to use, copy, modify, distribute, and sell this software
9  * and its documentation for any purpose is hereby granted without fee,
10  * provided that the above copyright notice appears in all copies and
11  * that both that copyright notice and this permission notice appear in
12  * supporting documentation, and that the name of Sun Microsystems not be used
13  * in advertising or publicity pertaining to distribution of the software
14  * without specific, written prior permission. Sun Microsystems makes no
15  * representations about the suitability of this software for any
16  * purpose.  It is provided "as is" without express or implied warranty.
17  *
18  * SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
19  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
20  * EVENT SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
21  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
22  * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
23  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
24  * PERFORMANCE OF THIS SOFTWARE.
25  */
26 
27 /*
28  *  glue routine for gss_release_buffer
29  */
30 
31 /* SUNW17PACresync - gssapi.h allows us to build in libgss also */
32 #include "gssapi.h"
33 
34 #include <stdio.h>
35 #ifdef HAVE_STDLIB_H
36 #include <stdlib.h>
37 #endif
38 
39 OM_uint32
generic_gss_release_buffer(minor_status,buffer)40 generic_gss_release_buffer (minor_status,
41 			    buffer)
42      OM_uint32 *		minor_status;
43      gss_buffer_t		buffer;
44 {
45     if (minor_status)
46 	*minor_status = 0;
47 
48     /* if buffer is NULL, return */
49 
50     if (buffer == GSS_C_NO_BUFFER)
51 	return(GSS_S_COMPLETE);
52 
53     if (buffer->value) {
54 	free(buffer->value);
55 	buffer->length = 0;
56 	buffer->value = NULL;
57     }
58 
59     return (GSS_S_COMPLETE);
60 }
61