]>
Commit | Line | Data |
---|---|---|
04277e02 | 1 | /* Copyright (C) 1996-2019 Free Software Foundation, Inc. |
800d775e UD |
2 | This file is part of the GNU C Library. |
3 | ||
4 | The GNU C Library is free software; you can redistribute it and/or | |
41bdb6e2 AJ |
5 | modify it under the terms of the GNU Lesser General Public |
6 | License as published by the Free Software Foundation; either | |
7 | version 2.1 of the License, or (at your option) any later version. | |
800d775e UD |
8 | |
9 | The GNU C Library is distributed in the hope that it will be useful, | |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
41bdb6e2 | 12 | Lesser General Public License for more details. |
800d775e | 13 | |
41bdb6e2 | 14 | You should have received a copy of the GNU Lesser General Public |
59ba27a6 PE |
15 | License along with the GNU C Library; if not, see |
16 | <http://www.gnu.org/licenses/>. */ | |
800d775e UD |
17 | |
18 | #ifndef _RPC_AUTH_DES_H | |
800d775e | 19 | #define _RPC_AUTH_DES_H 1 |
a5a0310d | 20 | |
800d775e | 21 | #include <sys/cdefs.h> |
a5a0310d | 22 | #include <rpc/auth.h> |
800d775e UD |
23 | |
24 | __BEGIN_DECLS | |
25 | ||
26 | /* There are two kinds of "names": fullnames and nicknames */ | |
27 | enum authdes_namekind | |
28 | { | |
29 | ADN_FULLNAME, | |
30 | ADN_NICKNAME | |
31 | }; | |
32 | ||
33 | /* A fullname contains the network name of the client, | |
34 | a conversation key and the window */ | |
35 | struct authdes_fullname | |
36 | { | |
a5a0310d UD |
37 | char *name; /* network name of client, up to MAXNETNAMELEN */ |
38 | des_block key; /* conversation key */ | |
a1129917 | 39 | uint32_t window; /* associated window */ |
800d775e UD |
40 | }; |
41 | ||
42 | /* A credential */ | |
43 | struct authdes_cred | |
44 | { | |
45 | enum authdes_namekind adc_namekind; | |
46 | struct authdes_fullname adc_fullname; | |
a1129917 | 47 | uint32_t adc_nickname; |
800d775e UD |
48 | }; |
49 | ||
f8afba91 UD |
50 | /* A timeval replacement for !32bit platforms */ |
51 | struct rpc_timeval | |
52 | { | |
53 | uint32_t tv_sec; /* Seconds. */ | |
54 | uint32_t tv_usec; /* Microseconds. */ | |
55 | }; | |
56 | ||
800d775e UD |
57 | /* A des authentication verifier */ |
58 | struct authdes_verf | |
59 | { | |
60 | union | |
61 | { | |
f8afba91 | 62 | struct rpc_timeval adv_ctime; /* clear time */ |
a5a0310d | 63 | des_block adv_xtime; /* crypt time */ |
800d775e UD |
64 | } |
65 | adv_time_u; | |
a1129917 | 66 | uint32_t adv_int_u; |
800d775e UD |
67 | }; |
68 | ||
69 | /* des authentication verifier: client variety | |
70 | ||
71 | adv_timestamp is the current time. | |
72 | adv_winverf is the credential window + 1. | |
73 | Both are encrypted using the conversation key. */ | |
74 | #define adv_timestamp adv_time_u.adv_ctime | |
75 | #define adv_xtimestamp adv_time_u.adv_xtime | |
76 | #define adv_winverf adv_int_u | |
77 | ||
78 | /* des authentication verifier: server variety | |
79 | ||
80 | adv_timeverf is the client's timestamp + client's window | |
81 | adv_nickname is the server's nickname for the client. | |
82 | adv_timeverf is encrypted using the conversation key. */ | |
83 | #define adv_timeverf adv_time_u.adv_ctime | |
84 | #define adv_xtimeverf adv_time_u.adv_xtime | |
85 | #define adv_nickname adv_int_u | |
86 | ||
87 | /* Map a des credential into a unix cred. */ | |
a784e502 | 88 | extern int authdes_getucred (const struct authdes_cred * __adc, |
c1422e5b UD |
89 | uid_t * __uid, gid_t * __gid, |
90 | short *__grouplen, gid_t * __groups) __THROW; | |
800d775e UD |
91 | |
92 | /* Get the public key for NAME and place it in KEY. NAME can only be | |
93 | up to MAXNETNAMELEN bytes long and the destination buffer KEY should | |
36ecfe56 | 94 | have HEXKEYBYTES + 1 bytes long to fit all characters from the key. */ |
a784e502 | 95 | extern int getpublickey (const char *__name, char *__key) __THROW; |
800d775e UD |
96 | |
97 | /* Get the secret key for NAME and place it in KEY. PASSWD is used to | |
98 | decrypt the encrypted key stored in the database. NAME can only be | |
99 | up to MAXNETNAMELEN bytes long and the destination buffer KEY | |
36ecfe56 | 100 | should have HEXKEYBYTES + 1 bytes long to fit all characters from |
800d775e | 101 | the key. */ |
a784e502 UD |
102 | extern int getsecretkey (const char *__name, char *__key, |
103 | const char *__passwd) __THROW; | |
800d775e | 104 | |
c1422e5b UD |
105 | extern int rtime (struct sockaddr_in *__addrp, struct rpc_timeval *__timep, |
106 | struct rpc_timeval *__timeout) __THROW; | |
800d775e UD |
107 | |
108 | __END_DECLS | |
109 | ||
110 | ||
111 | #endif /* rpc/auth_des.h */ |