sed(1): Appease older GCC.
[freebsd-src.git] / include / rpc / auth_kerb.h
blobb6c5ae100e6053f30f08ff82ef77a3e3029e7a5c
1 /* $FreeBSD$ */
2 /*-
3 * Copyright (c) 2009, Sun Microsystems, Inc.
4 * All rights reserved.
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.
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.
30 * auth_kerb.h, Protocol for Kerberos style authentication for RPC
32 * Copyright (C) 1986, Sun Microsystems, Inc.
35 #ifndef _RPC_AUTH_KERB_H
36 #define _RPC_AUTH_KERB_H
38 #ifdef KERBEROS
40 #include <kerberos/krb.h>
41 #include <sys/socket.h>
42 #include <sys/t_kuser.h>
43 #include <netinet/in.h>
44 #include <rpc/svc.h>
47 * There are two kinds of "names": fullnames and nicknames
49 enum authkerb_namekind {
50 AKN_FULLNAME,
51 AKN_NICKNAME
54 * A fullname contains the ticket and the window
56 struct authkerb_fullname {
57 KTEXT_ST ticket;
58 u_long window; /* associated window */
62 * cooked credential stored in rq_clntcred
64 struct authkerb_clnt_cred {
65 /* start of AUTH_DAT */
66 unsigned char k_flags; /* Flags from ticket */
67 char pname[ANAME_SZ]; /* Principal's name */
68 char pinst[INST_SZ]; /* His Instance */
69 char prealm[REALM_SZ]; /* His Realm */
70 unsigned long checksum; /* Data checksum (opt) */
71 C_Block session; /* Session Key */
72 int life; /* Life of ticket */
73 unsigned long time_sec; /* Time ticket issued */
74 unsigned long address; /* Address in ticket */
75 /* KTEXT_ST reply; Auth reply (opt) */
76 /* end of AUTH_DAT */
77 unsigned long expiry; /* time the ticket is expiring */
78 u_long nickname; /* Nickname into cache */
79 u_long window; /* associated window */
82 typedef struct authkerb_clnt_cred authkerb_clnt_cred;
85 * A credential
87 struct authkerb_cred {
88 enum authkerb_namekind akc_namekind;
89 struct authkerb_fullname akc_fullname;
90 u_long akc_nickname;
94 * A kerb authentication verifier
96 struct authkerb_verf {
97 union {
98 struct timeval akv_ctime; /* clear time */
99 des_block akv_xtime; /* crypt time */
100 } akv_time_u;
101 u_long akv_int_u;
105 * des authentication verifier: client variety
107 * akv_timestamp is the current time.
108 * akv_winverf is the credential window + 1.
109 * Both are encrypted using the conversation key.
111 #ifndef akv_timestamp
112 #define akv_timestamp akv_time_u.akv_ctime
113 #define akv_xtimestamp akv_time_u.akv_xtime
114 #define akv_winverf akv_int_u
115 #endif
117 * des authentication verifier: server variety
119 * akv_timeverf is the client's timestamp + client's window
120 * akv_nickname is the server's nickname for the client.
121 * akv_timeverf is encrypted using the conversation key.
123 #ifndef akv_timeverf
124 #define akv_timeverf akv_time_u.akv_ctime
125 #define akv_xtimeverf akv_time_u.akv_xtime
126 #define akv_nickname akv_int_u
127 #endif
130 * Register the service name, instance and realm.
132 extern int authkerb_create(char *, char *, char *, u_int,
133 struct netbuf *, int *, dev_t, int, AUTH **);
134 extern bool_t xdr_authkerb_cred(XDR *, struct authkerb_cred *);
135 extern bool_t xdr_authkerb_verf(XDR *, struct authkerb_verf *);
136 extern int svc_kerb_reg(SVCXPRT *, char *, char *, char *);
137 extern enum auth_stat _svcauth_kerb(struct svc_req *, struct rpc_msg *);
139 #endif /* KERBEROS */
140 #endif /* !_RPC_AUTH_KERB_H */