12e322d37SHiroki Sato /*- 2*2321c474SPedro F. Giffuni * SPDX-License-Identifier: BSD-3-Clause 3*2321c474SPedro F. Giffuni * 42e322d37SHiroki Sato * Copyright (c) 2009, Sun Microsystems, Inc. 52e322d37SHiroki Sato * All rights reserved. 6f7e2700fSBill Paul * 72e322d37SHiroki Sato * Redistribution and use in source and binary forms, with or without 82e322d37SHiroki Sato * modification, are permitted provided that the following conditions are met: 92e322d37SHiroki Sato * - Redistributions of source code must retain the above copyright notice, 102e322d37SHiroki Sato * this list of conditions and the following disclaimer. 112e322d37SHiroki Sato * - Redistributions in binary form must reproduce the above copyright notice, 122e322d37SHiroki Sato * this list of conditions and the following disclaimer in the documentation 132e322d37SHiroki Sato * and/or other materials provided with the distribution. 142e322d37SHiroki Sato * - Neither the name of Sun Microsystems, Inc. nor the names of its 152e322d37SHiroki Sato * contributors may be used to endorse or promote products derived 162e322d37SHiroki Sato * from this software without specific prior written permission. 17f7e2700fSBill Paul * 182e322d37SHiroki Sato * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 192e322d37SHiroki Sato * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 202e322d37SHiroki Sato * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 212e322d37SHiroki Sato * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 222e322d37SHiroki Sato * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 232e322d37SHiroki Sato * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 242e322d37SHiroki Sato * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 252e322d37SHiroki Sato * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 262e322d37SHiroki Sato * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 272e322d37SHiroki Sato * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 282e322d37SHiroki Sato * POSSIBILITY OF SUCH DAMAGE. 298360efbdSAlfred Perlstein * 30f7e2700fSBill Paul */ 31f7e2700fSBill Paul 32f7e2700fSBill Paul /* 338360efbdSAlfred Perlstein * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc. 34f7e2700fSBill Paul */ 35f7e2700fSBill Paul 36f7e2700fSBill Paul /* 37f7e2700fSBill Paul * auth_des.h, Protocol for DES style authentication for RPC 38f7e2700fSBill Paul */ 39f7e2700fSBill Paul 40f7e2700fSBill Paul #ifndef _AUTH_DES_ 41f7e2700fSBill Paul #define _AUTH_DES_ 42f7e2700fSBill Paul 43f7e2700fSBill Paul /* 44f7e2700fSBill Paul * There are two kinds of "names": fullnames and nicknames 45f7e2700fSBill Paul */ 46f7e2700fSBill Paul enum authdes_namekind { 47f7e2700fSBill Paul ADN_FULLNAME, 48f7e2700fSBill Paul ADN_NICKNAME 49f7e2700fSBill Paul }; 50f7e2700fSBill Paul 51f7e2700fSBill Paul /* 52f7e2700fSBill Paul * A fullname contains the network name of the client, 53f7e2700fSBill Paul * a conversation key and the window 54f7e2700fSBill Paul */ 55f7e2700fSBill Paul struct authdes_fullname { 56f7e2700fSBill Paul char *name; /* network name of client, up to MAXNETNAMELEN */ 57f7e2700fSBill Paul des_block key; /* conversation key */ 58f7e2700fSBill Paul u_long window; /* associated window */ 59f7e2700fSBill Paul }; 60f7e2700fSBill Paul 61f7e2700fSBill Paul 62f7e2700fSBill Paul /* 63f7e2700fSBill Paul * A credential 64f7e2700fSBill Paul */ 65f7e2700fSBill Paul struct authdes_cred { 66f7e2700fSBill Paul enum authdes_namekind adc_namekind; 67f7e2700fSBill Paul struct authdes_fullname adc_fullname; 68f7e2700fSBill Paul u_long adc_nickname; 69f7e2700fSBill Paul }; 70f7e2700fSBill Paul 71f7e2700fSBill Paul 72f7e2700fSBill Paul 73f7e2700fSBill Paul /* 74f7e2700fSBill Paul * A des authentication verifier 75f7e2700fSBill Paul */ 76f7e2700fSBill Paul struct authdes_verf { 77f7e2700fSBill Paul union { 78f7e2700fSBill Paul struct timeval adv_ctime; /* clear time */ 79f7e2700fSBill Paul des_block adv_xtime; /* crypt time */ 80f7e2700fSBill Paul } adv_time_u; 81f7e2700fSBill Paul u_long adv_int_u; 82f7e2700fSBill Paul }; 83f7e2700fSBill Paul 84f7e2700fSBill Paul /* 85f7e2700fSBill Paul * des authentication verifier: client variety 86f7e2700fSBill Paul * 87f7e2700fSBill Paul * adv_timestamp is the current time. 88f7e2700fSBill Paul * adv_winverf is the credential window + 1. 89f7e2700fSBill Paul * Both are encrypted using the conversation key. 90f7e2700fSBill Paul */ 91f7e2700fSBill Paul #define adv_timestamp adv_time_u.adv_ctime 92f7e2700fSBill Paul #define adv_xtimestamp adv_time_u.adv_xtime 93f7e2700fSBill Paul #define adv_winverf adv_int_u 94f7e2700fSBill Paul 95f7e2700fSBill Paul /* 96f7e2700fSBill Paul * des authentication verifier: server variety 97f7e2700fSBill Paul * 98f7e2700fSBill Paul * adv_timeverf is the client's timestamp + client's window 99f7e2700fSBill Paul * adv_nickname is the server's nickname for the client. 100f7e2700fSBill Paul * adv_timeverf is encrypted using the conversation key. 101f7e2700fSBill Paul */ 102f7e2700fSBill Paul #define adv_timeverf adv_time_u.adv_ctime 103f7e2700fSBill Paul #define adv_xtimeverf adv_time_u.adv_xtime 104f7e2700fSBill Paul #define adv_nickname adv_int_u 105f7e2700fSBill Paul 1068360efbdSAlfred Perlstein /* 1078360efbdSAlfred Perlstein * Map a des credential into a unix cred. 1088360efbdSAlfred Perlstein * 1098360efbdSAlfred Perlstein */ 110f7e2700fSBill Paul __BEGIN_DECLS 111bb28f3c2SWarner Losh extern int authdes_getucred( struct authdes_cred *, uid_t *, gid_t *, int *, gid_t * ); 112f7e2700fSBill Paul __END_DECLS 113f7e2700fSBill Paul 1148360efbdSAlfred Perlstein __BEGIN_DECLS 1158360efbdSAlfred Perlstein extern bool_t xdr_authdes_cred(XDR *, struct authdes_cred *); 1168360efbdSAlfred Perlstein extern bool_t xdr_authdes_verf(XDR *, struct authdes_verf *); 1178360efbdSAlfred Perlstein extern int rtime(dev_t, struct netbuf *, int, struct timeval *, 1188360efbdSAlfred Perlstein struct timeval *); 1198360efbdSAlfred Perlstein extern void kgetnetname(char *); 1208360efbdSAlfred Perlstein extern enum auth_stat _svcauth_des(struct svc_req *, struct rpc_msg *); 1218360efbdSAlfred Perlstein __END_DECLS 1228360efbdSAlfred Perlstein 123f7e2700fSBill Paul #endif /* ndef _AUTH_DES_ */ 124