/*-1* SPDX-License-Identifier: BSD-3-Clause2*3* Copyright (c) 2009, Sun Microsystems, Inc.4* All rights reserved.5*6* Redistribution and use in source and binary forms, with or without7* modification, are permitted provided that the following conditions are met:8* - Redistributions of source code must retain the above copyright notice,9* this list of conditions and the following disclaimer.10* - Redistributions in binary form must reproduce the above copyright notice,11* this list of conditions and the following disclaimer in the documentation12* and/or other materials provided with the distribution.13* - Neither the name of Sun Microsystems, Inc. nor the names of its14* contributors may be used to endorse or promote products derived15* from this software without specific prior written permission.16*17* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"18* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE19* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE20* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE21* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR22* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF23* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS24* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN25* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)26* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE27* POSSIBILITY OF SUCH DAMAGE.28*/29/*30* Copyright (c) 1986-1991 by Sun Microsystems Inc.31*/3233/*34* authdes_prot.c, XDR routines for DES authentication35*/3637#include "namespace.h"38#include <rpc/types.h>39#include <rpc/xdr.h>40#include <rpc/auth.h>41#include <rpc/auth_des.h>42#include "un-namespace.h"4344#define ATTEMPT(xdr_op) if (!(xdr_op)) return (FALSE)4546bool_t47xdr_authdes_cred(XDR *xdrs, struct authdes_cred *cred)48{49enum authdes_namekind *padc_namekind = &cred->adc_namekind;50/*51* Unrolled xdr52*/53ATTEMPT(xdr_enum(xdrs, (enum_t *) padc_namekind));54switch (cred->adc_namekind) {55case ADN_FULLNAME:56ATTEMPT(xdr_string(xdrs, &cred->adc_fullname.name,57MAXNETNAMELEN));58ATTEMPT(xdr_opaque(xdrs, (caddr_t)&cred->adc_fullname.key,59sizeof(des_block)));60ATTEMPT(xdr_opaque(xdrs, (caddr_t)&cred->adc_fullname.window,61sizeof(cred->adc_fullname.window)));62return (TRUE);63case ADN_NICKNAME:64ATTEMPT(xdr_opaque(xdrs, (caddr_t)&cred->adc_nickname,65sizeof(cred->adc_nickname)));66return (TRUE);67default:68return (FALSE);69}70}717273bool_t74xdr_authdes_verf(XDR *xdrs, struct authdes_verf *verf)75{76/*77* Unrolled xdr78*/79ATTEMPT(xdr_opaque(xdrs, (caddr_t)&verf->adv_xtimestamp,80sizeof(des_block)));81ATTEMPT(xdr_opaque(xdrs, (caddr_t)&verf->adv_int_u,82sizeof(verf->adv_int_u)));83return (TRUE);84}858687