master
1/* @(#)auth_des.h 2.2 88/07/29 4.0 RPCSRC; from 1.3 88/02/08 SMI */
2/*-
3 * SPDX-License-Identifier: BSD-3-Clause
4 *
5 * Copyright (c) 2009, Sun Microsystems, Inc.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
10 * - Redistributions of source code must retain the above copyright notice,
11 * this list of conditions and the following disclaimer.
12 * - Redistributions in binary form must reproduce the above copyright notice,
13 * this list of conditions and the following disclaimer in the documentation
14 * and/or other materials provided with the distribution.
15 * - Neither the name of Sun Microsystems, Inc. nor the names of its
16 * contributors may be used to endorse or promote products derived
17 * from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 *
31 * from: @(#)auth_des.h 2.2 88/07/29 4.0 RPCSRC
32 * from: @(#)auth_des.h 1.14 94/04/25 SMI
33 */
34
35/*
36 * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc.
37 */
38
39/*
40 * auth_des.h, Protocol for DES style authentication for RPC
41 */
42
43#ifndef _AUTH_DES_
44#define _AUTH_DES_
45
46/*
47 * There are two kinds of "names": fullnames and nicknames
48 */
49enum authdes_namekind {
50 ADN_FULLNAME,
51 ADN_NICKNAME
52};
53
54/*
55 * A fullname contains the network name of the client,
56 * a conversation key and the window
57 */
58struct authdes_fullname {
59 char *name; /* network name of client, up to MAXNETNAMELEN */
60 des_block key; /* conversation key */
61 u_long window; /* associated window */
62};
63
64
65/*
66 * A credential
67 */
68struct authdes_cred {
69 enum authdes_namekind adc_namekind;
70 struct authdes_fullname adc_fullname;
71 u_long adc_nickname;
72};
73
74
75
76/*
77 * A des authentication verifier
78 */
79struct authdes_verf {
80 union {
81 struct timeval adv_ctime; /* clear time */
82 des_block adv_xtime; /* crypt time */
83 } adv_time_u;
84 u_long adv_int_u;
85};
86
87/*
88 * des authentication verifier: client variety
89 *
90 * adv_timestamp is the current time.
91 * adv_winverf is the credential window + 1.
92 * Both are encrypted using the conversation key.
93 */
94#define adv_timestamp adv_time_u.adv_ctime
95#define adv_xtimestamp adv_time_u.adv_xtime
96#define adv_winverf adv_int_u
97
98/*
99 * des authentication verifier: server variety
100 *
101 * adv_timeverf is the client's timestamp + client's window
102 * adv_nickname is the server's nickname for the client.
103 * adv_timeverf is encrypted using the conversation key.
104 */
105#define adv_timeverf adv_time_u.adv_ctime
106#define adv_xtimeverf adv_time_u.adv_xtime
107#define adv_nickname adv_int_u
108
109/*
110 * Map a des credential into a unix cred.
111 *
112 */
113__BEGIN_DECLS
114extern int authdes_getucred( struct authdes_cred *, uid_t *, gid_t *, int *, gid_t * );
115__END_DECLS
116
117__BEGIN_DECLS
118extern bool_t xdr_authdes_cred(XDR *, struct authdes_cred *);
119extern bool_t xdr_authdes_verf(XDR *, struct authdes_verf *);
120extern int rtime(dev_t, struct netbuf *, int, struct timeval *,
121 struct timeval *);
122extern void kgetnetname(char *);
123extern enum auth_stat _svcauth_des(struct svc_req *, struct rpc_msg *);
124__END_DECLS
125
126#endif /* ndef _AUTH_DES_ */