kern/sys: Add the kernel RPC and XDR support

Updates #4475
This commit is contained in:
Chris Johns
2021-07-29 13:24:49 +10:00
parent 3da45ae4bc
commit c6dbc96748
30 changed files with 298 additions and 5 deletions

View File

@@ -1,3 +1,5 @@
#include <machine/rtems-bsd-kernel-space.h>
/* $NetBSD: authunix_prot.c,v 1.12 2000/01/22 22:19:17 mycroft Exp $ */
/*-
@@ -74,7 +76,11 @@ xdr_authunix_parms(XDR *xdrs, uint32_t *time, struct xucred *cred)
/*
* Restrict name length to 255 according to RFC 1057.
*/
#ifndef __rtems__
getcredhostname(NULL, hostbuf, sizeof(hostbuf));
#else /* __rtems__ */
gethostname(hostbuf, sizeof(hostbuf));
#endif /* __rtems__ */
namelen = strlen(hostbuf);
if (namelen > 255)
namelen = 255;
@@ -97,9 +103,19 @@ xdr_authunix_parms(XDR *xdrs, uint32_t *time, struct xucred *cred)
xdr_setpos(xdrs, xdr_getpos(xdrs) + RNDUP(namelen));
}
#ifndef __rtems__
if (!xdr_uint32_t(xdrs, &cred->cr_uid))
#else /* __rtems__ */
junk = cred->cr_uid;
if (!xdr_uint32_t(xdrs, &junk))
#endif /* __rtems__ */
return (FALSE);
#ifndef __rtems__
if (!xdr_uint32_t(xdrs, &cred->cr_groups[0]))
#else /* __rtems__ */
junk = cred->cr_groups[0];
if (!xdr_uint32_t(xdrs, &junk))
#endif /* __rtems__ */
return (FALSE);
if (xdrs->x_op == XDR_ENCODE) {
@@ -112,7 +128,12 @@ xdr_authunix_parms(XDR *xdrs, uint32_t *time, struct xucred *cred)
return (FALSE);
for (i = 0; i < ngroups; i++) {
if (i + 1 < ngroups_max + 1) {
#ifndef __rtems__
if (!xdr_uint32_t(xdrs, &cred->cr_groups[i + 1]))
#else /* __rtems__ */
junk = cred->cr_uid;
if (!xdr_uint32_t(xdrs, &junk))
#endif /* __rtems__ */
return (FALSE);
} else {
if (!xdr_uint32_t(xdrs, &junk))