xref: /minix3/crypto/external/bsd/heimdal/dist/lib/kafs/kafs_locl.h (revision ebfedea0ce5bbe81e252ddf32d732e40fb633fae)
1*ebfedea0SLionel Sambuc /*	$NetBSD: kafs_locl.h,v 1.1.1.2 2011/04/14 14:09:18 elric Exp $	*/
2*ebfedea0SLionel Sambuc 
3*ebfedea0SLionel Sambuc /*
4*ebfedea0SLionel Sambuc  * Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska Högskolan
5*ebfedea0SLionel Sambuc  * (Royal Institute of Technology, Stockholm, Sweden).
6*ebfedea0SLionel Sambuc  * All rights reserved.
7*ebfedea0SLionel Sambuc  *
8*ebfedea0SLionel Sambuc  * Redistribution and use in source and binary forms, with or without
9*ebfedea0SLionel Sambuc  * modification, are permitted provided that the following conditions
10*ebfedea0SLionel Sambuc  * are met:
11*ebfedea0SLionel Sambuc  *
12*ebfedea0SLionel Sambuc  * 1. Redistributions of source code must retain the above copyright
13*ebfedea0SLionel Sambuc  *    notice, this list of conditions and the following disclaimer.
14*ebfedea0SLionel Sambuc  *
15*ebfedea0SLionel Sambuc  * 2. Redistributions in binary form must reproduce the above copyright
16*ebfedea0SLionel Sambuc  *    notice, this list of conditions and the following disclaimer in the
17*ebfedea0SLionel Sambuc  *    documentation and/or other materials provided with the distribution.
18*ebfedea0SLionel Sambuc  *
19*ebfedea0SLionel Sambuc  * 3. Neither the name of the Institute nor the names of its contributors
20*ebfedea0SLionel Sambuc  *    may be used to endorse or promote products derived from this software
21*ebfedea0SLionel Sambuc  *    without specific prior written permission.
22*ebfedea0SLionel Sambuc  *
23*ebfedea0SLionel Sambuc  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
24*ebfedea0SLionel Sambuc  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25*ebfedea0SLionel Sambuc  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26*ebfedea0SLionel Sambuc  * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
27*ebfedea0SLionel Sambuc  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28*ebfedea0SLionel Sambuc  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29*ebfedea0SLionel Sambuc  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30*ebfedea0SLionel Sambuc  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31*ebfedea0SLionel Sambuc  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32*ebfedea0SLionel Sambuc  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33*ebfedea0SLionel Sambuc  * SUCH DAMAGE.
34*ebfedea0SLionel Sambuc  */
35*ebfedea0SLionel Sambuc 
36*ebfedea0SLionel Sambuc /* Id */
37*ebfedea0SLionel Sambuc 
38*ebfedea0SLionel Sambuc #ifndef __KAFS_LOCL_H__
39*ebfedea0SLionel Sambuc #define __KAFS_LOCL_H__
40*ebfedea0SLionel Sambuc 
41*ebfedea0SLionel Sambuc #ifdef HAVE_CONFIG_H
42*ebfedea0SLionel Sambuc #include <config.h>
43*ebfedea0SLionel Sambuc #endif
44*ebfedea0SLionel Sambuc 
45*ebfedea0SLionel Sambuc #include <stdio.h>
46*ebfedea0SLionel Sambuc #include <stdlib.h>
47*ebfedea0SLionel Sambuc #include <string.h>
48*ebfedea0SLionel Sambuc #include <signal.h>
49*ebfedea0SLionel Sambuc #include <setjmp.h>
50*ebfedea0SLionel Sambuc #include <errno.h>
51*ebfedea0SLionel Sambuc 
52*ebfedea0SLionel Sambuc #ifdef HAVE_SYS_TYPES_H
53*ebfedea0SLionel Sambuc #include <sys/types.h>
54*ebfedea0SLionel Sambuc #endif
55*ebfedea0SLionel Sambuc #ifdef HAVE_UNISTD_H
56*ebfedea0SLionel Sambuc #include <unistd.h>
57*ebfedea0SLionel Sambuc #endif
58*ebfedea0SLionel Sambuc #if defined(HAVE_SYS_IOCTL_H) && SunOS != 40
59*ebfedea0SLionel Sambuc #include <sys/ioctl.h>
60*ebfedea0SLionel Sambuc #endif
61*ebfedea0SLionel Sambuc #ifdef HAVE_SYS_FILIO_H
62*ebfedea0SLionel Sambuc #include <sys/filio.h>
63*ebfedea0SLionel Sambuc #endif
64*ebfedea0SLionel Sambuc #ifdef HAVE_SYS_SYSCTL_H
65*ebfedea0SLionel Sambuc #include <sys/sysctl.h>
66*ebfedea0SLionel Sambuc #endif
67*ebfedea0SLionel Sambuc 
68*ebfedea0SLionel Sambuc #ifdef HAVE_SYS_SYSCALL_H
69*ebfedea0SLionel Sambuc #include <sys/syscall.h>
70*ebfedea0SLionel Sambuc #endif
71*ebfedea0SLionel Sambuc #ifdef HAVE_SYS_SOCKET_H
72*ebfedea0SLionel Sambuc #include <sys/socket.h>
73*ebfedea0SLionel Sambuc #endif
74*ebfedea0SLionel Sambuc #ifdef HAVE_NETINET_IN_H
75*ebfedea0SLionel Sambuc #include <netinet/in.h>
76*ebfedea0SLionel Sambuc #endif
77*ebfedea0SLionel Sambuc #ifdef HAVE_NETINET_IN6_H
78*ebfedea0SLionel Sambuc #include <netinet/in6.h>
79*ebfedea0SLionel Sambuc #endif
80*ebfedea0SLionel Sambuc #ifdef HAVE_NETINET6_IN6_H
81*ebfedea0SLionel Sambuc #include <netinet6/in6.h>
82*ebfedea0SLionel Sambuc #endif
83*ebfedea0SLionel Sambuc 
84*ebfedea0SLionel Sambuc #ifdef HAVE_NETDB_H
85*ebfedea0SLionel Sambuc #include <netdb.h>
86*ebfedea0SLionel Sambuc #endif
87*ebfedea0SLionel Sambuc 
88*ebfedea0SLionel Sambuc #ifdef HAVE_ARPA_NAMESER_H
89*ebfedea0SLionel Sambuc #include <arpa/nameser.h>
90*ebfedea0SLionel Sambuc #endif
91*ebfedea0SLionel Sambuc #ifdef HAVE_RESOLV_H
92*ebfedea0SLionel Sambuc #include <resolv.h>
93*ebfedea0SLionel Sambuc #endif
94*ebfedea0SLionel Sambuc #include <krb5/roken.h>
95*ebfedea0SLionel Sambuc 
96*ebfedea0SLionel Sambuc #ifdef KRB5
97*ebfedea0SLionel Sambuc #include <krb5/krb5.h>
98*ebfedea0SLionel Sambuc #endif
99*ebfedea0SLionel Sambuc #ifdef KRB5
100*ebfedea0SLionel Sambuc #include "crypto-headers.h"
101*ebfedea0SLionel Sambuc #include <krb5/krb5-v4compat.h>
102*ebfedea0SLionel Sambuc typedef struct credentials CREDENTIALS;
103*ebfedea0SLionel Sambuc #endif /* KRB5 */
104*ebfedea0SLionel Sambuc #include <krb5/kafs.h>
105*ebfedea0SLionel Sambuc 
106*ebfedea0SLionel Sambuc #include <krb5/resolve.h>
107*ebfedea0SLionel Sambuc 
108*ebfedea0SLionel Sambuc #include "afssysdefs.h"
109*ebfedea0SLionel Sambuc 
110*ebfedea0SLionel Sambuc struct kafs_data;
111*ebfedea0SLionel Sambuc struct kafs_token;
112*ebfedea0SLionel Sambuc typedef int (*afslog_uid_func_t)(struct kafs_data *,
113*ebfedea0SLionel Sambuc 				 const char *,
114*ebfedea0SLionel Sambuc 				 const char *,
115*ebfedea0SLionel Sambuc 				 uid_t,
116*ebfedea0SLionel Sambuc 				 const char *);
117*ebfedea0SLionel Sambuc 
118*ebfedea0SLionel Sambuc typedef int (*get_cred_func_t)(struct kafs_data*, const char*, const char*,
119*ebfedea0SLionel Sambuc 			       const char*, uid_t, struct kafs_token *);
120*ebfedea0SLionel Sambuc 
121*ebfedea0SLionel Sambuc typedef char* (*get_realm_func_t)(struct kafs_data*, const char*);
122*ebfedea0SLionel Sambuc 
123*ebfedea0SLionel Sambuc struct kafs_data {
124*ebfedea0SLionel Sambuc     const char *name;
125*ebfedea0SLionel Sambuc     afslog_uid_func_t afslog_uid;
126*ebfedea0SLionel Sambuc     get_cred_func_t get_cred;
127*ebfedea0SLionel Sambuc     get_realm_func_t get_realm;
128*ebfedea0SLionel Sambuc     const char *(*get_error)(struct kafs_data *, int);
129*ebfedea0SLionel Sambuc     void (*free_error)(struct kafs_data *, const char *);
130*ebfedea0SLionel Sambuc     void *data;
131*ebfedea0SLionel Sambuc };
132*ebfedea0SLionel Sambuc 
133*ebfedea0SLionel Sambuc struct kafs_token {
134*ebfedea0SLionel Sambuc     struct ClearToken ct;
135*ebfedea0SLionel Sambuc     void *ticket;
136*ebfedea0SLionel Sambuc     size_t ticket_len;
137*ebfedea0SLionel Sambuc };
138*ebfedea0SLionel Sambuc 
139*ebfedea0SLionel Sambuc void _kafs_foldup(char *, const char *);
140*ebfedea0SLionel Sambuc 
141*ebfedea0SLionel Sambuc int _kafs_afslog_all_local_cells(struct kafs_data*, uid_t, const char*);
142*ebfedea0SLionel Sambuc 
143*ebfedea0SLionel Sambuc int _kafs_get_cred(struct kafs_data*, const char*, const char*, const char *,
144*ebfedea0SLionel Sambuc 		   uid_t, struct kafs_token *);
145*ebfedea0SLionel Sambuc 
146*ebfedea0SLionel Sambuc int
147*ebfedea0SLionel Sambuc _kafs_realm_of_cell(struct kafs_data *, const char *, char **);
148*ebfedea0SLionel Sambuc 
149*ebfedea0SLionel Sambuc int
150*ebfedea0SLionel Sambuc _kafs_v4_to_kt(CREDENTIALS *, uid_t, struct kafs_token *);
151*ebfedea0SLionel Sambuc 
152*ebfedea0SLionel Sambuc void
153*ebfedea0SLionel Sambuc _kafs_fixup_viceid(struct ClearToken *, uid_t);
154*ebfedea0SLionel Sambuc 
155*ebfedea0SLionel Sambuc #ifdef _AIX
156*ebfedea0SLionel Sambuc int aix_pioctl(char*, int, struct ViceIoctl*, int);
157*ebfedea0SLionel Sambuc int aix_setpag(void);
158*ebfedea0SLionel Sambuc #endif
159*ebfedea0SLionel Sambuc 
160*ebfedea0SLionel Sambuc #endif /* __KAFS_LOCL_H__ */
161