1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright (c) 1996,1997-1998 by Sun Microsystems, Inc. 24*7c478bd9Sstevel@tonic-gate * All rights reserved. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #ifndef _RPCSEC_DEFS_H 28*7c478bd9Sstevel@tonic-gate #define _RPCSEC_DEFS_H 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate /* 31*7c478bd9Sstevel@tonic-gate * Copyright 1993 OpenVision Technologies, Inc., All Rights Reserved. 32*7c478bd9Sstevel@tonic-gate * 33*7c478bd9Sstevel@tonic-gate * $Id: auth_gssapi.h,v 1.11 1994/10/27 12:39:14 jik Exp $ 34*7c478bd9Sstevel@tonic-gate */ 35*7c478bd9Sstevel@tonic-gate 36*7c478bd9Sstevel@tonic-gate #ifndef _KERNEL 37*7c478bd9Sstevel@tonic-gate #include <libintl.h> 38*7c478bd9Sstevel@tonic-gate #include <locale.h> 39*7c478bd9Sstevel@tonic-gate #endif 40*7c478bd9Sstevel@tonic-gate #include <gssapi/gssapi.h> 41*7c478bd9Sstevel@tonic-gate #include <rpc/types.h> 42*7c478bd9Sstevel@tonic-gate 43*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 44*7c478bd9Sstevel@tonic-gate extern "C" { 45*7c478bd9Sstevel@tonic-gate #endif 46*7c478bd9Sstevel@tonic-gate 47*7c478bd9Sstevel@tonic-gate #ifdef _KERNEL 48*7c478bd9Sstevel@tonic-gate 49*7c478bd9Sstevel@tonic-gate #if defined(DEBUG) && !defined(RPCGSS_DEBUG) 50*7c478bd9Sstevel@tonic-gate #define RPCGSS_DEBUG 51*7c478bd9Sstevel@tonic-gate #endif 52*7c478bd9Sstevel@tonic-gate 53*7c478bd9Sstevel@tonic-gate #ifdef RPCGSS_DEBUG 54*7c478bd9Sstevel@tonic-gate extern uint_t rpcgss_log; 55*7c478bd9Sstevel@tonic-gate 56*7c478bd9Sstevel@tonic-gate #define RPCGSS_LOG1(A, B, C, D) \ 57*7c478bd9Sstevel@tonic-gate ((void)((rpcgss_log) && (rpcgss_log & (A)) && (printf((B), \ 58*7c478bd9Sstevel@tonic-gate (C), (D)), TRUE))) 59*7c478bd9Sstevel@tonic-gate #define RPCGSS_LOG(A, B, C) \ 60*7c478bd9Sstevel@tonic-gate ((void)((rpcgss_log) && (rpcgss_log & (A)) && (printf((B), (C)), TRUE))) 61*7c478bd9Sstevel@tonic-gate #define RPCGSS_LOG0(A, B) \ 62*7c478bd9Sstevel@tonic-gate ((void)((rpcgss_log) && (rpcgss_log & (A)) && (printf(B), TRUE))) 63*7c478bd9Sstevel@tonic-gate #else 64*7c478bd9Sstevel@tonic-gate #define RPCGSS_LOG1(A, B, C, D) 65*7c478bd9Sstevel@tonic-gate #define RPCGSS_LOG(A, B, C) 66*7c478bd9Sstevel@tonic-gate #define RPCGSS_LOG0(A, B) 67*7c478bd9Sstevel@tonic-gate #endif 68*7c478bd9Sstevel@tonic-gate 69*7c478bd9Sstevel@tonic-gate #else /* _KERNEL */ 70*7c478bd9Sstevel@tonic-gate 71*7c478bd9Sstevel@tonic-gate extern bool_t locale_set; 72*7c478bd9Sstevel@tonic-gate #if !defined(TEXT_DOMAIN) 73*7c478bd9Sstevel@tonic-gate #define TEXT_DOMAIN "SUNW_OST_OSCMD" 74*7c478bd9Sstevel@tonic-gate #endif 75*7c478bd9Sstevel@tonic-gate 76*7c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 77*7c478bd9Sstevel@tonic-gate 78*7c478bd9Sstevel@tonic-gate 79*7c478bd9Sstevel@tonic-gate typedef struct _rpc_gss_creds { 80*7c478bd9Sstevel@tonic-gate uint_t version; 81*7c478bd9Sstevel@tonic-gate uint_t gss_proc; 82*7c478bd9Sstevel@tonic-gate uint_t seq_num; 83*7c478bd9Sstevel@tonic-gate rpc_gss_service_t service; 84*7c478bd9Sstevel@tonic-gate gss_buffer_desc ctx_handle; 85*7c478bd9Sstevel@tonic-gate } rpc_gss_creds; 86*7c478bd9Sstevel@tonic-gate 87*7c478bd9Sstevel@tonic-gate typedef gss_buffer_desc rpc_gss_init_arg; 88*7c478bd9Sstevel@tonic-gate 89*7c478bd9Sstevel@tonic-gate typedef struct _rpc_gss_init_res { 90*7c478bd9Sstevel@tonic-gate gss_buffer_desc ctx_handle; 91*7c478bd9Sstevel@tonic-gate OM_uint32 gss_major, gss_minor; 92*7c478bd9Sstevel@tonic-gate OM_uint32 seq_window; 93*7c478bd9Sstevel@tonic-gate gss_buffer_desc token; 94*7c478bd9Sstevel@tonic-gate } rpc_gss_init_res; 95*7c478bd9Sstevel@tonic-gate 96*7c478bd9Sstevel@tonic-gate 97*7c478bd9Sstevel@tonic-gate /* 98*7c478bd9Sstevel@tonic-gate * Convenience macros. 99*7c478bd9Sstevel@tonic-gate */ 100*7c478bd9Sstevel@tonic-gate 101*7c478bd9Sstevel@tonic-gate #define GSS_COPY_BUFFER(dest, src) { \ 102*7c478bd9Sstevel@tonic-gate (dest).length = (src).length; \ 103*7c478bd9Sstevel@tonic-gate (dest).value = (src).value; } 104*7c478bd9Sstevel@tonic-gate 105*7c478bd9Sstevel@tonic-gate #define GSS_DUP_BUFFER(dest, src) { \ 106*7c478bd9Sstevel@tonic-gate (dest).length = (src).length; \ 107*7c478bd9Sstevel@tonic-gate (dest).value = (void *) mem_alloc((dest).length); \ 108*7c478bd9Sstevel@tonic-gate bcopy((src).value, (dest).value, (dest).length); } 109*7c478bd9Sstevel@tonic-gate 110*7c478bd9Sstevel@tonic-gate #define GSS_BUFFERS_EQUAL(b1, b2) (((b1).length == (b2).length) && \ 111*7c478bd9Sstevel@tonic-gate (bcmp((b1).value, (b2).value, (b1.length)) == 0)) 112*7c478bd9Sstevel@tonic-gate 113*7c478bd9Sstevel@tonic-gate #define GSS_OIDS_EQUAL(o1, o2) \ 114*7c478bd9Sstevel@tonic-gate ((((gss_OID)(o1))->length == ((gss_OID)(o2))->length) && \ 115*7c478bd9Sstevel@tonic-gate (bcmp(((gss_OID)(o1))->elements, ((gss_OID)(o2))->elements, \ 116*7c478bd9Sstevel@tonic-gate ((gss_OID)(o1))->length) == 0)) 117*7c478bd9Sstevel@tonic-gate 118*7c478bd9Sstevel@tonic-gate #define MAX_GSS_NAME 128 119*7c478bd9Sstevel@tonic-gate 120*7c478bd9Sstevel@tonic-gate /* 121*7c478bd9Sstevel@tonic-gate * Private interfaces for user and kernel space. 122*7c478bd9Sstevel@tonic-gate */ 123*7c478bd9Sstevel@tonic-gate bool_t __xdr_gss_buf(); 124*7c478bd9Sstevel@tonic-gate bool_t __xdr_rpc_gss_creds(); 125*7c478bd9Sstevel@tonic-gate bool_t __xdr_rpc_gss_init_arg(); 126*7c478bd9Sstevel@tonic-gate bool_t __xdr_rpc_gss_init_res(); 127*7c478bd9Sstevel@tonic-gate 128*7c478bd9Sstevel@tonic-gate bool_t __rpc_gss_wrap_data(); 129*7c478bd9Sstevel@tonic-gate bool_t __rpc_gss_unwrap_data(); 130*7c478bd9Sstevel@tonic-gate 131*7c478bd9Sstevel@tonic-gate #ifdef _KERNEL 132*7c478bd9Sstevel@tonic-gate /* 133*7c478bd9Sstevel@tonic-gate * kernel-level RPCSEC_GSS definitions. 134*7c478bd9Sstevel@tonic-gate */ 135*7c478bd9Sstevel@tonic-gate 136*7c478bd9Sstevel@tonic-gate void __rpc_gss_dup_oid(gss_OID, gss_OID *); 137*7c478bd9Sstevel@tonic-gate bool_t __rpc_gss_oids_equal(gss_OID oid1, gss_OID oid2); 138*7c478bd9Sstevel@tonic-gate void rpc_gss_display_status(OM_uint32 major, OM_uint32 minor, 139*7c478bd9Sstevel@tonic-gate rpc_gss_OID mechanism, uid_t uid, 140*7c478bd9Sstevel@tonic-gate char *function_name); 141*7c478bd9Sstevel@tonic-gate #else 142*7c478bd9Sstevel@tonic-gate /* 143*7c478bd9Sstevel@tonic-gate * user-level RPCSEC_GSS definitions. 144*7c478bd9Sstevel@tonic-gate */ 145*7c478bd9Sstevel@tonic-gate 146*7c478bd9Sstevel@tonic-gate #define MAX_MECH_OID_PAIRS 32 147*7c478bd9Sstevel@tonic-gate 148*7c478bd9Sstevel@tonic-gate typedef struct _rpc_gss_name { 149*7c478bd9Sstevel@tonic-gate char *name; 150*7c478bd9Sstevel@tonic-gate rpc_gss_OID type; 151*7c478bd9Sstevel@tonic-gate } rpc_gss_name; 152*7c478bd9Sstevel@tonic-gate 153*7c478bd9Sstevel@tonic-gate #ifdef _REENTRANT 154*7c478bd9Sstevel@tonic-gate extern rpc_gss_error_t *__rpc_gss_err(); 155*7c478bd9Sstevel@tonic-gate #define rpc_gss_err (*(__rpc_gss_err())) 156*7c478bd9Sstevel@tonic-gate #else 157*7c478bd9Sstevel@tonic-gate extern rpc_gss_error_t rpc_gss_err; 158*7c478bd9Sstevel@tonic-gate #endif /* _REENTRANT */ 159*7c478bd9Sstevel@tonic-gate 160*7c478bd9Sstevel@tonic-gate /* 161*7c478bd9Sstevel@tonic-gate * Private interfaces in user space. 162*7c478bd9Sstevel@tonic-gate */ 163*7c478bd9Sstevel@tonic-gate bool_t __rpc_gss_qop_to_num(); 164*7c478bd9Sstevel@tonic-gate char *__rpc_gss_num_to_qop(); 165*7c478bd9Sstevel@tonic-gate bool_t __rpc_gss_mech_to_oid(); 166*7c478bd9Sstevel@tonic-gate char *__rpc_gss_oid_to_mech(); 167*7c478bd9Sstevel@tonic-gate bool_t __rpc_gss_svc_to_num(); 168*7c478bd9Sstevel@tonic-gate char *__rpc_gss_num_to_svc(); 169*7c478bd9Sstevel@tonic-gate 170*7c478bd9Sstevel@tonic-gate void __rpc_gss_xdrdynamic_create(); 171*7c478bd9Sstevel@tonic-gate caddr_t __rpc_gss_xdrdynamic_getdata(); 172*7c478bd9Sstevel@tonic-gate 173*7c478bd9Sstevel@tonic-gate bool_t __rpcsec_init(); 174*7c478bd9Sstevel@tonic-gate rpc_gss_OID __get_gss_oid(); 175*7c478bd9Sstevel@tonic-gate void __rpc_gss_bind_error(); 176*7c478bd9Sstevel@tonic-gate int __find_max_data_length(rpc_gss_service_t service, gss_ctx_id_t context, 177*7c478bd9Sstevel@tonic-gate OM_uint32 qop, int max_tp_unit_len); 178*7c478bd9Sstevel@tonic-gate 179*7c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 180*7c478bd9Sstevel@tonic-gate 181*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 182*7c478bd9Sstevel@tonic-gate } 183*7c478bd9Sstevel@tonic-gate #endif 184*7c478bd9Sstevel@tonic-gate 185*7c478bd9Sstevel@tonic-gate #endif /* _RPCSEC_DEFS_H */ 186