46 "(v %d, proc %d, seq %d, svc %d, ctx %p:%d)",
48 (xdr_stat ==
TRUE) ?
"success" :
"failure",
49 p->gc_v,
p->gc_proc,
p->gc_seq,
p->gc_svc,
50 p->gc_ctx.value,
p->gc_ctx.length);
63 log_debug(
"xdr_rpc_gss_init_args: %s %s (token %p:%d)",
65 (xdr_stat ==
TRUE) ?
"success" :
"failure",
76 xdr_stat = (
xdr_bytes(xdrs, (
char **)&
p->gr_ctx.value,
85 "(ctx %p:%d, maj %d, min %d, win %d, token %p:%d)",
87 (xdr_stat ==
TRUE) ?
"success" :
"failure",
88 p->gr_ctx.value,
p->gr_ctx.length,
89 p->gr_major,
p->gr_minor,
p->gr_win,
90 p->gr_token.value,
p->gr_token.length);
105 log_debug(
"in xdr_rpc_sspi_wrap_data()");
112 if (!
xdr_u_int(xdrs, &seq) || !(*xdr_func)(xdrs, xdr_ptr))
131 maj_stat = gss_get_mic(&min_stat,
ctx, qop,
137 log_debug(
"xdr_rpc_sspi_wrap_data: sspi_get_mic failed with %x", maj_stat);
145 gss_release_buffer(&min_stat, &wrapbuf);
153 maj_stat = gss_wrap(&min_stat,
ctx,
TRUE, qop, &databuf,
154 &conf_state, &wrapbuf);
156 maj_stat =
sspi_wrap(
ctx, 0, &databuf, &wrapbuf, &conf_state);
159 log_debug(
"xdr_rpc_sspi_wrap_data: sspi_wrap failed with %x", maj_stat);
167 gss_release_buffer(&min_stat, &wrapbuf);
183 u_int seq_num, qop_state;
187 log_debug(
"in xdr_rpc_sspi_unwrap_data()");
192 memset(&databuf, 0,
sizeof(databuf));
193 memset(&wrapbuf, 0,
sizeof(wrapbuf));
199 log_debug(
"xdr_rpc_sspi_unwrap_data: xdr decode databody_integ failed");
206 gss_release_buffer(&min_stat, &databuf);
210 log_debug(
"xdr_rpc_sspi_unwrap_data: xdr decode checksum failed");
215 maj_stat = gss_verify_mic(&min_stat,
ctx, &databuf,
216 &wrapbuf, &qop_state);
221 gss_release_buffer(&min_stat, &wrapbuf);
228 gss_release_buffer(&min_stat, &databuf);
232 log_debug(
"xdr_rpc_sspi_unwrap_data: sspi_verify_mic "
233 "failed with %x", maj_stat);
241 log_debug(
"xdr_rpc_sspi_unwrap_data: xdr decode databody_priv failed");
246 maj_stat = gss_unwrap(&min_stat,
ctx, &wrapbuf, &databuf,
247 &conf_state, &qop_state);
249 maj_stat =
sspi_unwrap(
ctx, seq, &wrapbuf, &databuf, &conf_state, &qop_state);
252 gss_release_buffer(&min_stat, &wrapbuf);
259 gss_release_buffer(&min_stat, &databuf);
263 log_debug(
"xdr_rpc_sspi_unwrap_data: sspi_unwrap failed with %x", maj_stat);
269 xdr_stat = (
xdr_u_int(&tmpxdrs, &seq_num) &&
270 (*xdr_func)(&tmpxdrs, xdr_ptr));
273 gss_release_buffer(&min_stat, &databuf);
278 if (xdr_stat ==
TRUE && seq_num != seq) {
279 log_debug(
"wrong sequence number in databody received %d expected %d",
292 switch (xdrs->
x_op) {
296 ctx, qop, svc, seq));
299 ctx, qop, svc, seq));
bool_t xdr_u_int(XDR *xdrs, u_int *up)
bool_t xdr_bytes(XDR *xdrs, char **cpp, u_int *sizep, u_int maxsize)
bool_t xdr_enum(XDR *xdrs, enum_t *ep)
uint32_t sspi_get_mic(PCtxtHandle ctx, u_int qop, u_int seq, sspi_buffer_desc *bufin, sspi_buffer_desc *bufout)
void sspi_release_buffer(sspi_buffer_desc *buf)
uint32_t sspi_verify_mic(PCtxtHandle ctx, u_int seq, sspi_buffer_desc *bufin, sspi_buffer_desc *bufout, u_int *qop_state)
uint32_t sspi_wrap(PCtxtHandle ctx, u_int seq, sspi_buffer_desc *bufin, sspi_buffer_desc *bufout, u_int *conf_state)
void log_debug(const char *fmt,...)
uint32_t sspi_unwrap(PCtxtHandle ctx, u_int seq, sspi_buffer_desc *bufin, sspi_buffer_desc *bufout, u_int *conf_state, u_int *qop_state)
@ RPCSEC_SSPI_SVC_INTEGRITY
@ RPCSEC_SSPI_SVC_PRIVACY
bool_t xdr_rpc_sspi_unwrap_data(XDR *xdrs, xdrproc_t xdr_func, caddr_t xdr_ptr, PCtxtHandle ctx, sspi_qop_t qop, rpc_sspi_svc_t svc, u_int seq)
bool_t xdr_rpc_sspi_init_args(XDR *xdrs, sspi_buffer_desc *p)
bool_t xdr_rpc_sspi_init_res(XDR *xdrs, struct rpc_sspi_init_res *p)
bool_t xdr_rpc_sspi_cred(XDR *xdrs, struct rpc_sspi_cred *p)
bool_t xdr_rpc_sspi_data(XDR *xdrs, xdrproc_t xdr_func, caddr_t xdr_ptr, PCtxtHandle ctx, sspi_qop_t qop, rpc_sspi_svc_t svc, u_int seq)
bool_t xdr_rpc_sspi_wrap_data(XDR *xdrs, xdrproc_t xdr_func, caddr_t xdr_ptr, PCtxtHandle ctx, sspi_qop_t qop, rpc_sspi_svc_t svc, u_int seq)
#define XDR_INLINE(xdrs, len)
#define XDR_SETPOS(xdrs, pos)
#define XDR_DESTROY(xdrs)
bool_t(* xdrproc_t)(XDR *,...)
void xdrmem_create(XDR *xdrs, char *addr, u_int size, enum xdr_op op)