2 * RPC authentication interface.
6 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
7 * unrestricted use provided that this legend is included on all tape
8 * media and as a part of the software program in whole or part. Users
9 * may copy or modify Sun RPC without charge, but are not authorized
10 * to license or distribute it to anyone else except as part of a product or
11 * program developed by the user.
13 * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
14 * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
15 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
17 * Sun RPC is provided with no support and without any obligation on the
18 * part of Sun Microsystems, Inc. to assist in its use, correction,
19 * modification or enhancement.
21 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
22 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
23 * OR ANY PART THEREOF.
25 * In no event will Sun Microsystems, Inc. be liable for any lost revenue
26 * or profits or other special, indirect and consequential damages, even if
27 * Sun has been advised of the possibility of such damages.
29 * Sun Microsystems, Inc.
31 * Mountain View, California 94043
33 * from: @(#)auth.h 1.17 88/02/08 SMI
34 * from: @(#)auth.h 2.3 88/08/07 4.0 RPCSRC
35 * $Id: auth.h,v 1.5 1996/01/31 08:02:11 hsu Exp $
39 * auth.h, Authentication interface.
41 * Copyright (C) 1984, Sun Microsystems, Inc.
43 * The data structures are completely opaque to the client. The client
44 * is required to pass a AUTH * to routines that create rpc
52 #include <sys/cdefs.h>
55 #ifndef __SYS_SOCKET_H
56 #include <sys/socket.h>
59 #define MAX_AUTH_BYTES 400
60 #define MAXNETNAMELEN 255 /* maximum length of network user's name */
63 * Status returned from authentication check
68 * failed at remote end
70 AUTH_BADCRED=1, /* bogus credentials (seal broken) */
71 AUTH_REJECTEDCRED=2, /* client should begin new session */
72 AUTH_BADVERF=3, /* bogus verifier (seal broken) */
73 AUTH_REJECTEDVERF=4, /* verifier expired or was replayed */
74 AUTH_TOOWEAK=5, /* rejected due to security reasons */
78 AUTH_INVALIDRESP=6, /* bogus response verifier */
79 AUTH_FAILED=7 /* some unknown reason */
90 typedef union des_block des_block;
94 extern bool_t xdr_des_block (XDR *, des_block *);
99 * Authentication info. Opaque to client.
102 enum_t oa_flavor; /* flavor of auth */
103 caddr_t oa_base; /* address of more auth stuff */
104 u_int oa_length; /* not to exceed MAX_AUTH_BYTES */
108 * Auth handle, interface to client side authenticators.
111 struct opaque_auth ah_cred;
112 struct opaque_auth ah_verf;
113 union des_block ah_key;
115 void (*ah_nextverf)();
116 int (*ah_marshal)(); /* nextverf & serialize */
117 int (*ah_validate)(); /* validate verifier */
118 int (*ah_refresh)(); /* refresh credentials */
119 void (*ah_destroy)(); /* destroy this structure */
126 * Authentication ops.
127 * The ops and the auth handle provide the interface to the authenticators.
131 * struct opaque_auth verf;
133 #define AUTH_NEXTVERF(auth) ((*((auth)->ah_ops->ah_nextverf))(auth))
134 #define auth_nextverf(auth) ((*((auth)->ah_ops->ah_nextverf))(auth))
136 #define AUTH_MARSHALL(auth,xdrs) ((*((auth)->ah_ops->ah_marshal))(auth, xdrs))
137 #define auth_marshall(auth,xdrs) ((*((auth)->ah_ops->ah_marshal))(auth, xdrs))
139 #define AUTH_VALIDATE(auth,verfp) ((*((auth)->ah_ops->ah_validate))((auth), verfp))
140 #define auth_validate(auth,verfp) ((*((auth)->ah_ops->ah_validate))((auth), verfp))
142 #define AUTH_REFRESH(auth) ((*((auth)->ah_ops->ah_refresh))(auth))
143 #define auth_refresh(auth) ((*((auth)->ah_ops->ah_refresh))(auth))
145 #define AUTH_DESTROY(auth) ((*((auth)->ah_ops->ah_destroy))(auth))
146 #define auth_destroy(auth) ((*((auth)->ah_ops->ah_destroy))(auth))
148 extern struct opaque_auth _null_auth;
152 * These are the various implementations of client side authenticators.
156 * Unix style authentication
157 * AUTH *authunix_create(machname, uid, gid, len, aup_gids)
167 extern AUTH *authunix_create (char *, int, int, int, int *);
168 extern AUTH *authunix_create_default(void);
169 extern AUTH *authnone_create (void);
170 extern AUTH *authdes_create (char*, u_int, struct sockaddr*, des_block*);
174 #define AUTH_NONE 0 /* no authentication */
175 #define AUTH_NULL 0 /* backward compatibility */
176 #define AUTH_UNIX 1 /* unix style (uid, gids) */
177 #define AUTH_SHORT 2 /* short hand unix style */
178 #define AUTH_DES 3 /* des style (encrypted timestamps) */