8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / uts / common / rpc / auth_des.h
blobe2bd59f47269646526c16bee69edffea24cfcf5f
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
26 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
27 /* All Rights Reserved */
29 * Portions of this source code were derived from Berkeley
30 * 4.3 BSD under license from the Regents of the University of
31 * California.
34 #ifndef _RPC_AUTH_DES_H
35 #define _RPC_AUTH_DES_H
37 #pragma ident "%Z%%M% %I% %E% SMI"
40 * auth_des.h, Protocol for DES style authentication for RPC
44 #include <rpc/auth.h>
45 #ifdef _KERNEL
46 #include <rpc/svc.h>
47 #endif /* _KERNEL */
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
55 * There are two kinds of "names": fullnames and nicknames
57 enum authdes_namekind {
58 ADN_FULLNAME,
59 ADN_NICKNAME
63 * A fullname contains the network name of the client,
64 * a conversation key and the window
66 struct authdes_fullname {
67 char *name; /* network name of client, up to MAXNETNAMELEN */
68 des_block key; /* conversation key */
69 uint32_t window; /* associated window */
74 * A credential
76 struct authdes_cred {
77 enum authdes_namekind adc_namekind;
78 struct authdes_fullname adc_fullname;
79 uint32_t adc_nickname;
83 * A des authentication verifier
85 struct authdes_verf {
86 union {
87 struct timeval adv_ctime; /* clear time */
88 des_block adv_xtime; /* crypt time */
89 } adv_time_u;
90 uint32_t adv_int_u;
94 * des authentication verifier: client variety
96 * adv_timestamp is the current time.
97 * adv_winverf is the credential window + 1.
98 * Both are encrypted using the conversation key.
100 #define adv_timestamp adv_time_u.adv_ctime
101 #define adv_xtimestamp adv_time_u.adv_xtime
102 #define adv_winverf adv_int_u
105 * des authentication verifier: server variety
107 * adv_timeverf is the client's timestamp + client's window
108 * adv_nickname is the server's nickname for the client.
109 * adv_timeverf is encrypted using the conversation key.
111 #define adv_timeverf adv_time_u.adv_ctime
112 #define adv_xtimeverf adv_time_u.adv_xtime
113 #define adv_nickname adv_int_u
116 * Map a des credential into a unix cred.
118 * authdes_getucred(adc, uid, gid, grouplen, groups)
119 * struct authdes_cred *adc;
120 * uid_t *uid;
121 * gid_t *gid;
122 * short *grouplen;
123 * gid_t *groups;
127 #ifdef _KERNEL
128 extern int kauthdes_getucred(const struct authdes_cred *, cred_t *);
129 #else
130 #ifdef __STDC__
131 extern int authdes_getucred(const struct authdes_cred *,
132 uid_t *, gid_t *, short *, gid_t *);
133 #else
134 extern int authdes_getucred();
135 #endif
136 #endif
138 #ifndef _KERNEL
139 #ifdef __STDC__
140 extern int getpublickey(const char *, char *);
141 extern int getsecretkey(const char *, char *, const char *);
142 #else
143 extern int getpublickey();
144 extern int getsecretkey();
145 #endif
146 #endif
148 #ifdef _KERNEL
150 #ifdef __STDC__
151 extern int authdes_create(char *, uint_t, struct netbuf *,
152 struct knetconfig *, des_block *, int, AUTH **);
153 extern bool_t xdr_authdes_cred(XDR *, struct authdes_cred *);
154 extern bool_t xdr_authdes_verf(XDR *, struct authdes_verf *);
155 extern int rtime(struct knetconfig *, struct netbuf *, int,
156 struct timeval *, struct timeval *);
157 extern enum clnt_stat kgetnetname(char *);
158 extern enum auth_stat _svcauth_des(struct svc_req *, struct rpc_msg *);
159 #else
160 extern int authdes_create();
161 extern bool_t xdr_authdes_cred();
162 extern bool_t xdr_authdes_verf();
163 extern int rtime();
164 extern enum clnt_stat kgetnetname();
165 extern enum auth_stat _svcauth_des();
166 #endif
168 extern kmutex_t authdes_ops_lock;
170 #endif
172 #ifdef __cplusplus
174 #endif
176 #endif /* _RPC_AUTH_DES_H */