File indexing completed on 2025-01-18 10:01:04
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 #ifndef GSSRPC_AUTH_H
0043 #define GSSRPC_AUTH_H
0044
0045 #include <gssrpc/xdr.h>
0046
0047 GSSRPC__BEGIN_DECLS
0048
0049 #define MAX_AUTH_BYTES 400
0050 #define MAXNETNAMELEN 255
0051
0052
0053
0054
0055 enum auth_stat {
0056 AUTH_OK=0,
0057
0058
0059
0060 AUTH_BADCRED=1,
0061 AUTH_REJECTEDCRED=2,
0062 AUTH_BADVERF=3,
0063 AUTH_REJECTEDVERF=4,
0064 AUTH_TOOWEAK=5,
0065
0066
0067
0068 AUTH_INVALIDRESP=6,
0069 AUTH_FAILED=7,
0070
0071
0072
0073 RPCSEC_GSS_CREDPROBLEM = 13,
0074 RPCSEC_GSS_CTXPROBLEM = 14
0075 };
0076
0077 union des_block {
0078 char c[8];
0079 };
0080 typedef union des_block des_block;
0081 extern bool_t xdr_des_block(XDR *, des_block *);
0082
0083
0084
0085
0086 struct opaque_auth {
0087 enum_t oa_flavor;
0088 caddr_t oa_base;
0089 u_int oa_length;
0090 };
0091
0092
0093
0094
0095
0096 struct rpc_msg;
0097
0098 typedef struct AUTH {
0099 struct opaque_auth ah_cred;
0100 struct opaque_auth ah_verf;
0101 union des_block ah_key;
0102 struct auth_ops {
0103 void (*ah_nextverf)(struct AUTH *);
0104
0105 int (*ah_marshal)(struct AUTH *, XDR *);
0106
0107 int (*ah_validate)(struct AUTH *,
0108 struct opaque_auth *);
0109
0110 int (*ah_refresh)(struct AUTH *, struct rpc_msg *);
0111
0112 void (*ah_destroy)(struct AUTH *);
0113
0114 int (*ah_wrap)(struct AUTH *, XDR *,
0115 xdrproc_t, caddr_t);
0116
0117 int (*ah_unwrap)(struct AUTH *, XDR *,
0118 xdrproc_t, caddr_t);
0119 } *ah_ops;
0120 void *ah_private;
0121 } AUTH;
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132 #define AUTH_NEXTVERF(auth) \
0133 ((*((auth)->ah_ops->ah_nextverf))(auth))
0134 #define auth_nextverf(auth) \
0135 ((*((auth)->ah_ops->ah_nextverf))(auth))
0136
0137 #define AUTH_MARSHALL(auth, xdrs) \
0138 ((*((auth)->ah_ops->ah_marshal))(auth, xdrs))
0139 #define auth_marshall(auth, xdrs) \
0140 ((*((auth)->ah_ops->ah_marshal))(auth, xdrs))
0141
0142 #define AUTH_VALIDATE(auth, verfp) \
0143 ((*((auth)->ah_ops->ah_validate))((auth), verfp))
0144 #define auth_validate(auth, verfp) \
0145 ((*((auth)->ah_ops->ah_validate))((auth), verfp))
0146
0147 #define AUTH_REFRESH(auth, msg) \
0148 ((*((auth)->ah_ops->ah_refresh))(auth, msg))
0149 #define auth_refresh(auth, msg) \
0150 ((*((auth)->ah_ops->ah_refresh))(auth, msg))
0151
0152 #define AUTH_WRAP(auth, xdrs, xfunc, xwhere) \
0153 ((*((auth)->ah_ops->ah_wrap))(auth, xdrs, \
0154 xfunc, xwhere))
0155 #define auth_wrap(auth, xdrs, xfunc, xwhere) \
0156 ((*((auth)->ah_ops->ah_wrap))(auth, xdrs, \
0157 xfunc, xwhere))
0158 #define AUTH_UNWRAP(auth, xdrs, xfunc, xwhere) \
0159 ((*((auth)->ah_ops->ah_unwrap))(auth, xdrs, \
0160 xfunc, xwhere))
0161 #define auth_unwrap(auth, xdrs, xfunc, xwhere) \
0162 ((*((auth)->ah_ops->ah_unwrap))(auth, xdrs, \
0163 xfunc, xwhere))
0164
0165 #define AUTH_DESTROY(auth) \
0166 ((*((auth)->ah_ops->ah_destroy))(auth))
0167 #define auth_destroy(auth) \
0168 ((*((auth)->ah_ops->ah_destroy))(auth))
0169
0170
0171 #ifdef GSSRPC__IMPL
0172
0173 extern struct opaque_auth gssrpc__null_auth;
0174 #endif
0175
0176
0177
0178
0179
0180
0181
0182
0183
0184
0185
0186
0187
0188
0189 extern AUTH *authunix_create(char *machname, int uid, int gid, int len,
0190 int *aup_gids);
0191 extern AUTH *authunix_create_default(void);
0192 extern AUTH *authnone_create(void);
0193 extern bool_t xdr_opaque_auth(XDR *, struct opaque_auth *);
0194
0195 #define AUTH_NONE 0
0196 #define AUTH_NULL 0
0197 #define AUTH_UNIX 1
0198 #define AUTH_SHORT 2
0199 #define AUTH_DES 3
0200 #define AUTH_GSSAPI 300001
0201 #define RPCSEC_GSS 6
0202
0203 GSSRPC__END_DECLS
0204
0205 #endif