2 static char sfs_svc_auth_id[] = "@(#)svc_auth.c 2.1 97/10/23";
4 #if !defined(lint) && defined(SCCSIDS)
5 static char sccsid[] = "@(#)svc_auth.c 2.1 88/08/07 4.0 RPCSRC; from 1.19 87/08/11 Copyr 1984 Sun Micro";
8 * Copyright (c) 1992-1997,2001 by Standard Performance Evaluation Corporation
10 * Standard Performance Evaluation Corporation (SPEC)
11 * 6585 Merchant Place, Suite 100
14 * This product contains benchmarks acquired from several sources who
15 * understand and agree with SPEC's goal of creating fair and objective
16 * benchmarks to measure computer performance.
18 * This copyright notice is placed here only to protect SPEC in the
19 * event the source is misused in any manner that is contrary to the
20 * spirit, the goals and the intent of SPEC.
22 * The source code is provided to the user or company under the license
23 * agreement for the SPEC Benchmark Suite for this product.
26 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
27 * unrestricted use provided that this legend is included on all tape
28 * media and as a part of the software program in whole or part. Users
29 * may copy or modify Sun RPC without charge, but are not authorized
30 * to license or distribute it to anyone else except as part of a product or
31 * program developed by the user.
33 * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
34 * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
35 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
37 * Sun RPC is provided with no support and without any obligation on the
38 * part of Sun Microsystems, Inc. to assist in its use, correction,
39 * modification or enhancement.
41 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
42 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
43 * OR ANY PART THEREOF.
45 * In no event will Sun Microsystems, Inc. be liable for any lost revenue
46 * or profits or other special, indirect and consequential damages, even if
47 * Sun has been advised of the possibility of such damages.
49 * Sun Microsystems, Inc.
51 * Mountain View, California 94043
55 * svc_auth_nodes.c, Server-side rpc authenticator interface,
56 * *WITHOUT* DES authentication.
58 * Copyright (C) 1984, Sun Microsystems, Inc.
64 * svcauthsw is the bdevsw of server side authentication.
66 * Server side authenticators are called from authenticate by
67 * using the client auth struct flavor field to index into svcauthsw.
68 * The server auth flavors must implement a routine that looks
72 * flavorx_auth(rqst, msg)
73 * register struct svc_req *rqst;
74 * register struct rpc_msg *msg;
78 extern enum auth_stat _svcauth_null(struct svc_req *, struct rpc_msg *);
79 extern enum auth_stat _svcauth_unix(struct svc_req *, struct rpc_msg *);
80 extern enum auth_stat _svcauth_short(struct svc_req *, struct rpc_msg *);
83 enum auth_stat (*authenticator)(struct svc_req *, struct rpc_msg *);
85 _svcauth_null, /* AUTH_NULL */
86 _svcauth_unix, /* AUTH_UNIX */
87 _svcauth_short, /* AUTH_SHORT */
89 #define AUTH_MAX 2 /* HIGHEST AUTH NUMBER */
93 * The call rpc message, msg has been obtained from the wire. The msg contains
94 * the raw form of credentials and verifiers. authenticate returns AUTH_OK
95 * if the msg is successfully authenticated. If AUTH_OK then the routine also
96 * does the following things:
97 * set rqst->rq_xprt->verf to the appropriate response verifier;
98 * sets rqst->rq_client_cred to the "cooked" form of the credentials.
100 * NB: rqst->rq_cxprt->verf must be pre-alloctaed;
101 * its length is set appropriately.
103 * The caller still owns and is responsible for msg->u.cmb.cred and
104 * msg->u.cmb.verf. The authentication system retains ownership of
105 * rqst->rq_client_cred, the cooked credentials.
107 * There is an assumption that any flavour less than AUTH_NULL is
112 struct svc_req *rqst,
115 register int cred_flavor;
117 rqst->rq_cred = msg->rm_call.cb_cred;
118 rqst->rq_xprt->xp_verf.oa_flavor = _null_auth.oa_flavor;
119 rqst->rq_xprt->xp_verf.oa_length = 0;
120 cred_flavor = rqst->rq_cred.oa_flavor;
121 if ((cred_flavor <= AUTH_MAX) && (cred_flavor >= AUTH_NULL)) {
122 return ((*(svcauthsw[cred_flavor].authenticator))(rqst, msg));
125 return (AUTH_REJECTEDCRED);
131 struct svc_req *rqst,