|
|
1.1 ! root 1: /* ! 2: * Sun RPC is a product of Sun Microsystems, Inc. and is provided for ! 3: * unrestricted use provided that this legend is included on all tape ! 4: * media and as a part of the software program in whole or part. Users ! 5: * may copy or modify Sun RPC without charge, but are not authorized ! 6: * to license or distribute it to anyone else except as part of a product or ! 7: * program developed by the user. ! 8: * ! 9: * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE ! 10: * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR ! 11: * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. ! 12: * ! 13: * Sun RPC is provided with no support and without any obligation on the ! 14: * part of Sun Microsystems, Inc. to assist in its use, correction, ! 15: * modification or enhancement. ! 16: * ! 17: * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE ! 18: * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC ! 19: * OR ANY PART THEREOF. ! 20: * ! 21: * In no event will Sun Microsystems, Inc. be liable for any lost revenue ! 22: * or profits or other special, indirect and consequential damages, even if ! 23: * Sun has been advised of the possibility of such damages. ! 24: * ! 25: * Sun Microsystems, Inc. ! 26: * 2550 Garcia Avenue ! 27: * Mountain View, California 94043 ! 28: */ ! 29: /* @(#)auth.h 1.3 85/03/28 SMI */ ! 30: ! 31: /* ! 32: * auth.h, Authentication interface. ! 33: ! 34: * Copyright (C) 1984, Sun Microsystems, Inc. ! 35: * ! 36: * The data structures are completely opaque to the client. The client ! 37: * is required to pass a AUTH * to routines that create rpc ! 38: * "sessions". ! 39: */ ! 40: ! 41: ! 42: #define MAX_AUTH_BYTES 400 ! 43: ! 44: ! 45: /* ! 46: * Status returned from authentication check ! 47: */ ! 48: enum auth_stat { ! 49: AUTH_OK=0, ! 50: /* ! 51: * failed at remote end ! 52: */ ! 53: AUTH_BADCRED=1, /* bogus credentials (seal broken) */ ! 54: AUTH_REJECTEDCRED=2, /* client should begin new session */ ! 55: AUTH_BADVERF=3, /* bogus verifier (seal broken) */ ! 56: AUTH_REJECTEDVERF=4, /* verifier expired or was replayed */ ! 57: AUTH_TOOWEAK=5, /* rejected due to security reasons */ ! 58: /* ! 59: * failed locally ! 60: */ ! 61: AUTH_INVALIDRESP=6, /* bogus response verifier */ ! 62: AUTH_FAILED=7 /* some unknown reason */ ! 63: }; ! 64: ! 65: ! 66: union des_block { ! 67: struct { ! 68: u_long high; ! 69: u_long low; ! 70: } key; ! 71: char c[8]; ! 72: }; ! 73: ! 74: ! 75: /* ! 76: * Authentication info. Opaque to client. ! 77: */ ! 78: struct opaque_auth { ! 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 */ ! 82: }; ! 83: ! 84: ! 85: /* ! 86: * Auth handle, interface to client side authenticators. ! 87: */ ! 88: typedef struct { ! 89: struct opaque_auth ah_cred; ! 90: struct opaque_auth ah_verf; ! 91: union des_block ah_key; ! 92: struct auth_ops { ! 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 */ ! 98: } *ah_ops; ! 99: caddr_t ah_private; ! 100: } AUTH; ! 101: ! 102: ! 103: /* ! 104: * Authentication ops. ! 105: * The ops and the auth handle provide the interface to the authenticators. ! 106: * ! 107: * AUTH *auth; ! 108: * XDR *xdrs; ! 109: * struct opaque_auth verf; ! 110: */ ! 111: #define AUTH_NEXTVERF(auth) \ ! 112: ((*((auth)->ah_ops->ah_nextverf))(auth)) ! 113: #define auth_nextverf(auth) \ ! 114: ((*((auth)->ah_ops->ah_nextverf))(auth)) ! 115: ! 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)) ! 120: ! 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)) ! 125: ! 126: #define AUTH_REFRESH(auth) \ ! 127: ((*((auth)->ah_ops->ah_refresh))(auth)) ! 128: #define auth_refresh(auth) \ ! 129: ((*((auth)->ah_ops->ah_refresh))(auth)) ! 130: ! 131: #define AUTH_DESTROY(auth) \ ! 132: ((*((auth)->ah_ops->ah_destroy))(auth)) ! 133: #define auth_destroy(auth) \ ! 134: ((*((auth)->ah_ops->ah_destroy))(auth)) ! 135: ! 136: ! 137: extern struct opaque_auth _null_auth; ! 138: ! 139: ! 140: /* ! 141: * These are the various implementations of client side authenticators. ! 142: */ ! 143: ! 144: /* ! 145: * Null authentication ! 146: */ ! 147: extern AUTH *authnone_create(); /* takes no parameters */ ! 148: #define AUTH_NULL 0 ! 149: ! 150: /* ! 151: * Unix style authentication ! 152: * AUTH *authunix_create(machname, uid, gid, len, aup_gids) ! 153: * char *machname; ! 154: * int uid; ! 155: * int gid; ! 156: * int len; ! 157: * int *aup_gids; ! 158: */ ! 159: extern AUTH *authunix_create(); ! 160: extern AUTH *authunix_create_default(); /* takes no parameters */ ! 161: #define AUTH_UNIX 1 /* unix style (uid, gids) */ ! 162: #define AUTH_SHORT 2 /* short hand unix style */ ! 163:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.