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 2005 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ 277c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 287c478bd9Sstevel@tonic-gate /* 297c478bd9Sstevel@tonic-gate * Portions of this source code were derived from Berkeley 307c478bd9Sstevel@tonic-gate * 4.3 BSD under license from the Regents of the University of 317c478bd9Sstevel@tonic-gate * California. 327c478bd9Sstevel@tonic-gate */ 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gate #ifndef _RPC_SVC_AUTH_H 357c478bd9Sstevel@tonic-gate #define _RPC_SVC_AUTH_H 367c478bd9Sstevel@tonic-gate 377c478bd9Sstevel@tonic-gate /* 387c478bd9Sstevel@tonic-gate * svc_auth.h, Service side of rpc authentication. 397c478bd9Sstevel@tonic-gate */ 407c478bd9Sstevel@tonic-gate #include <rpc/rpcsec_gss.h> 417c478bd9Sstevel@tonic-gate #include <rpc/rpc_msg.h> 427c478bd9Sstevel@tonic-gate 437c478bd9Sstevel@tonic-gate #ifdef __cplusplus 447c478bd9Sstevel@tonic-gate extern "C" { 457c478bd9Sstevel@tonic-gate #endif 467c478bd9Sstevel@tonic-gate 477c478bd9Sstevel@tonic-gate /* 487c478bd9Sstevel@tonic-gate * Server side authenticator 497c478bd9Sstevel@tonic-gate */ 507c478bd9Sstevel@tonic-gate #ifdef _KERNEL 517c478bd9Sstevel@tonic-gate /* 527c478bd9Sstevel@tonic-gate * Copy of GSS parameters, needed for MT operation 537c478bd9Sstevel@tonic-gate */ 547c478bd9Sstevel@tonic-gate typedef struct { 557c478bd9Sstevel@tonic-gate bool_t established; 567c478bd9Sstevel@tonic-gate rpc_gss_service_t service; 577c478bd9Sstevel@tonic-gate uint_t qop_rcvd; 587c478bd9Sstevel@tonic-gate void *context; 597c478bd9Sstevel@tonic-gate uint_t seq_num; 607c478bd9Sstevel@tonic-gate } svc_rpc_gss_parms_t; 617c478bd9Sstevel@tonic-gate 627c478bd9Sstevel@tonic-gate /* 637c478bd9Sstevel@tonic-gate * sec_svc_control() commands 647c478bd9Sstevel@tonic-gate */ 657c478bd9Sstevel@tonic-gate #define RPC_SVC_SET_GSS_CALLBACK 1 /* set rpcsec_gss callback routine */ 66*5d14668fSToomas Soome extern bool_t sec_svc_control(uint_t, void *); 677c478bd9Sstevel@tonic-gate 687c478bd9Sstevel@tonic-gate /* 697c478bd9Sstevel@tonic-gate * Interface to server-side authentication flavors, may change on 707c478bd9Sstevel@tonic-gate * each request. 717c478bd9Sstevel@tonic-gate */ 727c478bd9Sstevel@tonic-gate typedef struct { 737c478bd9Sstevel@tonic-gate struct svc_auth_ops { 747c478bd9Sstevel@tonic-gate int (*svc_ah_wrap)(); 757c478bd9Sstevel@tonic-gate int (*svc_ah_unwrap)(); 767c478bd9Sstevel@tonic-gate } svc_ah_ops; 777c478bd9Sstevel@tonic-gate caddr_t svc_ah_private; 787c478bd9Sstevel@tonic-gate svc_rpc_gss_parms_t svc_gss_parms; 797c478bd9Sstevel@tonic-gate rpc_gss_rawcred_t raw_cred; 807c478bd9Sstevel@tonic-gate } SVCAUTH; 817c478bd9Sstevel@tonic-gate 827c478bd9Sstevel@tonic-gate #define SVCAUTH_GSSPARMS(auth) ((svc_rpc_gss_parms_t *)&(auth)->svc_gss_parms) 837c478bd9Sstevel@tonic-gate 847c478bd9Sstevel@tonic-gate /* 857c478bd9Sstevel@tonic-gate * Auth flavors can now apply a transformation in addition to simple XDR 867c478bd9Sstevel@tonic-gate * on the body of a call/response in ways that depend on the flavor being 877c478bd9Sstevel@tonic-gate * used. These interfaces provide a generic interface between the 887c478bd9Sstevel@tonic-gate * internal RPC frame and the auth flavor specific code to allow the 897c478bd9Sstevel@tonic-gate * auth flavor to encode (WRAP) or decode (UNWRAP) the body. 907c478bd9Sstevel@tonic-gate */ 917c478bd9Sstevel@tonic-gate #define SVCAUTH_WRAP(auth, xdrs, xfunc, xwhere) \ 927c478bd9Sstevel@tonic-gate ((*((auth)->svc_ah_ops.svc_ah_wrap))(auth, xdrs, xfunc, xwhere)) 937c478bd9Sstevel@tonic-gate #define SVCAUTH_UNWRAP(auth, xdrs, xfunc, xwhere) \ 947c478bd9Sstevel@tonic-gate ((*((auth)->svc_ah_ops.svc_ah_unwrap))(auth, xdrs, xfunc, xwhere)) 957c478bd9Sstevel@tonic-gate 967c478bd9Sstevel@tonic-gate /* 977c478bd9Sstevel@tonic-gate * Server side authenticator 987c478bd9Sstevel@tonic-gate */ 997c478bd9Sstevel@tonic-gate extern enum auth_stat sec_svc_msg(struct svc_req *, struct rpc_msg *, 1007c478bd9Sstevel@tonic-gate bool_t *); 101*5d14668fSToomas Soome 102*5d14668fSToomas Soome extern int sec_svc_getcred(struct svc_req *, cred_t *, caddr_t *, int *); 1037c478bd9Sstevel@tonic-gate 1047c478bd9Sstevel@tonic-gate #else 1057c478bd9Sstevel@tonic-gate 1067c478bd9Sstevel@tonic-gate extern enum auth_stat __gss_authenticate(struct svc_req *, struct rpc_msg *, 1077c478bd9Sstevel@tonic-gate bool_t *); 1087c478bd9Sstevel@tonic-gate extern enum auth_stat __authenticate(struct svc_req *, struct rpc_msg *); 1097c478bd9Sstevel@tonic-gate 1107c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 1117c478bd9Sstevel@tonic-gate 1127c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1137c478bd9Sstevel@tonic-gate } 1147c478bd9Sstevel@tonic-gate #endif 1157c478bd9Sstevel@tonic-gate 1167c478bd9Sstevel@tonic-gate #endif /* _RPC_SVC_AUTH_H */ 117