1 /*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22
23 /*
24 * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
25 */
26
27 /*
28 * Copyright (c) 1996, by Sun Microsystems, Inc.
29 * All rights reserved.
30 */
31
32 #include <rpc/rpc.h>
33 #include <rpcsvc/yppasswd.h>
34
35 bool_t
xdr_passwd(XDR * xdrs,struct passwd * pw)36 xdr_passwd(XDR *xdrs, struct passwd *pw)
37 {
38 if (!xdr_wrapstring(xdrs, &pw->pw_name)) {
39 return (FALSE);
40 }
41 if (!xdr_wrapstring(xdrs, &pw->pw_passwd)) {
42 return (FALSE);
43 }
44 if (!xdr_uid_t(xdrs, &pw->pw_uid)) {
45 return (FALSE);
46 }
47 if (!xdr_gid_t(xdrs, (&pw->pw_gid))) {
48 return (FALSE);
49 }
50 if (!xdr_wrapstring(xdrs, &pw->pw_gecos)) {
51 return (FALSE);
52 }
53 if (!xdr_wrapstring(xdrs, &pw->pw_dir)) {
54 return (FALSE);
55 }
56 if (!xdr_wrapstring(xdrs, &pw->pw_shell)) {
57 return (FALSE);
58 }
59 return (TRUE);
60 }
61
62 bool_t
xdr_yppasswd(XDR * xdrs,struct yppasswd * yppw)63 xdr_yppasswd(XDR *xdrs, struct yppasswd *yppw)
64 {
65 if (!xdr_wrapstring(xdrs, &yppw->oldpass)) {
66 return (FALSE);
67 }
68 if (!xdr_passwd(xdrs, &yppw->newpw)) {
69 return (FALSE);
70 }
71 return (TRUE);
72 }
73