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