]> git.ipfire.org Git - thirdparty/glibc.git/blame - sunrpc/rpc/auth_des.h
Use <> for include of kernel-features.h.
[thirdparty/glibc.git] / sunrpc / rpc / auth_des.h
CommitLineData
a784e502 1/* Copyright (C) 1996, 1997, 1998, 1999, 2012 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
AJ
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, write to the Free
16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17 02111-1307 USA. */
800d775e
UD
18
19#ifndef _RPC_AUTH_DES_H
800d775e 20#define _RPC_AUTH_DES_H 1
a5a0310d 21
800d775e 22#include <sys/cdefs.h>
a5a0310d 23#include <rpc/auth.h>
800d775e
UD
24
25__BEGIN_DECLS
26
27/* There are two kinds of "names": fullnames and nicknames */
28enum authdes_namekind
29 {
30 ADN_FULLNAME,
31 ADN_NICKNAME
32 };
33
34/* A fullname contains the network name of the client,
35 a conversation key and the window */
36struct authdes_fullname
37 {
a5a0310d
UD
38 char *name; /* network name of client, up to MAXNETNAMELEN */
39 des_block key; /* conversation key */
a1129917 40 uint32_t window; /* associated window */
800d775e
UD
41 };
42
43/* A credential */
44struct authdes_cred
45 {
46 enum authdes_namekind adc_namekind;
47 struct authdes_fullname adc_fullname;
a1129917 48 uint32_t adc_nickname;
800d775e
UD
49 };
50
f8afba91
UD
51/* A timeval replacement for !32bit platforms */
52struct rpc_timeval
53 {
54 uint32_t tv_sec; /* Seconds. */
55 uint32_t tv_usec; /* Microseconds. */
56 };
57
800d775e
UD
58/* A des authentication verifier */
59struct authdes_verf
60 {
61 union
62 {
f8afba91 63 struct rpc_timeval adv_ctime; /* clear time */
a5a0310d 64 des_block adv_xtime; /* crypt time */
800d775e
UD
65 }
66 adv_time_u;
a1129917 67 uint32_t adv_int_u;
800d775e
UD
68 };
69
70/* des authentication verifier: client variety
71
72 adv_timestamp is the current time.
73 adv_winverf is the credential window + 1.
74 Both are encrypted using the conversation key. */
75#define adv_timestamp adv_time_u.adv_ctime
76#define adv_xtimestamp adv_time_u.adv_xtime
77#define adv_winverf adv_int_u
78
79/* des authentication verifier: server variety
80
81 adv_timeverf is the client's timestamp + client's window
82 adv_nickname is the server's nickname for the client.
83 adv_timeverf is encrypted using the conversation key. */
84#define adv_timeverf adv_time_u.adv_ctime
85#define adv_xtimeverf adv_time_u.adv_xtime
86#define adv_nickname adv_int_u
87
88/* Map a des credential into a unix cred. */
a784e502 89extern int authdes_getucred (const struct authdes_cred * __adc,
c1422e5b
UD
90 uid_t * __uid, gid_t * __gid,
91 short *__grouplen, gid_t * __groups) __THROW;
800d775e
UD
92
93/* Get the public key for NAME and place it in KEY. NAME can only be
94 up to MAXNETNAMELEN bytes long and the destination buffer KEY should
36ecfe56 95 have HEXKEYBYTES + 1 bytes long to fit all characters from the key. */
a784e502 96extern int getpublickey (const char *__name, char *__key) __THROW;
800d775e
UD
97
98/* Get the secret key for NAME and place it in KEY. PASSWD is used to
99 decrypt the encrypted key stored in the database. NAME can only be
100 up to MAXNETNAMELEN bytes long and the destination buffer KEY
36ecfe56 101 should have HEXKEYBYTES + 1 bytes long to fit all characters from
800d775e 102 the key. */
a784e502
UD
103extern int getsecretkey (const char *__name, char *__key,
104 const char *__passwd) __THROW;
800d775e 105
c1422e5b
UD
106extern int rtime (struct sockaddr_in *__addrp, struct rpc_timeval *__timep,
107 struct rpc_timeval *__timeout) __THROW;
800d775e
UD
108
109__END_DECLS
110
111
112#endif /* rpc/auth_des.h */