3 * SPDX-License-Identifier: BSD-3-Clause
5 * Copyright (c) 2009, Sun Microsystems, Inc.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
10 * - Redistributions of source code must retain the above copyright notice,
11 * this list of conditions and the following disclaimer.
12 * - Redistributions in binary form must reproduce the above copyright notice,
13 * this list of conditions and the following disclaimer in the documentation
14 * and/or other materials provided with the distribution.
15 * - Neither the name of Sun Microsystems, Inc. nor the names of its
16 * contributors may be used to endorse or promote products derived
17 * from this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
32 * auth_kerb.h, Protocol for Kerberos style authentication for RPC
34 * Copyright (C) 1986, Sun Microsystems, Inc.
37 #ifndef _RPC_AUTH_KERB_H
38 #define _RPC_AUTH_KERB_H
42 #include <kerberos/krb.h>
43 #include <sys/socket.h>
44 #include <sys/t_kuser.h>
45 #include <netinet/in.h>
49 * There are two kinds of "names": fullnames and nicknames
51 enum authkerb_namekind {
56 * A fullname contains the ticket and the window
58 struct authkerb_fullname {
60 u_long window; /* associated window */
64 * cooked credential stored in rq_clntcred
66 struct authkerb_clnt_cred {
67 /* start of AUTH_DAT */
68 unsigned char k_flags; /* Flags from ticket */
69 char pname[ANAME_SZ]; /* Principal's name */
70 char pinst[INST_SZ]; /* His Instance */
71 char prealm[REALM_SZ]; /* His Realm */
72 unsigned long checksum; /* Data checksum (opt) */
73 C_Block session; /* Session Key */
74 int life; /* Life of ticket */
75 unsigned long time_sec; /* Time ticket issued */
76 unsigned long address; /* Address in ticket */
77 /* KTEXT_ST reply; Auth reply (opt) */
79 unsigned long expiry; /* time the ticket is expiring */
80 u_long nickname; /* Nickname into cache */
81 u_long window; /* associated window */
84 typedef struct authkerb_clnt_cred authkerb_clnt_cred;
89 struct authkerb_cred {
90 enum authkerb_namekind akc_namekind;
91 struct authkerb_fullname akc_fullname;
96 * A kerb authentication verifier
98 struct authkerb_verf {
100 struct timeval akv_ctime; /* clear time */
101 des_block akv_xtime; /* crypt time */
107 * des authentication verifier: client variety
109 * akv_timestamp is the current time.
110 * akv_winverf is the credential window + 1.
111 * Both are encrypted using the conversation key.
113 #ifndef akv_timestamp
114 #define akv_timestamp akv_time_u.akv_ctime
115 #define akv_xtimestamp akv_time_u.akv_xtime
116 #define akv_winverf akv_int_u
119 * des authentication verifier: server variety
121 * akv_timeverf is the client's timestamp + client's window
122 * akv_nickname is the server's nickname for the client.
123 * akv_timeverf is encrypted using the conversation key.
126 #define akv_timeverf akv_time_u.akv_ctime
127 #define akv_xtimeverf akv_time_u.akv_xtime
128 #define akv_nickname akv_int_u
132 * Register the service name, instance and realm.
134 extern int authkerb_create(char *, char *, char *, u_int,
135 struct netbuf *, int *, dev_t, int, AUTH **);
136 extern bool_t xdr_authkerb_cred(XDR *, struct authkerb_cred *);
137 extern bool_t xdr_authkerb_verf(XDR *, struct authkerb_verf *);
138 extern int svc_kerb_reg(SVCXPRT *, char *, char *, char *);
139 extern enum auth_stat _svcauth_kerb(struct svc_req *, struct rpc_msg *);
141 #endif /* KERBEROS */
142 #endif /* !_RPC_AUTH_KERB_H */