File indexing completed on 2025-01-30 10:25:05
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046 #ifndef _TIRPC_AUTH_H
0047 #define _TIRPC_AUTH_H
0048
0049 #include <rpc/xdr.h>
0050 #include <rpc/clnt_stat.h>
0051 #include <sys/socket.h>
0052 #include <sys/types.h>
0053
0054
0055 #define MAX_AUTH_BYTES 400
0056 #define MAXNETNAMELEN 255
0057
0058
0059
0060
0061
0062 typedef struct sec_data {
0063 u_int secmod;
0064 u_int rpcflavor;
0065 int flags;
0066 caddr_t data;
0067 } sec_data_t;
0068
0069 #ifdef _SYSCALL32_IMPL
0070 struct sec_data32 {
0071 uint32_t secmod;
0072 uint32_t rpcflavor;
0073 int32_t flags;
0074 caddr32_t data;
0075 };
0076 #endif
0077
0078
0079
0080
0081
0082 typedef struct des_clnt_data {
0083 struct netbuf syncaddr;
0084 struct knetconfig *knconf;
0085
0086 char *netname;
0087 int netnamelen;
0088 } dh_k4_clntdata_t;
0089
0090 #ifdef _SYSCALL32_IMPL
0091 struct des_clnt_data32 {
0092 struct netbuf32 syncaddr;
0093 caddr32_t knconf;
0094
0095 caddr32_t netname;
0096 int32_t netnamelen;
0097 };
0098 #endif
0099
0100
0101
0102
0103 #define AUTH_F_RPCTIMESYNC 0x001
0104 #define AUTH_F_TRYNONE 0x002
0105
0106
0107
0108
0109
0110 enum auth_stat {
0111 AUTH_OK=0,
0112
0113
0114
0115 AUTH_BADCRED=1,
0116 AUTH_REJECTEDCRED=2,
0117 AUTH_BADVERF=3,
0118 AUTH_REJECTEDVERF=4,
0119 AUTH_TOOWEAK=5,
0120
0121
0122
0123 AUTH_INVALIDRESP=6,
0124 AUTH_FAILED=7,
0125
0126
0127
0128 AUTH_KERB_GENERIC = 8,
0129 AUTH_TIMEEXPIRE = 9,
0130 AUTH_TKT_FILE = 10,
0131 AUTH_DECODE = 11,
0132 AUTH_NET_ADDR = 12,
0133
0134
0135
0136 RPCSEC_GSS_CREDPROBLEM = 13,
0137 RPCSEC_GSS_CTXPROBLEM = 14
0138
0139 };
0140
0141 typedef u_int32_t u_int32;
0142
0143 union des_block {
0144 struct {
0145 u_int32_t high;
0146 u_int32_t low;
0147 } key;
0148 char c[8];
0149 };
0150 typedef union des_block des_block;
0151 #ifdef __cplusplus
0152 extern "C" {
0153 #endif
0154 extern bool_t xdr_des_block(XDR *, des_block *);
0155 #ifdef __cplusplus
0156 }
0157 #endif
0158
0159
0160
0161
0162 struct opaque_auth {
0163 enum_t oa_flavor;
0164 caddr_t oa_base;
0165 u_int oa_length;
0166 };
0167
0168
0169
0170
0171
0172 typedef struct __auth {
0173 struct opaque_auth ah_cred;
0174 struct opaque_auth ah_verf;
0175 union des_block ah_key;
0176 struct auth_ops {
0177 void (*ah_nextverf) (struct __auth *);
0178
0179 int (*ah_marshal) (struct __auth *, XDR *);
0180
0181 int (*ah_validate) (struct __auth *,
0182 struct opaque_auth *);
0183
0184 int (*ah_refresh) (struct __auth *, void *);
0185
0186 void (*ah_destroy) (struct __auth *);
0187
0188 int (*ah_wrap) (struct __auth *, XDR *, xdrproc_t, caddr_t);
0189
0190 int (*ah_unwrap) (struct __auth *, XDR *, xdrproc_t, caddr_t);
0191
0192 } *ah_ops;
0193 void *ah_private;
0194 } AUTH;
0195
0196
0197
0198
0199
0200
0201
0202
0203
0204 #define AUTH_NEXTVERF(auth) \
0205 ((*((auth)->ah_ops->ah_nextverf))(auth))
0206 #define auth_nextverf(auth) \
0207 ((*((auth)->ah_ops->ah_nextverf))(auth))
0208
0209 #define AUTH_MARSHALL(auth, xdrs) \
0210 ((*((auth)->ah_ops->ah_marshal))(auth, xdrs))
0211 #define auth_marshall(auth, xdrs) \
0212 ((*((auth)->ah_ops->ah_marshal))(auth, xdrs))
0213
0214 #define AUTH_VALIDATE(auth, verfp) \
0215 ((*((auth)->ah_ops->ah_validate))((auth), verfp))
0216 #define auth_validate(auth, verfp) \
0217 ((*((auth)->ah_ops->ah_validate))((auth), verfp))
0218
0219 #define AUTH_REFRESH(auth, msg) \
0220 ((*((auth)->ah_ops->ah_refresh))(auth, msg))
0221 #define auth_refresh(auth, msg) \
0222 ((*((auth)->ah_ops->ah_refresh))(auth, msg))
0223
0224 #define AUTH_DESTROY(auth) \
0225 ((*((auth)->ah_ops->ah_destroy))(auth));
0226 #define auth_destroy(auth) \
0227 ((*((auth)->ah_ops->ah_destroy))(auth));
0228
0229 #define AUTH_WRAP(auth, xdrs, xfunc, xwhere) \
0230 ((*((auth)->ah_ops->ah_wrap))(auth, xdrs, \
0231 xfunc, xwhere))
0232 #define auth_wrap(auth, xdrs, xfunc, xwhere) \
0233 ((*((auth)->ah_ops->ah_wrap))(auth, xdrs, \
0234 xfunc, xwhere))
0235
0236 #define AUTH_UNWRAP(auth, xdrs, xfunc, xwhere) \
0237 ((*((auth)->ah_ops->ah_unwrap))(auth, xdrs, \
0238 xfunc, xwhere))
0239 #define auth_unwrap(auth, xdrs, xfunc, xwhere) \
0240 ((*((auth)->ah_ops->ah_unwrap))(auth, xdrs, \
0241 xfunc, xwhere))
0242
0243
0244 #ifdef __cplusplus
0245 extern "C" {
0246 #endif
0247 extern struct opaque_auth _null_auth;
0248 #ifdef __cplusplus
0249 }
0250 #endif
0251
0252
0253
0254
0255
0256 int authany_wrap(void), authany_unwrap(void);
0257
0258
0259
0260
0261
0262
0263
0264
0265
0266
0267
0268
0269
0270
0271 #ifdef __cplusplus
0272 extern "C" {
0273 #endif
0274 extern AUTH *authunix_create(char *, uid_t, uid_t, int, uid_t *);
0275 extern AUTH *authunix_create_default(void);
0276 extern AUTH *authnone_create(void);
0277 #ifdef __cplusplus
0278 }
0279 #endif
0280
0281
0282
0283
0284
0285
0286
0287
0288 #ifdef __cplusplus
0289 extern "C" {
0290 #endif
0291 extern AUTH *authdes_create (char *, u_int, struct sockaddr *, des_block *);
0292 extern AUTH *authdes_pk_create (char *, netobj *, u_int,
0293 struct sockaddr *, des_block *);
0294 extern AUTH *authdes_seccreate (const char *, const u_int, const char *,
0295 const des_block *);
0296 #ifdef __cplusplus
0297 }
0298 #endif
0299
0300 #ifdef __cplusplus
0301 extern "C" {
0302 #endif
0303 extern bool_t xdr_opaque_auth (XDR *, struct opaque_auth *);
0304 #ifdef __cplusplus
0305 }
0306 #endif
0307
0308 #define authsys_create(c,i1,i2,i3,ip) authunix_create((c),(i1),(i2),(i3),(ip))
0309 #define authsys_create_default() authunix_create_default()
0310
0311
0312
0313
0314 #ifdef __cplusplus
0315 extern "C" {
0316 #endif
0317 extern int getnetname(char *);
0318 extern int host2netname(char *, const char *, const char *);
0319 extern int user2netname(char *, const uid_t, const char *);
0320 extern int netname2user(char *, uid_t *, gid_t *, int *, gid_t *);
0321 extern int netname2host(char *, char *, const int);
0322 extern void passwd2des ( char *, char * );
0323 #ifdef __cplusplus
0324 }
0325 #endif
0326
0327
0328
0329
0330
0331
0332 #ifdef __cplusplus
0333 extern "C" {
0334 #endif
0335 extern int key_decryptsession(const char *, des_block *);
0336 extern int key_encryptsession(const char *, des_block *);
0337 extern int key_gendes(des_block *);
0338 extern int key_setsecret(const char *);
0339 extern int key_secretkey_is_set(void);
0340 #ifdef __cplusplus
0341 }
0342 #endif
0343
0344
0345
0346
0347 #ifdef __cplusplus
0348 extern "C" {
0349 #endif
0350 extern int getpublickey (const char *, char *);
0351 extern int getpublicandprivatekey (char *, char *);
0352 extern int getsecretkey (char *, char *, char *);
0353 #ifdef __cplusplus
0354 }
0355 #endif
0356
0357 #ifdef __cplusplus
0358 extern "C" {
0359 #endif
0360 struct svc_req;
0361 struct rpc_msg;
0362 enum auth_stat _svcauth_none (struct svc_req *, struct rpc_msg *);
0363 enum auth_stat _svcauth_short (struct svc_req *, struct rpc_msg *);
0364 enum auth_stat _svcauth_unix (struct svc_req *, struct rpc_msg *);
0365 enum auth_stat _svcauth_gss (struct svc_req *, struct rpc_msg *, bool_t *);
0366 #ifdef __cplusplus
0367 }
0368 #endif
0369
0370 #define AUTH_NONE 0
0371 #define AUTH_NULL 0
0372 #define AUTH_SYS 1
0373 #define AUTH_UNIX AUTH_SYS
0374 #define AUTH_SHORT 2
0375 #define AUTH_DH 3
0376 #define AUTH_DES AUTH_DH
0377 #define AUTH_KERB 4
0378 #define RPCSEC_GSS 6
0379
0380 #endif