]>
git.saurik.com Git - apple/libinfo.git/blob - rpc.subproj/auth.h
6126919af945addf8556e5746714ab73c6bb27eb
2 * Copyright (c) 1999-2018 Apple Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7 * Reserved. This file contains Original Code and/or Modifications of
8 * Original Code as defined in and that are subject to the Apple Public
9 * Source License Version 1.1 (the "License"). You may not use this file
10 * except in compliance with the License. Please obtain a copy of the
11 * License at http://www.apple.com/publicsource and read it before using
14 * The Original Code and all software distributed under the License are
15 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE OR NON- INFRINGEMENT. Please see the
19 * License for the specific language governing rights and limitations
22 * @APPLE_LICENSE_HEADER_END@
25 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
26 * unrestricted use provided that this legend is included on all tape
27 * media and as a part of the software program in whole or part. Users
28 * may copy or modify Sun RPC without charge, but are not authorized
29 * to license or distribute it to anyone else except as part of a product or
30 * program developed by the user.
32 * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
33 * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
34 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
36 * Sun RPC is provided with no support and without any obligation on the
37 * part of Sun Microsystems, Inc. to assist in its use, correction,
38 * modification or enhancement.
40 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
41 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
42 * OR ANY PART THEREOF.
44 * In no event will Sun Microsystems, Inc. be liable for any lost revenue
45 * or profits or other special, indirect and consequential damages, even if
46 * Sun has been advised of the possibility of such damages.
48 * Sun Microsystems, Inc.
50 * Mountain View, California 94043
52 * from: @(#)auth.h 1.17 88/02/08 SMI
53 * from: @(#)auth.h 2.3 88/08/07 4.0 RPCSRC
54 * $Id: auth.h,v 1.4 2004/11/25 19:41:19 emoy Exp $
58 * auth.h, Authentication interface.
60 * Copyright (C) 1984, Sun Microsystems, Inc.
62 * The data structures are completely opaque to the client. The client
63 * is required to pass a AUTH * to routines that create rpc
69 #include <rpc/types.h>
71 #include <sys/cdefs.h>
73 #define MAX_AUTH_BYTES 400
74 #define MAXNETNAMELEN 255 /* maximum length of network user's name */
77 * Status returned from authentication check
82 * failed at remote end
84 AUTH_BADCRED
=1, /* bogus credentials (seal broken) */
85 AUTH_REJECTEDCRED
=2, /* client should begin new session */
86 AUTH_BADVERF
=3, /* bogus verifier (seal broken) */
87 AUTH_REJECTEDVERF
=4, /* verifier expired or was replayed */
88 AUTH_TOOWEAK
=5, /* rejected due to security reasons */
92 AUTH_INVALIDRESP
=6, /* bogus response verifier */
93 AUTH_FAILED
=7 /* some unknown reason */
96 /* 32-bit unsigned integers */
98 typedef unsigned int u_int32
;
100 typedef unsigned long u_int32
;
110 typedef union des_block des_block
;
112 extern bool_t xdr_des_block
__P((XDR
*, des_block
*));
116 * Authentication info. Opaque to client.
119 enum_t oa_flavor
; /* flavor of auth */
120 caddr_t oa_base
; /* address of more auth stuff */
121 unsigned int oa_length
; /* not to exceed MAX_AUTH_BYTES */
126 * Auth handle, interface to client side authenticators.
129 struct opaque_auth ah_cred
;
130 struct opaque_auth ah_verf
;
131 union des_block ah_key
;
134 void (*ah_nextverf
)(...);
135 int (*ah_marshal
)(...); /* nextverf & serialize */
136 int (*ah_validate
)(...); /* validate varifier */
137 int (*ah_refresh
)(...); /* refresh credentials */
138 void (*ah_destroy
)(...); /* destroy this structure */
140 /* DO NOT REMOVE THE COMMENTED OUT ...: fixincludes needs to see them */
141 void (*ah_nextverf
)(/*...*/);
142 int (*ah_marshal
)(/*...*/); /* nextverf & serialize */
143 int (*ah_validate
)(/*...*/); /* validate varifier */
144 int (*ah_refresh
)(/*...*/); /* refresh credentials */
145 void (*ah_destroy
)(/*...*/); /* destroy this structure */
153 * Authentication ops.
154 * The ops and the auth handle provide the interface to the authenticators.
158 * struct opaque_auth verf;
160 #define AUTH_NEXTVERF(auth) \
161 ((*((auth)->ah_ops->ah_nextverf))(auth))
162 #define auth_nextverf(auth) \
163 ((*((auth)->ah_ops->ah_nextverf))(auth))
165 #define AUTH_MARSHALL(auth, xdrs) \
166 ((*((auth)->ah_ops->ah_marshal))(auth, xdrs))
167 #define auth_marshall(auth, xdrs) \
168 ((*((auth)->ah_ops->ah_marshal))(auth, xdrs))
170 #define AUTH_VALIDATE(auth, verfp) \
171 ((*((auth)->ah_ops->ah_validate))((auth), verfp))
172 #define auth_validate(auth, verfp) \
173 ((*((auth)->ah_ops->ah_validate))((auth), verfp))
175 #define AUTH_REFRESH(auth) \
176 ((*((auth)->ah_ops->ah_refresh))(auth))
177 #define auth_refresh(auth) \
178 ((*((auth)->ah_ops->ah_refresh))(auth))
180 #define AUTH_DESTROY(auth) \
181 ((*((auth)->ah_ops->ah_destroy))(auth))
182 #define auth_destroy(auth) \
183 ((*((auth)->ah_ops->ah_destroy))(auth))
186 extern struct opaque_auth _null_auth
;
190 * These are the various implementations of client side authenticators.
194 * Unix style authentication
195 * AUTH *authunix_create(machname, uid, gid, len, aup_gids)
203 extern AUTH
*authunix_create
__P((char *, int, int, int, int *));
204 extern AUTH
*authunix_create_default
__P((void));
205 extern AUTH
*authnone_create
__P((void));
206 #if (!defined(LIBINFO_INSTALL_API) || !LIBINFO_INSTALL_API)
207 extern AUTH
*authdes_create
__P((char *, unsigned int,
208 struct sockaddr_in
*,
213 #define AUTH_NONE 0 /* no authentication */
214 #define AUTH_NULL 0 /* backward compatibility */
215 #define AUTH_UNIX 1 /* unix style (uid, gids) */
216 #define AUTH_SHORT 2 /* short hand unix style */
217 #define AUTH_DES 3 /* des style (encrypted timestamps) */
219 #endif /* !_RPC_AUTH_H */