1 |
207 |
jeremybenn |
/* $FreeBSD: src/include/rpc/auth_kerb.h,v 1.1 2001/03/19 12:49:46 alfred Exp $ */
|
2 |
|
|
/*
|
3 |
|
|
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
4 |
|
|
* unrestricted use provided that this legend is included on all tape
|
5 |
|
|
* media and as a part of the software program in whole or part. Users
|
6 |
|
|
* may copy or modify Sun RPC without charge, but are not authorized
|
7 |
|
|
* to license or distribute it to anyone else except as part of a product or
|
8 |
|
|
* program developed by the user.
|
9 |
|
|
*
|
10 |
|
|
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
|
11 |
|
|
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
|
12 |
|
|
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
|
13 |
|
|
*
|
14 |
|
|
* Sun RPC is provided with no support and without any obligation on the
|
15 |
|
|
* part of Sun Microsystems, Inc. to assist in its use, correction,
|
16 |
|
|
* modification or enhancement.
|
17 |
|
|
*
|
18 |
|
|
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
|
19 |
|
|
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
|
20 |
|
|
* OR ANY PART THEREOF.
|
21 |
|
|
*
|
22 |
|
|
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
|
23 |
|
|
* or profits or other special, indirect and consequential damages, even if
|
24 |
|
|
* Sun has been advised of the possibility of such damages.
|
25 |
|
|
*
|
26 |
|
|
* Sun Microsystems, Inc.
|
27 |
|
|
* 2550 Garcia Avenue
|
28 |
|
|
* Mountain View, California 94043
|
29 |
|
|
*/
|
30 |
|
|
/*
|
31 |
|
|
* auth_kerb.h, Protocol for Kerberos style authentication for RPC
|
32 |
|
|
*
|
33 |
|
|
* Copyright (C) 1986, Sun Microsystems, Inc.
|
34 |
|
|
*/
|
35 |
|
|
|
36 |
|
|
#ifndef _RPC_AUTH_KERB_H
|
37 |
|
|
#define _RPC_AUTH_KERB_H
|
38 |
|
|
|
39 |
|
|
#ifdef KERBEROS
|
40 |
|
|
|
41 |
|
|
#pragma ident "@(#)auth_kerb.h 1.10 94/04/25 SMI"
|
42 |
|
|
|
43 |
|
|
#include <kerberos/krb.h>
|
44 |
|
|
#include <sys/socket.h>
|
45 |
|
|
#include <sys/t_kuser.h>
|
46 |
|
|
#include <netinet/in.h>
|
47 |
|
|
#include <rpc/svc.h>
|
48 |
|
|
|
49 |
|
|
/*
|
50 |
|
|
* There are two kinds of "names": fullnames and nicknames
|
51 |
|
|
*/
|
52 |
|
|
enum authkerb_namekind {
|
53 |
|
|
AKN_FULLNAME,
|
54 |
|
|
AKN_NICKNAME
|
55 |
|
|
};
|
56 |
|
|
/*
|
57 |
|
|
* A fullname contains the ticket and the window
|
58 |
|
|
*/
|
59 |
|
|
struct authkerb_fullname {
|
60 |
|
|
KTEXT_ST ticket;
|
61 |
|
|
u_long window; /* associated window */
|
62 |
|
|
};
|
63 |
|
|
|
64 |
|
|
/*
|
65 |
|
|
* cooked credential stored in rq_clntcred
|
66 |
|
|
*/
|
67 |
|
|
struct authkerb_clnt_cred {
|
68 |
|
|
/* start of AUTH_DAT */
|
69 |
|
|
unsigned char k_flags; /* Flags from ticket */
|
70 |
|
|
char pname[ANAME_SZ]; /* Principal's name */
|
71 |
|
|
char pinst[INST_SZ]; /* His Instance */
|
72 |
|
|
char prealm[REALM_SZ]; /* His Realm */
|
73 |
|
|
unsigned long checksum; /* Data checksum (opt) */
|
74 |
|
|
C_Block session; /* Session Key */
|
75 |
|
|
int life; /* Life of ticket */
|
76 |
|
|
unsigned long time_sec; /* Time ticket issued */
|
77 |
|
|
unsigned long address; /* Address in ticket */
|
78 |
|
|
/* KTEXT_ST reply; Auth reply (opt) */
|
79 |
|
|
/* end of AUTH_DAT */
|
80 |
|
|
unsigned long expiry; /* time the ticket is expiring */
|
81 |
|
|
u_long nickname; /* Nickname into cache */
|
82 |
|
|
u_long window; /* associated window */
|
83 |
|
|
};
|
84 |
|
|
|
85 |
|
|
typedef struct authkerb_clnt_cred authkerb_clnt_cred;
|
86 |
|
|
|
87 |
|
|
/*
|
88 |
|
|
* A credential
|
89 |
|
|
*/
|
90 |
|
|
struct authkerb_cred {
|
91 |
|
|
enum authkerb_namekind akc_namekind;
|
92 |
|
|
struct authkerb_fullname akc_fullname;
|
93 |
|
|
u_long akc_nickname;
|
94 |
|
|
};
|
95 |
|
|
|
96 |
|
|
/*
|
97 |
|
|
* A kerb authentication verifier
|
98 |
|
|
*/
|
99 |
|
|
struct authkerb_verf {
|
100 |
|
|
union {
|
101 |
|
|
struct timeval akv_ctime; /* clear time */
|
102 |
|
|
des_block akv_xtime; /* crypt time */
|
103 |
|
|
} akv_time_u;
|
104 |
|
|
u_long akv_int_u;
|
105 |
|
|
};
|
106 |
|
|
|
107 |
|
|
/*
|
108 |
|
|
* des authentication verifier: client variety
|
109 |
|
|
*
|
110 |
|
|
* akv_timestamp is the current time.
|
111 |
|
|
* akv_winverf is the credential window + 1.
|
112 |
|
|
* Both are encrypted using the conversation key.
|
113 |
|
|
*/
|
114 |
|
|
#ifndef akv_timestamp
|
115 |
|
|
#define akv_timestamp akv_time_u.akv_ctime
|
116 |
|
|
#define akv_xtimestamp akv_time_u.akv_xtime
|
117 |
|
|
#define akv_winverf akv_int_u
|
118 |
|
|
#endif
|
119 |
|
|
/*
|
120 |
|
|
* des authentication verifier: server variety
|
121 |
|
|
*
|
122 |
|
|
* akv_timeverf is the client's timestamp + client's window
|
123 |
|
|
* akv_nickname is the server's nickname for the client.
|
124 |
|
|
* akv_timeverf is encrypted using the conversation key.
|
125 |
|
|
*/
|
126 |
|
|
#ifndef akv_timeverf
|
127 |
|
|
#define akv_timeverf akv_time_u.akv_ctime
|
128 |
|
|
#define akv_xtimeverf akv_time_u.akv_xtime
|
129 |
|
|
#define akv_nickname akv_int_u
|
130 |
|
|
#endif
|
131 |
|
|
|
132 |
|
|
/*
|
133 |
|
|
* Register the service name, instance and realm.
|
134 |
|
|
*/
|
135 |
|
|
extern int authkerb_create(char *, char *, char *, u_int,
|
136 |
|
|
struct netbuf *, int *, dev_t, int, AUTH **);
|
137 |
|
|
extern bool_t xdr_authkerb_cred(XDR *, struct authkerb_cred *);
|
138 |
|
|
extern bool_t xdr_authkerb_verf(XDR *, struct authkerb_verf *);
|
139 |
|
|
extern int svc_kerb_reg(SVCXPRT *, char *, char *, char *);
|
140 |
|
|
extern enum auth_stat _svcauth_kerb(struct svc_req *, struct rpc_msg *);
|
141 |
|
|
|
142 |
|
|
#endif KERBEROS
|
143 |
|
|
#endif /* !_RPC_AUTH_KERB_H */
|