auth.h
001:
002:
003:
004:
005:
006:
007:
008:
009:
010:
011:
012:
013:
014:
015:
016:
017:
018:
019:
020:
021:
022:
023:
024:
025:
026:
027:
028:
029:
030:
031:
032:
033:
034:
035:
036:
037:
038: #ifndef _RPC_AUTH_H
039:
040: #define _RPC_AUTH_H 1
041: #include <features.h>
042: #include <rpc/xdr.h>
043:
044: __BEGIN_DECLS
045:
046: #define MAX_AUTH_BYTES 400
047: #define MAXNETNAMELEN 255
048:
049:
050:
051:
052: enum auth_stat {
053: AUTH_OK=0,
054:
055:
056:
057: AUTH_BADCRED=1,
058: AUTH_REJECTEDCRED=2,
059: AUTH_BADVERF=3,
060: AUTH_REJECTEDVERF=4,
061: AUTH_TOOWEAK=5,
062:
063:
064:
065: AUTH_INVALIDRESP=6,
066: AUTH_FAILED=7
067: };
068:
069: union des_block {
070: struct {
071: u_int32_t high;
072: u_int32_t low;
073: } key;
074: char c[8];
075: };
076: typedef union des_block des_block;
077: extern bool_t xdr_des_block (XDR *__xdrs, des_block *__blkp) __THROW;
078:
079:
080:
081:
082: struct opaque_auth {
083: enum_t oa_flavor;
084: caddr_t oa_base;
085: u_int oa_length;
086: };
087:
088:
089:
090:
091: typedef struct AUTH AUTH;
092: struct AUTH {
093: struct opaque_auth ah_cred;
094: struct opaque_auth ah_verf;
095: union des_block ah_key;
096: struct auth_ops {
097: void (*ah_nextverf) (AUTH *);
098: int (*ah_marshal) (AUTH *, XDR *);
099: int (*ah_validate) (AUTH *, struct opaque_auth *);
100:
101: int (*ah_refresh) (AUTH *);
102: void (*ah_destroy) (AUTH *);
103: } *ah_ops;
104: caddr_t ah_private;
105: };
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116: #define AUTH_NEXTVERF(auth) \
117: ((*((auth)->ah_ops->ah_nextverf))(auth))
118: #define auth_nextverf(auth) \
119: ((*((auth)->ah_ops->ah_nextverf))(auth))
120:
121: #define AUTH_MARSHALL(auth, xdrs) \
122: ((*((auth)->ah_ops->ah_marshal))(auth, xdrs))
123: #define auth_marshall(auth, xdrs) \
124: ((*((auth)->ah_ops->ah_marshal))(auth, xdrs))
125:
126: #define AUTH_VALIDATE(auth, verfp) \
127: ((*((auth)->ah_ops->ah_validate))((auth), verfp))
128: #define auth_validate(auth, verfp) \
129: ((*((auth)->ah_ops->ah_validate))((auth), verfp))
130:
131: #define AUTH_REFRESH(auth) \
132: ((*((auth)->ah_ops->ah_refresh))(auth))
133: #define auth_refresh(auth) \
134: ((*((auth)->ah_ops->ah_refresh))(auth))
135:
136: #define AUTH_DESTROY(auth) \
137: ((*((auth)->ah_ops->ah_destroy))(auth))
138: #define auth_destroy(auth) \
139: ((*((auth)->ah_ops->ah_destroy))(auth))
140:
141:
142: extern struct opaque_auth _null_auth;
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158: extern AUTH *authunix_create (char *__machname, __uid_t __uid, __gid_t __gid,
159: int __len, __gid_t *__aup_gids);
160: extern AUTH *authunix_create_default (void);
161: extern AUTH *authnone_create (void) __THROW;
162: extern AUTH *authdes_create (const char *__servername, u_int __window,
163: struct sockaddr *__syncaddr, des_block *__ckey)
164: __THROW;
165: extern AUTH *authdes_pk_create (const char *, netobj *, u_int,
166: struct sockaddr *, des_block *) __THROW;
167:
168:
169: #define AUTH_NONE 0
170: #define AUTH_NULL 0
171: #define AUTH_SYS 1
172: #define AUTH_UNIX AUTH_SYS
173: #define AUTH_SHORT 2
174: #define AUTH_DES 3
175: #define AUTH_DH AUTH_DES
176: #define AUTH_KERB 4
177:
178:
179:
180:
181:
182: extern int getnetname (char *) __THROW;
183: extern int host2netname (char *, __const char *, __const char *) __THROW;
184: extern int user2netname (char *, __const uid_t, __const char *) __THROW;
185: extern int netname2user (__const char *, uid_t *, gid_t *, int *, gid_t *)
186: __THROW;
187: extern int netname2host (__const char *, char *, __const int) __THROW;
188:
189:
190:
191:
192:
193:
194: extern int key_decryptsession (char *, des_block *);
195: extern int key_decryptsession_pk (char *, netobj *, des_block *);
196: extern int key_encryptsession (char *, des_block *);
197: extern int key_encryptsession_pk (char *, netobj *, des_block *);
198: extern int key_gendes (des_block *);
199: extern int key_setsecret (char *);
200: extern int key_secretkey_is_set (void);
201: extern int key_get_conv (char *, des_block *);
202:
203:
204:
205:
206: extern bool_t xdr_opaque_auth (XDR *, struct opaque_auth *) __THROW;
207:
208: __END_DECLS
209:
210: #endif
211:
© Andrew Scott 2006 -
2025,
All Rights Reserved