17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 77c478bd9Sstevel@tonic-gate * with the License. 87c478bd9Sstevel@tonic-gate * 97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate * and limitations under the License. 137c478bd9Sstevel@tonic-gate * 147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate * 207c478bd9Sstevel@tonic-gate * CDDL HEADER END 2161961e0fSrobinson */ 2261961e0fSrobinson 2361961e0fSrobinson /* 24*a05fd0c9SMarcel Telka * Copyright 2014 Nexenta Systems, Inc. All rights reserved. 25*a05fd0c9SMarcel Telka */ 26*a05fd0c9SMarcel Telka 27*a05fd0c9SMarcel Telka /* 28e8031f0aSraf * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 297c478bd9Sstevel@tonic-gate * Use is subject to license terms. 307c478bd9Sstevel@tonic-gate */ 31e8031f0aSraf 327c478bd9Sstevel@tonic-gate /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ 337c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 347c478bd9Sstevel@tonic-gate /* 357c478bd9Sstevel@tonic-gate * Portions of this source code were derived from Berkeley 367c478bd9Sstevel@tonic-gate * 4.3 BSD under license from the Regents of the University of 377c478bd9Sstevel@tonic-gate * California. 387c478bd9Sstevel@tonic-gate */ 397c478bd9Sstevel@tonic-gate 407c478bd9Sstevel@tonic-gate /* 417c478bd9Sstevel@tonic-gate * XDR for UNIX style authentication parameters for RPC 427c478bd9Sstevel@tonic-gate */ 437c478bd9Sstevel@tonic-gate 44e8031f0aSraf #include "mt.h" 457c478bd9Sstevel@tonic-gate #include <rpc/types.h> 467c478bd9Sstevel@tonic-gate #include <rpc/xdr.h> 477c478bd9Sstevel@tonic-gate #include <rpc/auth.h> 487c478bd9Sstevel@tonic-gate #include <rpc/auth_sys.h> 497c478bd9Sstevel@tonic-gate 507c478bd9Sstevel@tonic-gate /* 517c478bd9Sstevel@tonic-gate * XDR for unix authentication parameters. 527c478bd9Sstevel@tonic-gate */ 537c478bd9Sstevel@tonic-gate bool_t 547c478bd9Sstevel@tonic-gate xdr_authsys_parms(XDR *xdrs, struct authsys_parms *p) 557c478bd9Sstevel@tonic-gate { 567c478bd9Sstevel@tonic-gate if (xdr_u_int(xdrs, &(p->aup_time)) && 577c478bd9Sstevel@tonic-gate xdr_string(xdrs, &(p->aup_machname), MAX_MACHINE_NAME) && 587c478bd9Sstevel@tonic-gate xdr_uid_t(xdrs, (uid_t *)&(p->aup_uid)) && 597c478bd9Sstevel@tonic-gate xdr_gid_t(xdrs, (gid_t *)&(p->aup_gid)) && 607c478bd9Sstevel@tonic-gate xdr_array(xdrs, (caddr_t *)&(p->aup_gids), 6161961e0fSrobinson &(p->aup_len), NGRPS, (uint_t)sizeof (gid_t), 6261961e0fSrobinson (xdrproc_t)xdr_gid_t)) 637c478bd9Sstevel@tonic-gate return (TRUE); 647c478bd9Sstevel@tonic-gate return (FALSE); 657c478bd9Sstevel@tonic-gate } 667c478bd9Sstevel@tonic-gate 677c478bd9Sstevel@tonic-gate /* 687c478bd9Sstevel@tonic-gate * XDR user id types (uid_t) 697c478bd9Sstevel@tonic-gate */ 707c478bd9Sstevel@tonic-gate bool_t 717c478bd9Sstevel@tonic-gate xdr_uid_t(XDR *xdrs, uid_t *ip) 727c478bd9Sstevel@tonic-gate { 7361961e0fSrobinson /* CONSTCOND */ 7461961e0fSrobinson if (sizeof (uid_t) != sizeof (int)) 7561961e0fSrobinson return (xdr_short(xdrs, (short *)ip)); 7661961e0fSrobinson return (xdr_int(xdrs, (int *)ip)); 777c478bd9Sstevel@tonic-gate } 787c478bd9Sstevel@tonic-gate 797c478bd9Sstevel@tonic-gate /* 807c478bd9Sstevel@tonic-gate * XDR group id types (gid_t) 817c478bd9Sstevel@tonic-gate */ 827c478bd9Sstevel@tonic-gate bool_t 837c478bd9Sstevel@tonic-gate xdr_gid_t(XDR *xdrs, gid_t *ip) 847c478bd9Sstevel@tonic-gate { 8561961e0fSrobinson /* CONSTCOND */ 8661961e0fSrobinson if (sizeof (gid_t) != sizeof (int)) 8761961e0fSrobinson return (xdr_short(xdrs, (short *)ip)); 8861961e0fSrobinson return (xdr_int(xdrs, (int *)ip)); 897c478bd9Sstevel@tonic-gate } 90