xref: /dragonfly/include/rpc/auth_des.h (revision 71126e33)
1 /*
2  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
3  * unrestricted use provided that this legend is included on all tape
4  * media and as a part of the software program in whole or part.  Users
5  * may copy or modify Sun RPC without charge, but are not authorized
6  * to license or distribute it to anyone else except as part of a product or
7  * program developed by the user.
8  *
9  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
10  * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
11  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
12  *
13  * Sun RPC is provided with no support and without any obligation on the
14  * part of Sun Microsystems, Inc. to assist in its use, correction,
15  * modification or enhancement.
16  *
17  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
18  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
19  * OR ANY PART THEREOF.
20  *
21  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
22  * or profits or other special, indirect and consequential damages, even if
23  * Sun has been advised of the possibility of such damages.
24  *
25  * Sun Microsystems, Inc.
26  * 2550 Garcia Avenue
27  * Mountain View, California  94043
28  *
29  *	@(#)auth_des.h	2.2 88/07/29 4.0 RPCSRC; from 1.3 88/02/08 SMI
30  *	$DragonFly: src/include/rpc/auth_des.h,v 1.2 2003/11/14 01:01:50 dillon Exp $
31  */
32 
33 /*
34  * Copyright (c) 1988 by Sun Microsystems, Inc.
35  */
36 
37 /*
38  * auth_des.h, Protocol for DES style authentication for RPC
39  */
40 
41 #ifndef _AUTH_DES_
42 #define _AUTH_DES_
43 
44 /*
45  * There are two kinds of "names": fullnames and nicknames
46  */
47 enum authdes_namekind {
48 	ADN_FULLNAME,
49 	ADN_NICKNAME
50 };
51 
52 /*
53  * A fullname contains the network name of the client,
54  * a conversation key and the window
55  */
56 struct authdes_fullname {
57 	char *name;		/* network name of client, up to MAXNETNAMELEN */
58 	des_block key;		/* conversation key */
59 	u_long window;		/* associated window */
60 };
61 
62 
63 /*
64  * A credential
65  */
66 struct authdes_cred {
67 	enum authdes_namekind adc_namekind;
68 	struct authdes_fullname adc_fullname;
69 	u_long adc_nickname;
70 };
71 
72 
73 
74 /*
75  * A des authentication verifier
76  */
77 struct authdes_verf {
78 	union {
79 		struct timeval adv_ctime;	/* clear time */
80 		des_block adv_xtime;		/* crypt time */
81 	} adv_time_u;
82 	u_long adv_int_u;
83 };
84 
85 /*
86  * des authentication verifier: client variety
87  *
88  * adv_timestamp is the current time.
89  * adv_winverf is the credential window + 1.
90  * Both are encrypted using the conversation key.
91  */
92 #define adv_timestamp	adv_time_u.adv_ctime
93 #define adv_xtimestamp	adv_time_u.adv_xtime
94 #define adv_winverf	adv_int_u
95 
96 /*
97  * des authentication verifier: server variety
98  *
99  * adv_timeverf is the client's timestamp + client's window
100  * adv_nickname is the server's nickname for the client.
101  * adv_timeverf is encrypted using the conversation key.
102  */
103 #define adv_timeverf	adv_time_u.adv_ctime
104 #define adv_xtimeverf	adv_time_u.adv_xtime
105 #define adv_nickname	adv_int_u
106 
107 __BEGIN_DECLS
108 extern int authdes_getucred ( struct authdes_cred *, uid_t *, gid_t *, int *, gid_t * );
109 __END_DECLS
110 
111 #endif /* ndef _AUTH_DES_ */
112