Beispiel #1
0
/*
 * XDR loopback unix auth parameters.
 * NOTE: this is an XDR_ENCODE only routine.
 */
bool_t
xdr_authloopback(XDR *xdrs)
{
	uid_t uid;
	gid_t gid;
	int len;
	caddr_t groups;
	char *name = uts_nodename();
	struct cred *cr;
	time_t now;

	if (xdrs->x_op != XDR_ENCODE)
		return (FALSE);

	cr = CRED();
	uid = crgetuid(cr);
	gid = crgetgid(cr);
	len = crgetngroups(cr);
	groups = (caddr_t)crgetgroups(cr);
	now = gethrestime_sec();
	if (xdr_uint32(xdrs, (uint32_t *)&now) &&
	    xdr_string(xdrs, &name, MAX_MACHINE_NAME) &&
	    xdr_uid_t(xdrs, &uid) &&
	    xdr_gid_t(xdrs, &gid) &&
	    xdr_array(xdrs, &groups, (uint_t *)&len, NGRPS_LOOPBACK,
	    sizeof (int), (xdrproc_t)xdr_int))
		return (TRUE);
	return (FALSE);
}
Beispiel #2
0
bool_t
xdr_nfsauth_res(XDR *xdrs, nfsauth_res_t *argp)
{
	if (!xdr_u_int(xdrs, &argp->stat))
		return (FALSE);
	if (!xdr_int(xdrs, &argp->ares.auth_perm))
		return (FALSE);
	if (!xdr_uid_t(xdrs, &argp->ares.auth_srv_uid))
		return (FALSE);
	if (!xdr_gid_t(xdrs, &argp->ares.auth_srv_gid))
		return (FALSE);
	if (!xdr_array(xdrs, (caddr_t *)&argp->ares.auth_srv_gids.val,
	    &argp->ares.auth_srv_gids.len, NGROUPS_UMAX, (uint_t)sizeof (gid_t),
	    xdr_gid_t))
		return (FALSE);
	return (TRUE);
}
Beispiel #3
0
bool_t
xdr_nfsauth_arg(XDR *xdrs, nfsauth_arg_t *argp)
{
	if (!xdr_u_int(xdrs, &argp->cmd))
		return (FALSE);
	if (!xdr_netobj(xdrs, &argp->areq.req_client))
		return (FALSE);
	if (!xdr_string(xdrs, &argp->areq.req_netid, ~0))
		return (FALSE);
	if (!xdr_string(xdrs, &argp->areq.req_path, A_MAXPATH))
		return (FALSE);
	if (!xdr_int(xdrs, &argp->areq.req_flavor))
		return (FALSE);
	if (!xdr_uid_t(xdrs, &argp->areq.req_clnt_uid))
		return (FALSE);
	if (!xdr_gid_t(xdrs, &argp->areq.req_clnt_gid))
		return (FALSE);
	if (!xdr_array(xdrs, (caddr_t *)&argp->areq.req_clnt_gids.val,
	    &argp->areq.req_clnt_gids.len, NGROUPS_UMAX, (uint_t)sizeof (gid_t),
	    xdr_gid_t))
		return (FALSE);
	return (TRUE);
}