]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - lib/libc/rpc/authdes_prot.c
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / lib / libc / rpc / authdes_prot.c
1 #if defined(LIBC_SCCS) && !defined(lint)
2 static 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$");
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
52 bool_t
53 xdr_authdes_cred(xdrs, cred)
54         XDR *xdrs;
55         struct authdes_cred *cred;
56 {
57         enum authdes_namekind *padc_namekind = &cred->adc_namekind;
58         /*
59          * Unrolled xdr
60          */
61         ATTEMPT(xdr_enum(xdrs, (enum_t *) padc_namekind));
62         switch (cred->adc_namekind) {
63         case ADN_FULLNAME:
64                 ATTEMPT(xdr_string(xdrs, &cred->adc_fullname.name,
65                     MAXNETNAMELEN));
66                 ATTEMPT(xdr_opaque(xdrs, (caddr_t)&cred->adc_fullname.key,
67                     sizeof(des_block)));
68                 ATTEMPT(xdr_opaque(xdrs, (caddr_t)&cred->adc_fullname.window,
69                     sizeof(cred->adc_fullname.window)));
70                 return (TRUE);
71         case ADN_NICKNAME:
72                 ATTEMPT(xdr_opaque(xdrs, (caddr_t)&cred->adc_nickname,
73                     sizeof(cred->adc_nickname)));
74                 return (TRUE);
75         default:
76                 return (FALSE);
77         }
78 }
79
80
81 bool_t
82 xdr_authdes_verf(xdrs, verf)
83         XDR *xdrs;
84         struct authdes_verf *verf;      
85 {
86         /*
87          * Unrolled xdr
88          */
89         ATTEMPT(xdr_opaque(xdrs, (caddr_t)&verf->adv_xtimestamp,
90             sizeof(des_block)));
91         ATTEMPT(xdr_opaque(xdrs, (caddr_t)&verf->adv_int_u,
92             sizeof(verf->adv_int_u)));
93         return (TRUE);
94 }