4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
22 #pragma ident "%Z%%M% %I% %E% SMI"
25 * auth.h, Authentication interface.
27 * Copyright (C) 1984, Sun Microsystems, Inc.
29 * The data structures are completely opaque to the client. The client
30 * is required to pass a AUTH * to routines that create rpc
38 #define MAX_AUTH_BYTES 400
39 #define MAXNETNAMELEN 255 /* maximum length of network user's name */
42 * Status returned from authentication check
47 * failed at remote end
49 AUTH_BADCRED
=1, /* bogus credentials (seal broken) */
50 AUTH_REJECTEDCRED
=2, /* client should begin new session */
51 AUTH_BADVERF
=3, /* bogus verifier (seal broken) */
52 AUTH_REJECTEDVERF
=4, /* verifier expired or was replayed */
53 AUTH_TOOWEAK
=5, /* rejected due to security reasons */
57 AUTH_INVALIDRESP
=6, /* bogus response verifier */
58 AUTH_FAILED
=7 /* some unknown reason */
61 #if (mc68000 || sparc || vax || i386)
62 typedef u_long u_int32
; /* 32-bit unsigned integers */
72 typedef union des_block des_block
;
73 extern bool_t
xdr_des_block();
76 * Authentication info. Opaque to client.
79 enum_t oa_flavor
; /* flavor of auth */
80 caddr_t oa_base
; /* address of more auth stuff */
81 u_int oa_length
; /* not to exceed MAX_AUTH_BYTES */
86 * Auth handle, interface to client side authenticators.
89 struct opaque_auth ah_cred
;
90 struct opaque_auth ah_verf
;
91 union des_block ah_key
;
93 void (*ah_nextverf
)();
94 int (*ah_marshal
)(); /* nextverf & serialize */
95 int (*ah_validate
)(); /* validate varifier */
96 int (*ah_refresh
)(); /* refresh credentials */
97 void (*ah_destroy
)(); /* destroy this structure */
104 * Authentication ops.
105 * The ops and the auth handle provide the interface to the authenticators.
109 * struct opaque_auth verf;
111 #define AUTH_NEXTVERF(auth) \
112 ((*((auth)->ah_ops->ah_nextverf))(auth))
113 #define auth_nextverf(auth) \
114 ((*((auth)->ah_ops->ah_nextverf))(auth))
116 #define AUTH_MARSHALL(auth, xdrs) \
117 ((*((auth)->ah_ops->ah_marshal))(auth, xdrs))
118 #define auth_marshall(auth, xdrs) \
119 ((*((auth)->ah_ops->ah_marshal))(auth, xdrs))
121 #define AUTH_VALIDATE(auth, verfp) \
122 ((*((auth)->ah_ops->ah_validate))((auth), verfp))
123 #define auth_validate(auth, verfp) \
124 ((*((auth)->ah_ops->ah_validate))((auth), verfp))
126 #define AUTH_REFRESH(auth) \
127 ((*((auth)->ah_ops->ah_refresh))(auth))
128 #define auth_refresh(auth) \
129 ((*((auth)->ah_ops->ah_refresh))(auth))
131 #define AUTH_DESTROY(auth) \
132 ((*((auth)->ah_ops->ah_destroy))(auth))
133 #define auth_destroy(auth) \
134 ((*((auth)->ah_ops->ah_destroy))(auth))
137 extern struct opaque_auth _null_auth
;
141 * These are the various implementations of client side authenticators.
145 * Unix style authentication
146 * AUTH *authunix_create(machname, uid, gid, len, aup_gids)
154 extern AUTH
*authkern_create(); /* takes no parameters */
156 extern AUTH
*authsys_create(const char *, const uid_t
, const gid_t
,
157 const int, const gid_t
*);
158 extern AUTH
*authsys_create_default(void); /* takes no parameters */
159 extern AUTH
*authnone_create(); /* takes no parameters */
161 extern AUTH
*authdes_create();
163 #define AUTH_NONE 0 /* no authentication */
164 #define AUTH_NULL 0 /* backward compatibility */
165 #define AUTH_UNIX 1 /* unix style (uid, gids) */
166 #define AUTH_SHORT 2 /* short hand unix style */
167 #define AUTH_DES 3 /* des style (encrypted timestamps) */
169 #endif /* !_rpc_auth_h */