126209Swpaul/* @(#)auth_des.h 2.2 88/07/29 4.0 RPCSRC; from 1.3 88/02/08 SMI */ 274462Salfred/* $FreeBSD$ */ 3261046Smav/*- 4261046Smav * Copyright (c) 2009, Sun Microsystems, Inc. 5261046Smav * All rights reserved. 6261046Smav * 7261046Smav * Redistribution and use in source and binary forms, with or without 8261046Smav * modification, are permitted provided that the following conditions are met: 9261046Smav * - Redistributions of source code must retain the above copyright notice, 10261046Smav * this list of conditions and the following disclaimer. 11261046Smav * - Redistributions in binary form must reproduce the above copyright notice, 12261046Smav * this list of conditions and the following disclaimer in the documentation 13261046Smav * and/or other materials provided with the distribution. 14261046Smav * - Neither the name of Sun Microsystems, Inc. nor the names of its 15261046Smav * contributors may be used to endorse or promote products derived 16261046Smav * from this software without specific prior written permission. 17261046Smav * 18261046Smav * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19261046Smav * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20261046Smav * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21261046Smav * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22261046Smav * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23261046Smav * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24261046Smav * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25261046Smav * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26261046Smav * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27261046Smav * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28261046Smav * POSSIBILITY OF SUCH DAMAGE. 2926209Swpaul * 3074462Salfred * from: @(#)auth_des.h 2.2 88/07/29 4.0 RPCSRC 3174462Salfred * from: @(#)auth_des.h 1.14 94/04/25 SMI 3226209Swpaul */ 3326209Swpaul 3426209Swpaul/* 3574462Salfred * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc. 3626209Swpaul */ 3726209Swpaul 3826209Swpaul/* 3926209Swpaul * auth_des.h, Protocol for DES style authentication for RPC 4026209Swpaul */ 4126209Swpaul 4226209Swpaul#ifndef _AUTH_DES_ 4326209Swpaul#define _AUTH_DES_ 4426209Swpaul 4526209Swpaul/* 4626209Swpaul * There are two kinds of "names": fullnames and nicknames 4726209Swpaul */ 4826209Swpaulenum authdes_namekind { 4926209Swpaul ADN_FULLNAME, 5026209Swpaul ADN_NICKNAME 5126209Swpaul}; 5226209Swpaul 5326209Swpaul/* 5426209Swpaul * A fullname contains the network name of the client, 5526209Swpaul * a conversation key and the window 5626209Swpaul */ 5726209Swpaulstruct authdes_fullname { 5826209Swpaul char *name; /* network name of client, up to MAXNETNAMELEN */ 5926209Swpaul des_block key; /* conversation key */ 6026209Swpaul u_long window; /* associated window */ 6126209Swpaul}; 6226209Swpaul 6326209Swpaul 6426209Swpaul/* 6526209Swpaul * A credential 6626209Swpaul */ 6726209Swpaulstruct authdes_cred { 6826209Swpaul enum authdes_namekind adc_namekind; 6926209Swpaul struct authdes_fullname adc_fullname; 7026209Swpaul u_long adc_nickname; 7126209Swpaul}; 7226209Swpaul 7326209Swpaul 7426209Swpaul 7526209Swpaul/* 7626209Swpaul * A des authentication verifier 7726209Swpaul */ 7826209Swpaulstruct authdes_verf { 7926209Swpaul union { 8026209Swpaul struct timeval adv_ctime; /* clear time */ 8126209Swpaul des_block adv_xtime; /* crypt time */ 8226209Swpaul } adv_time_u; 8326209Swpaul u_long adv_int_u; 8426209Swpaul}; 8526209Swpaul 8626209Swpaul/* 8726209Swpaul * des authentication verifier: client variety 8826209Swpaul * 8926209Swpaul * adv_timestamp is the current time. 9026209Swpaul * adv_winverf is the credential window + 1. 9126209Swpaul * Both are encrypted using the conversation key. 9226209Swpaul */ 9326209Swpaul#define adv_timestamp adv_time_u.adv_ctime 9426209Swpaul#define adv_xtimestamp adv_time_u.adv_xtime 9526209Swpaul#define adv_winverf adv_int_u 9626209Swpaul 9726209Swpaul/* 9826209Swpaul * des authentication verifier: server variety 9926209Swpaul * 10026209Swpaul * adv_timeverf is the client's timestamp + client's window 10126209Swpaul * adv_nickname is the server's nickname for the client. 10226209Swpaul * adv_timeverf is encrypted using the conversation key. 10326209Swpaul */ 10426209Swpaul#define adv_timeverf adv_time_u.adv_ctime 10526209Swpaul#define adv_xtimeverf adv_time_u.adv_xtime 10626209Swpaul#define adv_nickname adv_int_u 10726209Swpaul 10874462Salfred/* 10974462Salfred * Map a des credential into a unix cred. 11074462Salfred * 11174462Salfred */ 11226209Swpaul__BEGIN_DECLS 11393032Simpextern int authdes_getucred( struct authdes_cred *, uid_t *, gid_t *, int *, gid_t * ); 11426209Swpaul__END_DECLS 11526209Swpaul 11674462Salfred__BEGIN_DECLS 11774462Salfredextern bool_t xdr_authdes_cred(XDR *, struct authdes_cred *); 11874462Salfredextern bool_t xdr_authdes_verf(XDR *, struct authdes_verf *); 11974462Salfredextern int rtime(dev_t, struct netbuf *, int, struct timeval *, 12074462Salfred struct timeval *); 12174462Salfredextern void kgetnetname(char *); 12274462Salfredextern enum auth_stat _svcauth_des(struct svc_req *, struct rpc_msg *); 12374462Salfred__END_DECLS 12474462Salfred 12526209Swpaul#endif /* ndef _AUTH_DES_ */ 126