17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate * CDDL HEADER START
37c478bd9Sstevel@tonic-gate *
47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate * with the License.
87c478bd9Sstevel@tonic-gate *
97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate * and limitations under the License.
137c478bd9Sstevel@tonic-gate *
147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate *
207c478bd9Sstevel@tonic-gate * CDDL HEADER END
217c478bd9Sstevel@tonic-gate */
227c478bd9Sstevel@tonic-gate /*
237c478bd9Sstevel@tonic-gate * Copyright 1996,1997,1999,2002-2003 Sun Microsystems, Inc.
247c478bd9Sstevel@tonic-gate * All rights reserved. Use is subject to license terms.
257c478bd9Sstevel@tonic-gate */
267c478bd9Sstevel@tonic-gate
277c478bd9Sstevel@tonic-gate /*
287c478bd9Sstevel@tonic-gate * Copyright 1993 OpenVision Technologies, Inc., All Rights Reserved.
297c478bd9Sstevel@tonic-gate *
307c478bd9Sstevel@tonic-gate * $Header:
317c478bd9Sstevel@tonic-gate * /afs/gza.com/product/secure/rel-eng/src/1.1/rpc/RCS/auth_gssapi_misc.c,v 1.10
327c478bd9Sstevel@tonic-gate * 1994/10/27 12:39:23 jik Exp $
337c478bd9Sstevel@tonic-gate */
347c478bd9Sstevel@tonic-gate
35*e36d7b11SSebastien Roy /*
36*e36d7b11SSebastien Roy * Copyright (c) 2013 by Delphix. All rights reserved.
37*e36d7b11SSebastien Roy */
38*e36d7b11SSebastien Roy
397c478bd9Sstevel@tonic-gate #include <sys/param.h>
407c478bd9Sstevel@tonic-gate #include <sys/types.h>
417c478bd9Sstevel@tonic-gate #include <sys/stream.h>
427c478bd9Sstevel@tonic-gate #include <sys/strsubr.h>
437c478bd9Sstevel@tonic-gate #include <sys/cmn_err.h>
447c478bd9Sstevel@tonic-gate #include <gssapi/gssapi.h>
457c478bd9Sstevel@tonic-gate #include <rpc/rpc.h>
467c478bd9Sstevel@tonic-gate #include <rpc/rpcsec_defs.h>
477c478bd9Sstevel@tonic-gate
487c478bd9Sstevel@tonic-gate /*
497c478bd9Sstevel@tonic-gate * The initial allocation size for dynamic allocation.
507c478bd9Sstevel@tonic-gate */
517c478bd9Sstevel@tonic-gate #define CKU_INITSIZE 2048
527c478bd9Sstevel@tonic-gate
537c478bd9Sstevel@tonic-gate /*
547c478bd9Sstevel@tonic-gate * The size of additional allocations, if required. It is larger to
557c478bd9Sstevel@tonic-gate * reduce the number of actual allocations.
567c478bd9Sstevel@tonic-gate */
577c478bd9Sstevel@tonic-gate #define CKU_ALLOCSIZE 8192
587c478bd9Sstevel@tonic-gate
597c478bd9Sstevel@tonic-gate
607c478bd9Sstevel@tonic-gate /*
617c478bd9Sstevel@tonic-gate * Miscellaneous XDR routines.
627c478bd9Sstevel@tonic-gate */
637c478bd9Sstevel@tonic-gate bool_t
__xdr_gss_buf(xdrs,buf)647c478bd9Sstevel@tonic-gate __xdr_gss_buf(xdrs, buf)
657c478bd9Sstevel@tonic-gate XDR *xdrs;
667c478bd9Sstevel@tonic-gate gss_buffer_t buf;
677c478bd9Sstevel@tonic-gate {
687c478bd9Sstevel@tonic-gate uint_t cast_len, bound_len;
697c478bd9Sstevel@tonic-gate
707c478bd9Sstevel@tonic-gate /*
717c478bd9Sstevel@tonic-gate * We go through this contortion because size_t is a now a ulong,
727c478bd9Sstevel@tonic-gate * GSS-API uses ulongs.
737c478bd9Sstevel@tonic-gate */
747c478bd9Sstevel@tonic-gate
757c478bd9Sstevel@tonic-gate if (xdrs->x_op != XDR_DECODE) {
767c478bd9Sstevel@tonic-gate bound_len = cast_len = (uint_t)buf->length;
777c478bd9Sstevel@tonic-gate } else {
787c478bd9Sstevel@tonic-gate bound_len = (uint_t)-1;
797c478bd9Sstevel@tonic-gate }
807c478bd9Sstevel@tonic-gate
817c478bd9Sstevel@tonic-gate if (xdr_bytes(xdrs, (char **)&buf->value, &cast_len,
827c478bd9Sstevel@tonic-gate bound_len) == TRUE) {
837c478bd9Sstevel@tonic-gate if (xdrs->x_op == XDR_DECODE)
847c478bd9Sstevel@tonic-gate buf->length = cast_len;
857c478bd9Sstevel@tonic-gate
867c478bd9Sstevel@tonic-gate return (TRUE);
877c478bd9Sstevel@tonic-gate }
887c478bd9Sstevel@tonic-gate
897c478bd9Sstevel@tonic-gate return (FALSE);
907c478bd9Sstevel@tonic-gate }
917c478bd9Sstevel@tonic-gate
927c478bd9Sstevel@tonic-gate bool_t
__xdr_rpc_gss_creds(xdrs,creds)937c478bd9Sstevel@tonic-gate __xdr_rpc_gss_creds(xdrs, creds)
947c478bd9Sstevel@tonic-gate XDR *xdrs;
957c478bd9Sstevel@tonic-gate rpc_gss_creds *creds;
967c478bd9Sstevel@tonic-gate {
977c478bd9Sstevel@tonic-gate if (!xdr_u_int(xdrs, (uint_t *)&creds->version) ||
987c478bd9Sstevel@tonic-gate !xdr_u_int(xdrs, (uint_t *)&creds->gss_proc) ||
997c478bd9Sstevel@tonic-gate !xdr_u_int(xdrs, (uint_t *)&creds->seq_num) ||
1007c478bd9Sstevel@tonic-gate !xdr_u_int(xdrs, (uint_t *)&creds->service) ||
1017c478bd9Sstevel@tonic-gate !__xdr_gss_buf(xdrs, &creds->ctx_handle))
1027c478bd9Sstevel@tonic-gate return (FALSE);
1037c478bd9Sstevel@tonic-gate return (TRUE);
1047c478bd9Sstevel@tonic-gate }
1057c478bd9Sstevel@tonic-gate
1067c478bd9Sstevel@tonic-gate bool_t
__xdr_rpc_gss_init_arg(xdrs,init_arg)1077c478bd9Sstevel@tonic-gate __xdr_rpc_gss_init_arg(xdrs, init_arg)
1087c478bd9Sstevel@tonic-gate XDR *xdrs;
1097c478bd9Sstevel@tonic-gate rpc_gss_init_arg *init_arg;
1107c478bd9Sstevel@tonic-gate {
1117c478bd9Sstevel@tonic-gate if (!__xdr_gss_buf(xdrs, init_arg))
1127c478bd9Sstevel@tonic-gate return (FALSE);
1137c478bd9Sstevel@tonic-gate return (TRUE);
1147c478bd9Sstevel@tonic-gate }
1157c478bd9Sstevel@tonic-gate
1167c478bd9Sstevel@tonic-gate bool_t
__xdr_rpc_gss_init_res(xdrs,init_res)1177c478bd9Sstevel@tonic-gate __xdr_rpc_gss_init_res(xdrs, init_res)
1187c478bd9Sstevel@tonic-gate XDR *xdrs;
1197c478bd9Sstevel@tonic-gate rpc_gss_init_res *init_res;
1207c478bd9Sstevel@tonic-gate {
1217c478bd9Sstevel@tonic-gate if (!__xdr_gss_buf(xdrs, &init_res->ctx_handle) ||
1227c478bd9Sstevel@tonic-gate !xdr_u_int(xdrs, (uint_t *)&init_res->gss_major) ||
1237c478bd9Sstevel@tonic-gate !xdr_u_int(xdrs, (uint_t *)&init_res->gss_minor) ||
1247c478bd9Sstevel@tonic-gate !xdr_u_int(xdrs, (uint_t *)&init_res->seq_window) ||
1257c478bd9Sstevel@tonic-gate !__xdr_gss_buf(xdrs, &init_res->token))
1267c478bd9Sstevel@tonic-gate return (FALSE);
1277c478bd9Sstevel@tonic-gate return (TRUE);
1287c478bd9Sstevel@tonic-gate }
1297c478bd9Sstevel@tonic-gate
1307c478bd9Sstevel@tonic-gate /*
1317c478bd9Sstevel@tonic-gate * Generic routine to wrap data used by client and server sides.
1327c478bd9Sstevel@tonic-gate */
1337c478bd9Sstevel@tonic-gate bool_t
__rpc_gss_wrap_data(service,qop,context,seq_num,out_xdrs,xdr_func,xdr_ptr)1347c478bd9Sstevel@tonic-gate __rpc_gss_wrap_data(service, qop, context, seq_num, out_xdrs,
1357c478bd9Sstevel@tonic-gate xdr_func, xdr_ptr)
1367c478bd9Sstevel@tonic-gate OM_uint32 qop;
1377c478bd9Sstevel@tonic-gate rpc_gss_service_t service;
1387c478bd9Sstevel@tonic-gate gss_ctx_id_t context;
1397c478bd9Sstevel@tonic-gate uint_t seq_num;
1407c478bd9Sstevel@tonic-gate XDR *out_xdrs;
1417c478bd9Sstevel@tonic-gate bool_t (*xdr_func)();
1427c478bd9Sstevel@tonic-gate caddr_t xdr_ptr;
1437c478bd9Sstevel@tonic-gate {
1447c478bd9Sstevel@tonic-gate OM_uint32 major, minor;
1457c478bd9Sstevel@tonic-gate gss_buffer_desc in_buf, out_buf;
1467c478bd9Sstevel@tonic-gate XDR temp_xdrs;
147*e36d7b11SSebastien Roy char *temp_data;
1487c478bd9Sstevel@tonic-gate bool_t conf_state;
1497c478bd9Sstevel@tonic-gate bool_t ret = FALSE;
1507c478bd9Sstevel@tonic-gate int size;
1517c478bd9Sstevel@tonic-gate
1527c478bd9Sstevel@tonic-gate /*
1537c478bd9Sstevel@tonic-gate * Create a temporary XDR/buffer to hold the data to be wrapped.
1547c478bd9Sstevel@tonic-gate * We need an extra bit for the sequence number serialized first.
1557c478bd9Sstevel@tonic-gate */
1567c478bd9Sstevel@tonic-gate size = xdr_sizeof(xdr_func, xdr_ptr) + BYTES_PER_XDR_UNIT;
157*e36d7b11SSebastien Roy temp_data = kmem_alloc(size, KM_SLEEP);
1587c478bd9Sstevel@tonic-gate out_buf.length = 0;
1597c478bd9Sstevel@tonic-gate
160*e36d7b11SSebastien Roy xdrmem_create(&temp_xdrs, temp_data, size, XDR_ENCODE);
1617c478bd9Sstevel@tonic-gate
1627c478bd9Sstevel@tonic-gate /*
1637c478bd9Sstevel@tonic-gate * serialize the sequence number into tmp memory
1647c478bd9Sstevel@tonic-gate */
1657c478bd9Sstevel@tonic-gate if (!xdr_u_int(&temp_xdrs, &seq_num))
1667c478bd9Sstevel@tonic-gate goto fail;
1677c478bd9Sstevel@tonic-gate
1687c478bd9Sstevel@tonic-gate /*
1697c478bd9Sstevel@tonic-gate * serialize the arguments into tmp memory
1707c478bd9Sstevel@tonic-gate */
1717c478bd9Sstevel@tonic-gate if (!(*xdr_func)(&temp_xdrs, xdr_ptr))
1727c478bd9Sstevel@tonic-gate goto fail;
1737c478bd9Sstevel@tonic-gate
1747c478bd9Sstevel@tonic-gate /*
1757c478bd9Sstevel@tonic-gate * Data to be wrapped goes in in_buf. If privacy is used,
1767c478bd9Sstevel@tonic-gate * out_buf will have wrapped data (in_buf will no longer be
1777c478bd9Sstevel@tonic-gate * needed). If integrity is used, out_buf will have checksum
1787c478bd9Sstevel@tonic-gate * which will follow the data in in_buf.
1797c478bd9Sstevel@tonic-gate */
1807c478bd9Sstevel@tonic-gate in_buf.length = xdr_getpos(&temp_xdrs);
1817c478bd9Sstevel@tonic-gate in_buf.value = (char *)temp_xdrs.x_base;
1827c478bd9Sstevel@tonic-gate
1837c478bd9Sstevel@tonic-gate switch (service) {
1847c478bd9Sstevel@tonic-gate case rpc_gss_svc_privacy:
1857c478bd9Sstevel@tonic-gate
1867c478bd9Sstevel@tonic-gate if ((major = kgss_seal(&minor, context, TRUE, qop, &in_buf,
1877c478bd9Sstevel@tonic-gate &conf_state, &out_buf)) != GSS_S_COMPLETE) {
1887c478bd9Sstevel@tonic-gate RPCGSS_LOG1(1, "rpc_gss_wrap: kgss_seal failed."
1897c478bd9Sstevel@tonic-gate "major = %x, minor = %x", major, minor);
1907c478bd9Sstevel@tonic-gate goto fail;
1917c478bd9Sstevel@tonic-gate }
1927c478bd9Sstevel@tonic-gate in_buf.length = 0; /* in_buf not needed */
1937c478bd9Sstevel@tonic-gate if (!conf_state)
1947c478bd9Sstevel@tonic-gate goto fail;
1957c478bd9Sstevel@tonic-gate break;
1967c478bd9Sstevel@tonic-gate case rpc_gss_svc_integrity:
1977c478bd9Sstevel@tonic-gate if ((major = kgss_sign(&minor, context, qop, &in_buf,
1987c478bd9Sstevel@tonic-gate &out_buf)) != GSS_S_COMPLETE) {
1997c478bd9Sstevel@tonic-gate RPCGSS_LOG1(1, "rpc_gss_wrap: kgss_sign failed."
2007c478bd9Sstevel@tonic-gate "major = %x, minor = %x", major, minor);
2017c478bd9Sstevel@tonic-gate goto fail;
2027c478bd9Sstevel@tonic-gate }
2037c478bd9Sstevel@tonic-gate break;
2047c478bd9Sstevel@tonic-gate default:
2057c478bd9Sstevel@tonic-gate goto fail;
2067c478bd9Sstevel@tonic-gate }
2077c478bd9Sstevel@tonic-gate
2087c478bd9Sstevel@tonic-gate /*
2097c478bd9Sstevel@tonic-gate * write out in_buf and out_buf as needed
2107c478bd9Sstevel@tonic-gate */
2117c478bd9Sstevel@tonic-gate if (in_buf.length != 0) {
2127c478bd9Sstevel@tonic-gate if (!__xdr_gss_buf(out_xdrs, &in_buf))
2137c478bd9Sstevel@tonic-gate goto fail;
2147c478bd9Sstevel@tonic-gate }
2157c478bd9Sstevel@tonic-gate
2167c478bd9Sstevel@tonic-gate if (!__xdr_gss_buf(out_xdrs, &out_buf))
2177c478bd9Sstevel@tonic-gate goto fail;
2187c478bd9Sstevel@tonic-gate ret = TRUE;
2197c478bd9Sstevel@tonic-gate fail:
220*e36d7b11SSebastien Roy kmem_free(temp_data, size);
2217c478bd9Sstevel@tonic-gate if (out_buf.length != 0)
2227c478bd9Sstevel@tonic-gate (void) gss_release_buffer(&minor, &out_buf);
2237c478bd9Sstevel@tonic-gate return (ret);
2247c478bd9Sstevel@tonic-gate }
2257c478bd9Sstevel@tonic-gate
2267c478bd9Sstevel@tonic-gate /*
2277c478bd9Sstevel@tonic-gate * Generic routine to unwrap data used by client and server sides.
2287c478bd9Sstevel@tonic-gate */
2297c478bd9Sstevel@tonic-gate bool_t
__rpc_gss_unwrap_data(service,context,seq_num,qop_check,in_xdrs,xdr_func,xdr_ptr)2307c478bd9Sstevel@tonic-gate __rpc_gss_unwrap_data(service, context, seq_num, qop_check, in_xdrs,
2317c478bd9Sstevel@tonic-gate xdr_func, xdr_ptr)
2327c478bd9Sstevel@tonic-gate rpc_gss_service_t service;
2337c478bd9Sstevel@tonic-gate gss_ctx_id_t context;
2347c478bd9Sstevel@tonic-gate uint_t seq_num;
2357c478bd9Sstevel@tonic-gate OM_uint32 qop_check;
2367c478bd9Sstevel@tonic-gate XDR *in_xdrs;
2377c478bd9Sstevel@tonic-gate bool_t (*xdr_func)();
2387c478bd9Sstevel@tonic-gate caddr_t xdr_ptr;
2397c478bd9Sstevel@tonic-gate {
2407c478bd9Sstevel@tonic-gate gss_buffer_desc in_buf, out_buf;
2417c478bd9Sstevel@tonic-gate XDR temp_xdrs;
2427c478bd9Sstevel@tonic-gate uint_t seq_num2;
2437c478bd9Sstevel@tonic-gate bool_t conf = FALSE;
2447c478bd9Sstevel@tonic-gate OM_uint32 major = GSS_S_COMPLETE, minor = 0;
2457c478bd9Sstevel@tonic-gate int qop = 0;
2467c478bd9Sstevel@tonic-gate
2477c478bd9Sstevel@tonic-gate in_buf.value = NULL;
2487c478bd9Sstevel@tonic-gate out_buf.value = NULL;
2497c478bd9Sstevel@tonic-gate
2507c478bd9Sstevel@tonic-gate /*
2517c478bd9Sstevel@tonic-gate * Pull out wrapped data. For privacy service, this is the
2527c478bd9Sstevel@tonic-gate * encrypted data. For integrity service, this is the data
2537c478bd9Sstevel@tonic-gate * followed by a checksum.
2547c478bd9Sstevel@tonic-gate */
2557c478bd9Sstevel@tonic-gate if (!__xdr_gss_buf(in_xdrs, &in_buf)) {
2567c478bd9Sstevel@tonic-gate return (FALSE);
2577c478bd9Sstevel@tonic-gate }
2587c478bd9Sstevel@tonic-gate
2597c478bd9Sstevel@tonic-gate if (service == rpc_gss_svc_privacy) {
2607c478bd9Sstevel@tonic-gate major = GSS_S_FAILURE;
2617c478bd9Sstevel@tonic-gate major = kgss_unseal(&minor, context, &in_buf, &out_buf, &conf,
2627c478bd9Sstevel@tonic-gate &qop);
2637c478bd9Sstevel@tonic-gate kmem_free(in_buf.value, in_buf.length);
2647c478bd9Sstevel@tonic-gate if (major != GSS_S_COMPLETE) {
2657c478bd9Sstevel@tonic-gate RPCGSS_LOG1(1, "rpc_gss_unwrap: kgss_unseal failed."
2667c478bd9Sstevel@tonic-gate "major = %x, minor = %x", major, minor);
2677c478bd9Sstevel@tonic-gate return (FALSE);
2687c478bd9Sstevel@tonic-gate }
2697c478bd9Sstevel@tonic-gate /*
2707c478bd9Sstevel@tonic-gate * Keep the returned token (unencrypted data) in in_buf.
2717c478bd9Sstevel@tonic-gate */
2727c478bd9Sstevel@tonic-gate in_buf.length = out_buf.length;
2737c478bd9Sstevel@tonic-gate in_buf.value = out_buf.value;
2747c478bd9Sstevel@tonic-gate
2757c478bd9Sstevel@tonic-gate /*
2767c478bd9Sstevel@tonic-gate * If privacy was not used, or if QOP is not what we are
2777c478bd9Sstevel@tonic-gate * expecting, fail.
2787c478bd9Sstevel@tonic-gate */
2797c478bd9Sstevel@tonic-gate if (!conf || qop != qop_check)
2807c478bd9Sstevel@tonic-gate goto fail;
2817c478bd9Sstevel@tonic-gate
2827c478bd9Sstevel@tonic-gate } else if (service == rpc_gss_svc_integrity) {
2837c478bd9Sstevel@tonic-gate if (!__xdr_gss_buf(in_xdrs, &out_buf)) {
2847c478bd9Sstevel@tonic-gate return (FALSE);
2857c478bd9Sstevel@tonic-gate }
2867c478bd9Sstevel@tonic-gate major = kgss_verify(&minor, context, &in_buf, &out_buf,
2877c478bd9Sstevel@tonic-gate &qop);
2887c478bd9Sstevel@tonic-gate kmem_free(out_buf.value, out_buf.length);
2897c478bd9Sstevel@tonic-gate if (major != GSS_S_COMPLETE) {
2907c478bd9Sstevel@tonic-gate kmem_free(in_buf.value, in_buf.length);
2917c478bd9Sstevel@tonic-gate RPCGSS_LOG1(1, "rpc_gss_unwrap: kgss_verify failed."
2927c478bd9Sstevel@tonic-gate "major = %x, minor = %x", major, minor);
2937c478bd9Sstevel@tonic-gate return (FALSE);
2947c478bd9Sstevel@tonic-gate }
2957c478bd9Sstevel@tonic-gate
2967c478bd9Sstevel@tonic-gate /*
2977c478bd9Sstevel@tonic-gate * If QOP is not what we are expecting, fail.
2987c478bd9Sstevel@tonic-gate */
2997c478bd9Sstevel@tonic-gate if (qop != qop_check)
3007c478bd9Sstevel@tonic-gate goto fail;
3017c478bd9Sstevel@tonic-gate }
3027c478bd9Sstevel@tonic-gate
3037c478bd9Sstevel@tonic-gate xdrmem_create(&temp_xdrs, in_buf.value, in_buf.length, XDR_DECODE);
3047c478bd9Sstevel@tonic-gate
3057c478bd9Sstevel@tonic-gate /*
3067c478bd9Sstevel@tonic-gate * The data consists of the sequence number followed by the
3077c478bd9Sstevel@tonic-gate * arguments. Make sure sequence number is what we are
3087c478bd9Sstevel@tonic-gate * expecting (i.e., the value in the header).
3097c478bd9Sstevel@tonic-gate */
3107c478bd9Sstevel@tonic-gate if (!xdr_u_int(&temp_xdrs, &seq_num2))
3117c478bd9Sstevel@tonic-gate goto fail;
3127c478bd9Sstevel@tonic-gate if (seq_num2 != seq_num)
3137c478bd9Sstevel@tonic-gate goto fail;
3147c478bd9Sstevel@tonic-gate
3157c478bd9Sstevel@tonic-gate /*
3167c478bd9Sstevel@tonic-gate * Deserialize the arguments into xdr_ptr, and release in_buf.
3177c478bd9Sstevel@tonic-gate */
3187c478bd9Sstevel@tonic-gate if (!(*xdr_func)(&temp_xdrs, xdr_ptr)) {
3197c478bd9Sstevel@tonic-gate goto fail;
3207c478bd9Sstevel@tonic-gate }
3217c478bd9Sstevel@tonic-gate
3227c478bd9Sstevel@tonic-gate if (service == rpc_gss_svc_privacy)
3237c478bd9Sstevel@tonic-gate (void) gss_release_buffer(&minor, &in_buf);
3247c478bd9Sstevel@tonic-gate else
3257c478bd9Sstevel@tonic-gate kmem_free(in_buf.value, in_buf.length);
3267c478bd9Sstevel@tonic-gate XDR_DESTROY(&temp_xdrs);
3277c478bd9Sstevel@tonic-gate return (TRUE);
3287c478bd9Sstevel@tonic-gate fail:
3297c478bd9Sstevel@tonic-gate XDR_DESTROY(&temp_xdrs);
3307c478bd9Sstevel@tonic-gate if (service == rpc_gss_svc_privacy)
3317c478bd9Sstevel@tonic-gate (void) gss_release_buffer(&minor, &in_buf);
3327c478bd9Sstevel@tonic-gate else
3337c478bd9Sstevel@tonic-gate kmem_free(in_buf.value, in_buf.length);
3347c478bd9Sstevel@tonic-gate return (FALSE);
3357c478bd9Sstevel@tonic-gate }
336