Deleted Added
sdiff udiff text old ( 92889 ) new ( 92990 )
full compact
1#if defined(LIBC_SCCS) && !defined(lint)
2static char sccsid[] = "@(#)authdes_prot.c 2.1 88/07/29 4.0 RPCSRC; from 1.6 88/02/08 SMI";
3#endif
4#include <sys/cdefs.h>
5__FBSDID("$FreeBSD: head/lib/libc/rpc/authdes_prot.c 92990 2002-03-22 23:18:37Z obrien $");
6
7/*
8 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
9 * unrestricted use provided that this legend is included on all tape
10 * media and as a part of the software program in whole or part. Users
11 * may copy or modify Sun RPC without charge, but are not authorized
12 * to license or distribute it to anyone else except as part of a product or
13 * program developed by the user.
14 *
15 * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
16 * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
17 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
18 *
19 * Sun RPC is provided with no support and without any obligation on the
20 * part of Sun Microsystems, Inc. to assist in its use, correction,
21 * modification or enhancement.
22 *
23 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
24 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
25 * OR ANY PART THEREOF.
26 *
27 * In no event will Sun Microsystems, Inc. be liable for any lost revenue
28 * or profits or other special, indirect and consequential damages, even if
29 * Sun has been advised of the possibility of such damages.
30 *
31 * Sun Microsystems, Inc.
32 * 2550 Garcia Avenue
33 * Mountain View, California 94043
34 */
35/*
36 * Copyright (c) 1986-1991 by Sun Microsystems Inc.
37 */
38
39/*
40 * authdes_prot.c, XDR routines for DES authentication
41 */
42
43#include "namespace.h"
44#include <rpc/types.h>
45#include <rpc/xdr.h>
46#include <rpc/auth.h>
47#include <rpc/auth_des.h>
48#include "un-namespace.h"
49
50#define ATTEMPT(xdr_op) if (!(xdr_op)) return (FALSE)
51
52bool_t
53xdr_authdes_cred(xdrs, cred)
54 XDR *xdrs;
55 struct authdes_cred *cred;
56{
57 /*
58 * Unrolled xdr
59 */
60 ATTEMPT(xdr_enum(xdrs, (enum_t *)&cred->adc_namekind));
61 switch (cred->adc_namekind) {
62 case ADN_FULLNAME:
63 ATTEMPT(xdr_string(xdrs, &cred->adc_fullname.name,
64 MAXNETNAMELEN));
65 ATTEMPT(xdr_opaque(xdrs, (caddr_t)&cred->adc_fullname.key,
66 sizeof(des_block)));
67 ATTEMPT(xdr_opaque(xdrs, (caddr_t)&cred->adc_fullname.window,
68 sizeof(cred->adc_fullname.window)));
69 return (TRUE);
70 case ADN_NICKNAME:
71 ATTEMPT(xdr_opaque(xdrs, (caddr_t)&cred->adc_nickname,
72 sizeof(cred->adc_nickname)));
73 return (TRUE);
74 default:
75 return (FALSE);
76 }
77}
78
79
80bool_t
81xdr_authdes_verf(xdrs, verf)
82 XDR *xdrs;
83 struct authdes_verf *verf;
84{
85 /*
86 * Unrolled xdr
87 */
88 ATTEMPT(xdr_opaque(xdrs, (caddr_t)&verf->adv_xtimestamp,
89 sizeof(des_block)));
90 ATTEMPT(xdr_opaque(xdrs, (caddr_t)&verf->adv_int_u,
91 sizeof(verf->adv_int_u)));
92 return (TRUE);
93}