1 /*********************************************************************
2 * RPC for the Windows NT Operating System
3 * 1993 by Martin F. Gergeleit
4 * Users may use, copy or modify Sun RPC for the Windows NT Operating
5 * System according to the Sun copyright below.
7 * RPC for the Windows NT Operating System COMES WITH ABSOLUTELY NO
8 * WARRANTY, NOR WILL I BE LIABLE FOR ANY DAMAGES INCURRED FROM THE
9 * USE OF. USE ENTIRELY AT YOUR OWN RISK!!!
10 *********************************************************************/
12 /* @(#)auth.h 2.3 88/08/07 4.0 RPCSRC; from 1.17 88/02/08 SMI */
14 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
15 * unrestricted use provided that this legend is included on all tape
16 * media and as a part of the software program in whole or part. Users
17 * may copy or modify Sun RPC without charge, but are not authorized
18 * to license or distribute it to anyone else except as part of a product or
19 * program developed by the user.
21 * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
22 * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
25 * Sun RPC is provided with no support and without any obligation on the
26 * part of Sun Microsystems, Inc. to assist in its use, correction,
27 * modification or enhancement.
29 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
30 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
31 * OR ANY PART THEREOF.
33 * In no event will Sun Microsystems, Inc. be liable for any lost revenue
34 * or profits or other special, indirect and consequential damages, even if
35 * Sun has been advised of the possibility of such damages.
37 * Sun Microsystems, Inc.
39 * Mountain View, California 94043
43 * auth.h, Authentication interface.
45 * Copyright (C) 1984, Sun Microsystems, Inc.
47 * The data structures are completely opaque to the client. The client
48 * is required to pass a AUTH * to routines that create rpc
52 #ifndef __AUTH_HEADER__
53 #define __AUTH_HEADER__
62 #define MAX_AUTH_BYTES 400
63 #define MAXNETNAMELEN 255 /* maximum length of network user's name */
66 * Status returned from authentication check
71 * failed at remote end
73 AUTH_BADCRED=1, /* bogus credentials (seal broken) */
74 AUTH_REJECTEDCRED=2, /* client should begin new session */
75 AUTH_BADVERF=3, /* bogus verifier (seal broken) */
76 AUTH_REJECTEDVERF=4, /* verifier expired or was replayed */
77 AUTH_TOOWEAK=5, /* rejected due to security reasons */
81 AUTH_INVALIDRESP=6, /* bogus response verifier */
82 AUTH_FAILED=7 /* some unknown reason */
85 #if (mc68000 || sparc || vax || i386)
86 typedef u_long u_int32; /* 32-bit unsigned integers */
104 typedef union des_block des_block;
105 extern bool_t xdr_des_block(DOTS);
108 * Authentication info. Opaque to client.
111 enum_t oa_flavor; /* flavor of auth */
112 caddr_t oa_base; /* address of more auth stuff */
113 u_int oa_length; /* not to exceed MAX_AUTH_BYTES */
118 * Auth handle, interface to client side authenticators.
121 struct opaque_auth ah_cred;
122 struct opaque_auth ah_verf;
123 union des_block ah_key;
125 void (*ah_nextverf)(DOTS);
126 int (*ah_marshal)(DOTS); /* nextverf & serialize */
127 int (*ah_validate)(DOTS); /* validate varifier */
128 int (*ah_refresh)(DOTS); /* refresh credentials */
129 void (*ah_destroy)(DOTS); /* destroy this structure */
136 * Authentication ops.
137 * The ops and the auth handle provide the interface to the authenticators.
141 * struct opaque_auth verf;
143 #define AUTH_NEXTVERF(auth) \
144 ((*((auth)->ah_ops->ah_nextverf))(auth))
145 #define auth_nextverf(auth) \
146 ((*((auth)->ah_ops->ah_nextverf))(auth))
148 #define AUTH_MARSHALL(auth, xdrs) \
149 ((*((auth)->ah_ops->ah_marshal))(auth, xdrs))
150 #define auth_marshall(auth, xdrs) \
151 ((*((auth)->ah_ops->ah_marshal))(auth, xdrs))
153 #define AUTH_VALIDATE(auth, verfp) \
154 ((*((auth)->ah_ops->ah_validate))((auth), verfp))
155 #define auth_validate(auth, verfp) \
156 ((*((auth)->ah_ops->ah_validate))((auth), verfp))
158 #define AUTH_REFRESH(auth) \
159 ((*((auth)->ah_ops->ah_refresh))(auth))
160 #define auth_refresh(auth) \
161 ((*((auth)->ah_ops->ah_refresh))(auth))
163 #define AUTH_DESTROY(auth) \
164 ((*((auth)->ah_ops->ah_destroy))(auth))
165 #define auth_destroy(auth) \
166 ((*((auth)->ah_ops->ah_destroy))(auth))
171 extern struct opaque_auth _null_auth;
174 extern __declspec(dllimport) struct opaque_auth _null_auth;
176 _declspec(dllimport) struct opaque_auth _null_auth;
180 extern struct opaque_auth _null_auth;
183 #define _null_auth (*_thr_null_auth())
186 * These are the various implementations of client side authenticators.
190 * Unix style authentication
191 * AUTH *authunix_create(machname, uid, gid, len, aup_gids)
198 extern AUTH *authunix_create(DOTS);
199 extern AUTH *authunix_create_default(DOTS); /* takes no parameters */
200 extern AUTH *authnone_create(DOTS); /* takes no parameters */
201 extern AUTH *authdes_create(DOTS);
203 #define AUTH_NONE 0 /* no authentication */
204 #define AUTH_NULL 0 /* backward compatibility */
205 #define AUTH_UNIX 1 /* unix style (uid, gids) */
206 #define AUTH_SHORT 2 /* short hand unix style */
207 #define AUTH_DES 3 /* des style (encrypted timestamps) */
213 #endif /* __AUTH_HEADER__ */