1177633Sdfr/*	$NetBSD: svc_auth.h,v 1.8 2000/06/02 22:57:57 fvdl Exp $	*/
2177633Sdfr
3261057Smav/*-
4261057Smav * Copyright (c) 2009, Sun Microsystems, Inc.
5261057Smav * All rights reserved.
6177633Sdfr *
7261057Smav * Redistribution and use in source and binary forms, with or without
8261057Smav * modification, are permitted provided that the following conditions are met:
9261057Smav * - Redistributions of source code must retain the above copyright notice,
10261057Smav *   this list of conditions and the following disclaimer.
11261057Smav * - Redistributions in binary form must reproduce the above copyright notice,
12261057Smav *   this list of conditions and the following disclaimer in the documentation
13261057Smav *   and/or other materials provided with the distribution.
14261057Smav * - Neither the name of Sun Microsystems, Inc. nor the names of its
15261057Smav *   contributors may be used to endorse or promote products derived
16261057Smav *   from this software without specific prior written permission.
17261057Smav *
18261057Smav * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19261057Smav * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20261057Smav * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21261057Smav * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22261057Smav * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23261057Smav * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24261057Smav * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25261057Smav * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26261057Smav * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27261057Smav * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28261057Smav * POSSIBILITY OF SUCH DAMAGE.
29177633Sdfr *
30177633Sdfr *	from: @(#)svc_auth.h 1.6 86/07/16 SMI
31177633Sdfr *	@(#)svc_auth.h	2.1 88/07/29 4.0 RPCSRC
32177633Sdfr * $FreeBSD$
33177633Sdfr */
34177633Sdfr
35177633Sdfr/*
36177633Sdfr * svc_auth.h, Service side of rpc authentication.
37177633Sdfr *
38177633Sdfr * Copyright (C) 1984, Sun Microsystems, Inc.
39177633Sdfr */
40177633Sdfr
41177633Sdfr#ifndef _RPC_SVC_AUTH_H
42177633Sdfr#define _RPC_SVC_AUTH_H
43177633Sdfr
44177633Sdfr/*
45177633Sdfr * Server side authenticator
46177633Sdfr */
47177633Sdfr__BEGIN_DECLS
48177633Sdfrextern enum auth_stat _authenticate(struct svc_req *, struct rpc_msg *);
49184588Sdfr#ifdef _KERNEL
50184588Sdfrextern int svc_auth_reg(int,
51184588Sdfr    enum auth_stat (*)(struct svc_req *, struct rpc_msg *),
52184588Sdfr    int (*)(struct svc_req *, struct ucred **, int *));
53184588Sdfr#else
54184588Sdfrextern int svc_auth_reg(int, enum auth_stat (*)(struct svc_req *,
55184588Sdfr                          struct rpc_msg *));
56184588Sdfr#endif
57177633Sdfr
58184588Sdfr
59184588Sdfrextern int svc_getcred(struct svc_req *, struct ucred **, int *);
60177633Sdfr/*
61177633Sdfr * struct svc_req *req;                 -- RPC request
62184588Sdfr * struct ucred **crp			-- Kernel cred to modify
63177633Sdfr * int *flavorp				-- Return RPC auth flavor
64177633Sdfr *
65177633Sdfr * Retrieve unix creds corresponding to an RPC request, if
66177633Sdfr * possible. The auth flavor (AUTH_NONE or AUTH_UNIX) is returned in
67184588Sdfr * *flavorp. If the flavor is AUTH_UNIX the caller's ucred pointer
68184588Sdfr * will be modified to point at a ucred structure which reflects the
69184588Sdfr * values from the request. The caller should call crfree on this
70184588Sdfr * pointer.
71184588Sdfr *
72184588Sdfr * Return's non-zero if credentials were retrieved from the request,
73184588Sdfr * otherwise zero.
74177633Sdfr */
75177633Sdfr
76177633Sdfr__END_DECLS
77177633Sdfr
78177633Sdfr#endif /* !_RPC_SVC_AUTH_H */
79