2 * @(#)auth.h 2.1 97/10/23
6 * Copyright (c) 1992-1997,2001 by Standard Performance Evaluation Corporation
8 * Standard Performance Evaluation Corporation (SPEC)
9 * 6585 Merchant Place, Suite 100
12 * This product contains benchmarks acquired from several sources who
13 * understand and agree with SPEC's goal of creating fair and objective
14 * benchmarks to measure computer performance.
16 * This copyright notice is placed here only to protect SPEC in the
17 * event the source is misused in any manner that is contrary to the
18 * spirit, the goals and the intent of SPEC.
20 * The source code is provided to the user or company under the license
21 * agreement for the SPEC Benchmark Suite for this product.
24 /* @(#)auth.h 2.3 88/08/07 4.0 RPCSRC; from 1.17 88/02/08 SMI */
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 * auth.h, Authentication interface.
57 * Copyright (C) 1984, Sun Microsystems, Inc.
59 * The data structures are completely opaque to the client. The client
60 * is required to pass a AUTH * to routines that create rpc
65 #define MAX_AUTH_BYTES 400
66 #define MAXNETNAMELEN 255 /* maximum length of network user's name */
69 * Status returned from authentication check
74 * failed at remote end
76 AUTH_BADCRED=1, /* bogus credentials (seal broken) */
77 AUTH_REJECTEDCRED=2, /* client should begin new session */
78 AUTH_BADVERF=3, /* bogus verifier (seal broken) */
79 AUTH_REJECTEDVERF=4, /* verifier expired or was replayed */
80 AUTH_TOOWEAK=5, /* rejected due to security reasons */
84 AUTH_INVALIDRESP=6, /* bogus response verifier */
85 AUTH_FAILED=7 /* some unknown reason */
95 typedef union des_block des_block;
96 extern bool_t xdr_des_block();
99 * Authentication info. Opaque to client.
102 enum_t oa_flavor; /* flavor of auth */
103 void *oa_base; /* address of more auth stuff */
104 uint_t oa_length; /* not to exceed MAX_AUTH_BYTES */
109 * Auth handle, interface to client side authenticators.
112 struct opaque_auth ah_cred;
113 struct opaque_auth ah_verf;
114 union des_block ah_key;
116 void (*ah_nextverf)();
117 int (*ah_marshal)(); /* nextverf & serialize */
118 int (*ah_validate)(); /* validate varifier */
119 int (*ah_refresh)(); /* refresh credentials */
120 void (*ah_destroy)(); /* destroy this structure */
127 * Authentication ops.
128 * The ops and the auth handle provide the interface to the authenticators.
132 * struct opaque_auth verf;
134 #define AUTH_NEXTVERF(auth) \
135 ((*((auth)->ah_ops->ah_nextverf))(auth))
136 #define auth_nextverf(auth) \
137 ((*((auth)->ah_ops->ah_nextverf))(auth))
139 #define AUTH_MARSHALL(auth, xdrs) \
140 ((*((auth)->ah_ops->ah_marshal))(auth, xdrs))
141 #define auth_marshall(auth, xdrs) \
142 ((*((auth)->ah_ops->ah_marshal))(auth, xdrs))
144 #define AUTH_VALIDATE(auth, verfp) \
145 ((*((auth)->ah_ops->ah_validate))((auth), verfp))
146 #define auth_validate(auth, verfp) \
147 ((*((auth)->ah_ops->ah_validate))((auth), verfp))
149 #define AUTH_REFRESH(auth) \
150 ((*((auth)->ah_ops->ah_refresh))(auth))
151 #define auth_refresh(auth) \
152 ((*((auth)->ah_ops->ah_refresh))(auth))
154 #define AUTH_DESTROY(auth) \
155 ((*((auth)->ah_ops->ah_destroy))(auth))
156 #define auth_destroy(auth) \
157 ((*((auth)->ah_ops->ah_destroy))(auth))
160 extern struct opaque_auth _null_auth;
164 * These are the various implementations of client side authenticators.
168 * Unix style authentication
169 * AUTH *authunix_create(machname, uid, gid, len, aup_gids)
176 extern AUTH *authunix_create(char *, uid_t, gid_t, int, gid_t *);
177 extern AUTH *authunix_create_default(void);
178 extern AUTH *authnone_create(); /* takes no parameters */
179 extern AUTH *authdes_create();
181 #define AUTH_NONE 0 /* no authentication */
182 #define AUTH_NULL 0 /* backward compatibility */
183 #define AUTH_UNIX 1 /* unix style (uid, gids) */
184 #define AUTH_SHORT 2 /* short hand unix style */
185 #define AUTH_DES 3 /* des style (encrypted timestamps) */