18f55a568SDoug Rabson /* 2*8a16b7a1SPedro F. Giffuni SPDX-License-Identifier: BSD-3-Clause 3*8a16b7a1SPedro F. Giffuni 48f55a568SDoug Rabson rpcsec_gss.h 58f55a568SDoug Rabson 68f55a568SDoug Rabson Copyright (c) 2000 The Regents of the University of Michigan. 78f55a568SDoug Rabson All rights reserved. 88f55a568SDoug Rabson 98f55a568SDoug Rabson Copyright (c) 2000 Dug Song <dugsong@UMICH.EDU>. 108f55a568SDoug Rabson All rights reserved, all wrongs reversed. 118f55a568SDoug Rabson 128f55a568SDoug Rabson Redistribution and use in source and binary forms, with or without 138f55a568SDoug Rabson modification, are permitted provided that the following conditions 148f55a568SDoug Rabson are met: 158f55a568SDoug Rabson 168f55a568SDoug Rabson 1. Redistributions of source code must retain the above copyright 178f55a568SDoug Rabson notice, this list of conditions and the following disclaimer. 188f55a568SDoug Rabson 2. Redistributions in binary form must reproduce the above copyright 198f55a568SDoug Rabson notice, this list of conditions and the following disclaimer in the 208f55a568SDoug Rabson documentation and/or other materials provided with the distribution. 218f55a568SDoug Rabson 3. Neither the name of the University nor the names of its 228f55a568SDoug Rabson contributors may be used to endorse or promote products derived 238f55a568SDoug Rabson from this software without specific prior written permission. 248f55a568SDoug Rabson 258f55a568SDoug Rabson THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 268f55a568SDoug Rabson WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 278f55a568SDoug Rabson MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 288f55a568SDoug Rabson DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 298f55a568SDoug Rabson FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 308f55a568SDoug Rabson CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 318f55a568SDoug Rabson SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 328f55a568SDoug Rabson BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 338f55a568SDoug Rabson LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 348f55a568SDoug Rabson NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 358f55a568SDoug Rabson SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 368f55a568SDoug Rabson 378f55a568SDoug Rabson $Id: auth_gss.h,v 1.12 2001/04/30 19:44:47 andros Exp $ 388f55a568SDoug Rabson */ 398f55a568SDoug Rabson 408f55a568SDoug Rabson #ifndef _RPCSEC_GSS_INT_H 418f55a568SDoug Rabson #define _RPCSEC_GSS_INT_H 428f55a568SDoug Rabson 438f55a568SDoug Rabson /* RPCSEC_GSS control procedures. */ 448f55a568SDoug Rabson typedef enum { 458f55a568SDoug Rabson RPCSEC_GSS_DATA = 0, 468f55a568SDoug Rabson RPCSEC_GSS_INIT = 1, 478f55a568SDoug Rabson RPCSEC_GSS_CONTINUE_INIT = 2, 488f55a568SDoug Rabson RPCSEC_GSS_DESTROY = 3 498f55a568SDoug Rabson } rpc_gss_proc_t; 508f55a568SDoug Rabson 518f55a568SDoug Rabson #define RPCSEC_GSS_VERSION 1 528f55a568SDoug Rabson 538f55a568SDoug Rabson /* Credentials. */ 548f55a568SDoug Rabson struct rpc_gss_cred { 558f55a568SDoug Rabson u_int gc_version; /* version */ 568f55a568SDoug Rabson rpc_gss_proc_t gc_proc; /* control procedure */ 578f55a568SDoug Rabson u_int gc_seq; /* sequence number */ 588f55a568SDoug Rabson rpc_gss_service_t gc_svc; /* service */ 598f55a568SDoug Rabson gss_buffer_desc gc_handle; /* handle to server-side context */ 608f55a568SDoug Rabson }; 618f55a568SDoug Rabson 628f55a568SDoug Rabson /* Context creation response. */ 638f55a568SDoug Rabson struct rpc_gss_init_res { 648f55a568SDoug Rabson gss_buffer_desc gr_handle; /* handle to server-side context */ 658f55a568SDoug Rabson u_int gr_major; /* major status */ 668f55a568SDoug Rabson u_int gr_minor; /* minor status */ 678f55a568SDoug Rabson u_int gr_win; /* sequence window */ 688f55a568SDoug Rabson gss_buffer_desc gr_token; /* token */ 698f55a568SDoug Rabson }; 708f55a568SDoug Rabson 718f55a568SDoug Rabson /* Maximum sequence number value. */ 728f55a568SDoug Rabson #define MAXSEQ 0x80000000 738f55a568SDoug Rabson 748f55a568SDoug Rabson /* Prototypes. */ 758f55a568SDoug Rabson __BEGIN_DECLS 768f55a568SDoug Rabson 778f55a568SDoug Rabson bool_t xdr_gss_buffer_desc(XDR *xdrs, gss_buffer_desc *p); 788f55a568SDoug Rabson bool_t xdr_rpc_gss_cred(XDR *xdrs, struct rpc_gss_cred *p); 798f55a568SDoug Rabson bool_t xdr_rpc_gss_init_res(XDR *xdrs, struct rpc_gss_init_res *p); 808f55a568SDoug Rabson bool_t xdr_rpc_gss_wrap_data(XDR *xdrs, xdrproc_t xdr_func, 818f55a568SDoug Rabson caddr_t xdr_ptr, gss_ctx_id_t ctx, gss_qop_t qop, rpc_gss_service_t svc, 828f55a568SDoug Rabson u_int seq); 838f55a568SDoug Rabson bool_t xdr_rpc_gss_unwrap_data(XDR *xdrs, xdrproc_t xdr_func, 848f55a568SDoug Rabson caddr_t xdr_ptr, gss_ctx_id_t ctx, gss_qop_t qop, rpc_gss_service_t svc, 858f55a568SDoug Rabson u_int seq); 868f55a568SDoug Rabson const char *_rpc_gss_num_to_qop(const char *mech, u_int num); 878f55a568SDoug Rabson void _rpc_gss_set_error(int rpc_gss_error, int system_error); 888f55a568SDoug Rabson 898f55a568SDoug Rabson void log_debug(const char *fmt, ...); 908f55a568SDoug Rabson void log_status(const char *m, gss_OID mech, OM_uint32 major, 918f55a568SDoug Rabson OM_uint32 minor); 928f55a568SDoug Rabson void log_hexdump(const u_char *buf, int len, int offset); 938f55a568SDoug Rabson 948f55a568SDoug Rabson __END_DECLS 958f55a568SDoug Rabson 968f55a568SDoug Rabson #endif /* !_RPCSEC_GSS_INT_H */ 97