1dfdcada3SDoug Rabson /* $NetBSD: svc_auth.h,v 1.8 2000/06/02 22:57:57 fvdl Exp $ */ 2dfdcada3SDoug Rabson 3*2e322d37SHiroki Sato /*- 4*2e322d37SHiroki Sato * Copyright (c) 2009, Sun Microsystems, Inc. 5*2e322d37SHiroki Sato * All rights reserved. 6dfdcada3SDoug Rabson * 7*2e322d37SHiroki Sato * Redistribution and use in source and binary forms, with or without 8*2e322d37SHiroki Sato * modification, are permitted provided that the following conditions are met: 9*2e322d37SHiroki Sato * - Redistributions of source code must retain the above copyright notice, 10*2e322d37SHiroki Sato * this list of conditions and the following disclaimer. 11*2e322d37SHiroki Sato * - Redistributions in binary form must reproduce the above copyright notice, 12*2e322d37SHiroki Sato * this list of conditions and the following disclaimer in the documentation 13*2e322d37SHiroki Sato * and/or other materials provided with the distribution. 14*2e322d37SHiroki Sato * - Neither the name of Sun Microsystems, Inc. nor the names of its 15*2e322d37SHiroki Sato * contributors may be used to endorse or promote products derived 16*2e322d37SHiroki Sato * from this software without specific prior written permission. 17dfdcada3SDoug Rabson * 18*2e322d37SHiroki Sato * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19*2e322d37SHiroki Sato * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20*2e322d37SHiroki Sato * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21*2e322d37SHiroki Sato * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22*2e322d37SHiroki Sato * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23*2e322d37SHiroki Sato * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24*2e322d37SHiroki Sato * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25*2e322d37SHiroki Sato * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26*2e322d37SHiroki Sato * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27*2e322d37SHiroki Sato * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28*2e322d37SHiroki Sato * POSSIBILITY OF SUCH DAMAGE. 29dfdcada3SDoug Rabson * 30dfdcada3SDoug Rabson * from: @(#)svc_auth.h 1.6 86/07/16 SMI 31dfdcada3SDoug Rabson * @(#)svc_auth.h 2.1 88/07/29 4.0 RPCSRC 32dfdcada3SDoug Rabson * $FreeBSD$ 33dfdcada3SDoug Rabson */ 34dfdcada3SDoug Rabson 35dfdcada3SDoug Rabson /* 36dfdcada3SDoug Rabson * svc_auth.h, Service side of rpc authentication. 37dfdcada3SDoug Rabson * 38dfdcada3SDoug Rabson * Copyright (C) 1984, Sun Microsystems, Inc. 39dfdcada3SDoug Rabson */ 40dfdcada3SDoug Rabson 41dfdcada3SDoug Rabson #ifndef _RPC_SVC_AUTH_H 42dfdcada3SDoug Rabson #define _RPC_SVC_AUTH_H 43dfdcada3SDoug Rabson 44dfdcada3SDoug Rabson /* 45dfdcada3SDoug Rabson * Server side authenticator 46dfdcada3SDoug Rabson */ 47dfdcada3SDoug Rabson __BEGIN_DECLS 48dfdcada3SDoug Rabson extern enum auth_stat _authenticate(struct svc_req *, struct rpc_msg *); 49a9148abdSDoug Rabson #ifdef _KERNEL 50a9148abdSDoug Rabson extern int svc_auth_reg(int, 51a9148abdSDoug Rabson enum auth_stat (*)(struct svc_req *, struct rpc_msg *), 52a9148abdSDoug Rabson int (*)(struct svc_req *, struct ucred **, int *)); 53a9148abdSDoug Rabson #else 54a9148abdSDoug Rabson extern int svc_auth_reg(int, enum auth_stat (*)(struct svc_req *, 55a9148abdSDoug Rabson struct rpc_msg *)); 56a9148abdSDoug Rabson #endif 57dfdcada3SDoug Rabson 58a9148abdSDoug Rabson 59a9148abdSDoug Rabson extern int svc_getcred(struct svc_req *, struct ucred **, int *); 60dfdcada3SDoug Rabson /* 61dfdcada3SDoug Rabson * struct svc_req *req; -- RPC request 62a9148abdSDoug Rabson * struct ucred **crp -- Kernel cred to modify 63dfdcada3SDoug Rabson * int *flavorp -- Return RPC auth flavor 64dfdcada3SDoug Rabson * 65dfdcada3SDoug Rabson * Retrieve unix creds corresponding to an RPC request, if 66dfdcada3SDoug Rabson * possible. The auth flavor (AUTH_NONE or AUTH_UNIX) is returned in 67a9148abdSDoug Rabson * *flavorp. If the flavor is AUTH_UNIX the caller's ucred pointer 68a9148abdSDoug Rabson * will be modified to point at a ucred structure which reflects the 69a9148abdSDoug Rabson * values from the request. The caller should call crfree on this 70a9148abdSDoug Rabson * pointer. 71a9148abdSDoug Rabson * 72a9148abdSDoug Rabson * Return's non-zero if credentials were retrieved from the request, 73a9148abdSDoug Rabson * otherwise zero. 74dfdcada3SDoug Rabson */ 75dfdcada3SDoug Rabson 76dfdcada3SDoug Rabson __END_DECLS 77dfdcada3SDoug Rabson 78dfdcada3SDoug Rabson #endif /* !_RPC_SVC_AUTH_H */ 79