1 | #include <machine/rtems-bsd-user-space.h> |
---|
2 | |
---|
3 | #if defined(LIBC_SCCS) && !defined(lint) |
---|
4 | static char sccsid[] = "@(#)authdes_prot.c 2.1 88/07/29 4.0 RPCSRC; from 1.6 88/02/08 SMI"; |
---|
5 | #endif |
---|
6 | #include <sys/cdefs.h> |
---|
7 | __FBSDID("$FreeBSD$"); |
---|
8 | |
---|
9 | /*- |
---|
10 | * Copyright (c) 2009, Sun Microsystems, Inc. |
---|
11 | * All rights reserved. |
---|
12 | * |
---|
13 | * Redistribution and use in source and binary forms, with or without |
---|
14 | * modification, are permitted provided that the following conditions are met: |
---|
15 | * - Redistributions of source code must retain the above copyright notice, |
---|
16 | * this list of conditions and the following disclaimer. |
---|
17 | * - Redistributions in binary form must reproduce the above copyright notice, |
---|
18 | * this list of conditions and the following disclaimer in the documentation |
---|
19 | * and/or other materials provided with the distribution. |
---|
20 | * - Neither the name of Sun Microsystems, Inc. nor the names of its |
---|
21 | * contributors may be used to endorse or promote products derived |
---|
22 | * from this software without specific prior written permission. |
---|
23 | * |
---|
24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
27 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
---|
28 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
29 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
30 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
31 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
32 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
33 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
---|
34 | * POSSIBILITY OF SUCH DAMAGE. |
---|
35 | */ |
---|
36 | /* |
---|
37 | * Copyright (c) 1986-1991 by Sun Microsystems Inc. |
---|
38 | */ |
---|
39 | |
---|
40 | /* |
---|
41 | * authdes_prot.c, XDR routines for DES authentication |
---|
42 | */ |
---|
43 | |
---|
44 | #include "namespace.h" |
---|
45 | #include <rpc/types.h> |
---|
46 | #include <rpc/xdr.h> |
---|
47 | #include <rpc/auth.h> |
---|
48 | #include <rpc/auth_des.h> |
---|
49 | #include "un-namespace.h" |
---|
50 | |
---|
51 | #define ATTEMPT(xdr_op) if (!(xdr_op)) return (FALSE) |
---|
52 | |
---|
53 | bool_t |
---|
54 | xdr_authdes_cred(xdrs, cred) |
---|
55 | XDR *xdrs; |
---|
56 | struct authdes_cred *cred; |
---|
57 | { |
---|
58 | enum authdes_namekind *padc_namekind = &cred->adc_namekind; |
---|
59 | /* |
---|
60 | * Unrolled xdr |
---|
61 | */ |
---|
62 | ATTEMPT(xdr_enum(xdrs, (enum_t *) padc_namekind)); |
---|
63 | switch (cred->adc_namekind) { |
---|
64 | case ADN_FULLNAME: |
---|
65 | ATTEMPT(xdr_string(xdrs, &cred->adc_fullname.name, |
---|
66 | MAXNETNAMELEN)); |
---|
67 | ATTEMPT(xdr_opaque(xdrs, (caddr_t)&cred->adc_fullname.key, |
---|
68 | sizeof(des_block))); |
---|
69 | ATTEMPT(xdr_opaque(xdrs, (caddr_t)&cred->adc_fullname.window, |
---|
70 | sizeof(cred->adc_fullname.window))); |
---|
71 | return (TRUE); |
---|
72 | case ADN_NICKNAME: |
---|
73 | ATTEMPT(xdr_opaque(xdrs, (caddr_t)&cred->adc_nickname, |
---|
74 | sizeof(cred->adc_nickname))); |
---|
75 | return (TRUE); |
---|
76 | default: |
---|
77 | return (FALSE); |
---|
78 | } |
---|
79 | } |
---|
80 | |
---|
81 | |
---|
82 | bool_t |
---|
83 | xdr_authdes_verf(xdrs, verf) |
---|
84 | XDR *xdrs; |
---|
85 | struct authdes_verf *verf; |
---|
86 | { |
---|
87 | /* |
---|
88 | * Unrolled xdr |
---|
89 | */ |
---|
90 | ATTEMPT(xdr_opaque(xdrs, (caddr_t)&verf->adv_xtimestamp, |
---|
91 | sizeof(des_block))); |
---|
92 | ATTEMPT(xdr_opaque(xdrs, (caddr_t)&verf->adv_int_u, |
---|
93 | sizeof(verf->adv_int_u))); |
---|
94 | return (TRUE); |
---|
95 | } |
---|