Where Online Learning is simpler!
The C and C++ Include Header Files
/usr/include/tirpc/rpc/auth.h
$ cat -n /usr/include/tirpc/rpc/auth.h 1 /* $NetBSD: auth.h,v 1.15 2000/06/02 22:57:55 fvdl Exp $ */ 2 3 /* 4 * Copyright (c) 2009, Sun Microsystems, Inc. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions are met: 9 * - Redistributions of source code must retain the above copyright notice, 10 * this list of conditions and the following disclaimer. 11 * - Redistributions in binary form must reproduce the above copyright notice, 12 * this list of conditions and the following disclaimer in the documentation 13 * and/or other materials provided with the distribution. 14 * - Neither the name of Sun Microsystems, Inc. nor the names of its 15 * contributors may be used to endorse or promote products derived 16 * from this software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * POSSIBILITY OF SUCH DAMAGE. 29 * 30 * from: @(#)auth.h 1.17 88/02/08 SMI 31 * from: @(#)auth.h 2.3 88/08/07 4.0 RPCSRC 32 * from: @(#)auth.h 1.43 98/02/02 SMI 33 * $FreeBSD: src/include/rpc/auth.h,v 1.20 2003/01/01 18:48:42 schweikh Exp $ 34 */ 35 36 /* 37 * auth.h, Authentication interface. 38 * 39 * Copyright (C) 1984, Sun Microsystems, Inc. 40 * 41 * The data structures are completely opaque to the client. The client 42 * is required to pass an AUTH * to routines that create rpc 43 * "sessions". 44 */ 45 46 #ifndef _TIRPC_AUTH_H 47 #define _TIRPC_AUTH_H 48 49 #include
50 #include
51 #include
52 #include
53 54 55 #define MAX_AUTH_BYTES 400 56 #define MAXNETNAMELEN 255 /* maximum length of network user's name */ 57 58 /* 59 * Client side authentication/security data 60 */ 61 62 typedef struct sec_data { 63 u_int secmod; /* security mode number e.g. in nfssec.conf */ 64 u_int rpcflavor; /* rpc flavors:AUTH_UNIX,AUTH_DES,RPCSEC_GSS */ 65 int flags; /* AUTH_F_xxx flags */ 66 caddr_t data; /* opaque data per flavor */ 67 } sec_data_t; 68 69 #ifdef _SYSCALL32_IMPL 70 struct sec_data32 { 71 uint32_t secmod; /* security mode number e.g. in nfssec.conf */ 72 uint32_t rpcflavor; /* rpc flavors:AUTH_UNIX,AUTH_DES,RPCSEC_GSS */ 73 int32_t flags; /* AUTH_F_xxx flags */ 74 caddr32_t data; /* opaque data per flavor */ 75 }; 76 #endif /* _SYSCALL32_IMPL */ 77 78 /* 79 * AUTH_DES flavor specific data from sec_data opaque data field. 80 * AUTH_KERB has the same structure. 81 */ 82 typedef struct des_clnt_data { 83 struct netbuf syncaddr; /* time sync addr */ 84 struct knetconfig *knconf; /* knetconfig info that associated */ 85 /* with the syncaddr. */ 86 char *netname; /* server's netname */ 87 int netnamelen; /* server's netname len */ 88 } dh_k4_clntdata_t; 89 90 #ifdef _SYSCALL32_IMPL 91 struct des_clnt_data32 { 92 struct netbuf32 syncaddr; /* time sync addr */ 93 caddr32_t knconf; /* knetconfig info that associated */ 94 /* with the syncaddr. */ 95 caddr32_t netname; /* server's netname */ 96 int32_t netnamelen; /* server's netname len */ 97 }; 98 #endif /* _SYSCALL32_IMPL */ 99 100 /* 101 * authentication/security specific flags 102 */ 103 #define AUTH_F_RPCTIMESYNC 0x001 /* use RPC to do time sync */ 104 #define AUTH_F_TRYNONE 0x002 /* allow fall back to AUTH_NONE */ 105 106 107 /* 108 * Status returned from authentication check 109 */ 110 enum auth_stat { 111 AUTH_OK=0, 112 /* 113 * failed at remote end 114 */ 115 AUTH_BADCRED=1, /* bogus credentials (seal broken) */ 116 AUTH_REJECTEDCRED=2, /* client should begin new session */ 117 AUTH_BADVERF=3, /* bogus verifier (seal broken) */ 118 AUTH_REJECTEDVERF=4, /* verifier expired or was replayed */ 119 AUTH_TOOWEAK=5, /* rejected due to security reasons */ 120 /* 121 * failed locally 122 */ 123 AUTH_INVALIDRESP=6, /* bogus response verifier */ 124 AUTH_FAILED=7, /* some unknown reason */ 125 /* 126 * kerberos errors 127 */ 128 AUTH_KERB_GENERIC = 8, /* kerberos generic error */ 129 AUTH_TIMEEXPIRE = 9, /* time of credential expired */ 130 AUTH_TKT_FILE = 10, /* something wrong with ticket file */ 131 AUTH_DECODE = 11, /* can't decode authenticator */ 132 AUTH_NET_ADDR = 12, /* wrong net address in ticket */ 133 /* 134 * RPCSEC_GSS errors 135 */ 136 RPCSEC_GSS_CREDPROBLEM = 13, 137 RPCSEC_GSS_CTXPROBLEM = 14 138 139 }; 140 141 typedef u_int32_t u_int32; /* 32-bit unsigned integers */ 142 143 union des_block { 144 struct { 145 u_int32_t high; 146 u_int32_t low; 147 } key; 148 char c[8]; 149 }; 150 typedef union des_block des_block; 151 #ifdef __cplusplus 152 extern "C" { 153 #endif 154 extern bool_t xdr_des_block(XDR *, des_block *); 155 #ifdef __cplusplus 156 } 157 #endif 158 159 /* 160 * Authentication info. Opaque to client. 161 */ 162 struct opaque_auth { 163 enum_t oa_flavor; /* flavor of auth */ 164 caddr_t oa_base; /* address of more auth stuff */ 165 u_int oa_length; /* not to exceed MAX_AUTH_BYTES */ 166 }; 167 168 169 /* 170 * Auth handle, interface to client side authenticators. 171 */ 172 typedef struct __auth { 173 struct opaque_auth ah_cred; 174 struct opaque_auth ah_verf; 175 union des_block ah_key; 176 struct auth_ops { 177 void (*ah_nextverf) (struct __auth *); 178 /* nextverf & serialize */ 179 int (*ah_marshal) (struct __auth *, XDR *); 180 /* validate verifier */ 181 int (*ah_validate) (struct __auth *, 182 struct opaque_auth *); 183 /* refresh credentials */ 184 int (*ah_refresh) (struct __auth *, void *); 185 /* destroy this structure */ 186 void (*ah_destroy) (struct __auth *); 187 /* encode data for wire */ 188 int (*ah_wrap) (struct __auth *, XDR *, xdrproc_t, caddr_t); 189 /* decode data for wire */ 190 int (*ah_unwrap) (struct __auth *, XDR *, xdrproc_t, caddr_t); 191 192 } *ah_ops; 193 void *ah_private; 194 } AUTH; 195 196 /* 197 * Authentication ops. 198 * The ops and the auth handle provide the interface to the authenticators. 199 * 200 * AUTH *auth; 201 * XDR *xdrs; 202 * struct opaque_auth verf; 203 */ 204 #define AUTH_NEXTVERF(auth) \ 205 ((*((auth)->ah_ops->ah_nextverf))(auth)) 206 #define auth_nextverf(auth) \ 207 ((*((auth)->ah_ops->ah_nextverf))(auth)) 208 209 #define AUTH_MARSHALL(auth, xdrs) \ 210 ((*((auth)->ah_ops->ah_marshal))(auth, xdrs)) 211 #define auth_marshall(auth, xdrs) \ 212 ((*((auth)->ah_ops->ah_marshal))(auth, xdrs)) 213 214 #define AUTH_VALIDATE(auth, verfp) \ 215 ((*((auth)->ah_ops->ah_validate))((auth), verfp)) 216 #define auth_validate(auth, verfp) \ 217 ((*((auth)->ah_ops->ah_validate))((auth), verfp)) 218 219 #define AUTH_REFRESH(auth, msg) \ 220 ((*((auth)->ah_ops->ah_refresh))(auth, msg)) 221 #define auth_refresh(auth, msg) \ 222 ((*((auth)->ah_ops->ah_refresh))(auth, msg)) 223 224 #define AUTH_DESTROY(auth) \ 225 ((*((auth)->ah_ops->ah_destroy))(auth)); 226 #define auth_destroy(auth) \ 227 ((*((auth)->ah_ops->ah_destroy))(auth)); 228 229 #define AUTH_WRAP(auth, xdrs, xfunc, xwhere) \ 230 ((*((auth)->ah_ops->ah_wrap))(auth, xdrs, \ 231 xfunc, xwhere)) 232 #define auth_wrap(auth, xdrs, xfunc, xwhere) \ 233 ((*((auth)->ah_ops->ah_wrap))(auth, xdrs, \ 234 xfunc, xwhere)) 235 236 #define AUTH_UNWRAP(auth, xdrs, xfunc, xwhere) \ 237 ((*((auth)->ah_ops->ah_unwrap))(auth, xdrs, \ 238 xfunc, xwhere)) 239 #define auth_unwrap(auth, xdrs, xfunc, xwhere) \ 240 ((*((auth)->ah_ops->ah_unwrap))(auth, xdrs, \ 241 xfunc, xwhere)) 242 243 244 #ifdef __cplusplus 245 extern "C" { 246 #endif 247 extern struct opaque_auth _null_auth; 248 #ifdef __cplusplus 249 } 250 #endif 251 252 /* 253 * Any style authentication. These routines can be used by any 254 * authentication style that does not use the wrap/unwrap functions. 255 */ 256 int authany_wrap(void), authany_unwrap(void); 257 258 /* 259 * These are the various implementations of client side authenticators. 260 */ 261 262 /* 263 * System style authentication 264 * AUTH *authunix_create(machname, uid, gid, len, aup_gids) 265 * char *machname; 266 * int uid; 267 * int gid; 268 * int len; 269 * int *aup_gids; 270 */ 271 #ifdef __cplusplus 272 extern "C" { 273 #endif 274 extern AUTH *authunix_create(char *, uid_t, uid_t, int, uid_t *); 275 extern AUTH *authunix_create_default(void); /* takes no parameters */ 276 extern AUTH *authnone_create(void); /* takes no parameters */ 277 #ifdef __cplusplus 278 } 279 #endif 280 /* 281 * DES style authentication 282 * AUTH *authsecdes_create(servername, window, timehost, ckey) 283 * char *servername; - network name of server 284 * u_int window; - time to live 285 * const char *timehost; - optional hostname to sync with 286 * des_block *ckey; - optional conversation key to use 287 */ 288 #ifdef __cplusplus 289 extern "C" { 290 #endif 291 extern AUTH *authdes_create (char *, u_int, struct sockaddr *, des_block *); 292 extern AUTH *authdes_pk_create (char *, netobj *, u_int, 293 struct sockaddr *, des_block *); 294 extern AUTH *authdes_seccreate (const char *, const u_int, const char *, 295 const des_block *); 296 #ifdef __cplusplus 297 } 298 #endif 299 300 #ifdef __cplusplus 301 extern "C" { 302 #endif 303 extern bool_t xdr_opaque_auth (XDR *, struct opaque_auth *); 304 #ifdef __cplusplus 305 } 306 #endif 307 308 #define authsys_create(c,i1,i2,i3,ip) authunix_create((c),(i1),(i2),(i3),(ip)) 309 #define authsys_create_default() authunix_create_default() 310 311 /* 312 * Netname manipulation routines. 313 */ 314 #ifdef __cplusplus 315 extern "C" { 316 #endif 317 extern int getnetname(char *); 318 extern int host2netname(char *, const char *, const char *); 319 extern int user2netname(char *, const uid_t, const char *); 320 extern int netname2user(char *, uid_t *, gid_t *, int *, gid_t *); 321 extern int netname2host(char *, char *, const int); 322 extern void passwd2des ( char *, char * ); 323 #ifdef __cplusplus 324 } 325 #endif 326 327 /* 328 * 329 * These routines interface to the keyserv daemon 330 * 331 */ 332 #ifdef __cplusplus 333 extern "C" { 334 #endif 335 extern int key_decryptsession(const char *, des_block *); 336 extern int key_encryptsession(const char *, des_block *); 337 extern int key_gendes(des_block *); 338 extern int key_setsecret(const char *); 339 extern int key_secretkey_is_set(void); 340 #ifdef __cplusplus 341 } 342 #endif 343 344 /* 345 * Publickey routines. 346 */ 347 #ifdef __cplusplus 348 extern "C" { 349 #endif 350 extern int getpublickey (const char *, char *); 351 extern int getpublicandprivatekey (char *, char *); 352 extern int getsecretkey (char *, char *, char *); 353 #ifdef __cplusplus 354 } 355 #endif 356 357 #ifdef __cplusplus 358 extern "C" { 359 #endif 360 struct svc_req; 361 struct rpc_msg; 362 enum auth_stat _svcauth_none (struct svc_req *, struct rpc_msg *); 363 enum auth_stat _svcauth_short (struct svc_req *, struct rpc_msg *); 364 enum auth_stat _svcauth_unix (struct svc_req *, struct rpc_msg *); 365 enum auth_stat _svcauth_gss (struct svc_req *, struct rpc_msg *, bool_t *); 366 #ifdef __cplusplus 367 } 368 #endif 369 370 #define AUTH_NONE 0 /* no authentication */ 371 #define AUTH_NULL 0 /* backward compatibility */ 372 #define AUTH_SYS 1 /* unix style (uid, gids) */ 373 #define AUTH_UNIX AUTH_SYS 374 #define AUTH_SHORT 2 /* short hand unix style */ 375 #define AUTH_DH 3 /* for Diffie-Hellman mechanism */ 376 #define AUTH_DES AUTH_DH /* for backward compatibility */ 377 #define AUTH_KERB 4 /* kerberos style */ 378 #define RPCSEC_GSS 6 /* RPCSEC_GSS */ 379 380 #endif /* !_TIRPC_AUTH_H */
Contact us
|
About us
|
Term of use
|
Copyright © 2000-2025 MyWebUniversity.com ™