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