xref: /illumos-gate/usr/src/cmd/krb5/krb5kdc/extern.h (revision 1a2d662a91cee3bf82f41cd47c7ae6f3825d9db2)
1 /*
2  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 #ifndef	__KRB5_KDC_EXTERN__
7 #define	__KRB5_KDC_EXTERN__
8 
9 #include <netinet/in.h>
10 
11 #ifdef	__cplusplus
12 extern "C" {
13 #endif
14 
15 /*
16  * Copyright 1990,2001 by the Massachusetts Institute of Technology.
17  *
18  * Export of this software from the United States of America may
19  *   require a specific license from the United States Government.
20  *   It is the responsibility of any person or organization contemplating
21  *   export to obtain such a license before exporting.
22  *
23  * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
24  * distribute this software and its documentation for any purpose and
25  * without fee is hereby granted, provided that the above copyright
26  * notice appear in all copies and that both that copyright notice and
27  * this permission notice appear in supporting documentation, and that
28  * the name of M.I.T. not be used in advertising or publicity pertaining
29  * to distribution of the software without specific, written prior
30  * permission.  Furthermore if you modify this software you must label
31  * your software as modified software and not distribute it in such a
32  * fashion that it might be confused with the original M.I.T. software.
33  * M.I.T. makes no representations about the suitability of
34  * this software for any purpose.  It is provided "as is" without express
35  * or implied warranty.
36  *
37  *
38  * <<< Description >>>
39  */
40 
41 typedef struct __kdc_realm_data {
42     /*
43      * General Kerberos per-realm data.
44      */
45     char *		realm_name;	/* Realm name			    */
46 /* XXX the real context should go away once the db_context is done.
47  * The db_context is then associated with the realm keytab using
48  * krb5_ktkdb_resolv(). There should be nothing in the context which
49  * cannot span multiple realms -- proven */
50     krb5_context	realm_context;	/* Context to be used for realm	    */
51     krb5_keytab		realm_keytab; 	/* keytab to be used for this realm */
52     char *		realm_profile;	/* Profile file for this realm	    */
53     /*
54      * Database per-realm data.
55      */
56     char *		realm_dbname;	/* Database name for realm	    */
57     char *		realm_stash;	/* Stash file name for realm	    */
58     char *		realm_mpname;	/* Master principal name for realm  */
59     krb5_principal	realm_mprinc;	/* Master principal for realm	    */
60     krb5_keyblock	realm_mkey;	/* Master key for this realm	    */
61     /*
62      * TGS per-realm data.
63      */
64     krb5_principal	realm_tgsprinc;	/* TGS principal for this realm	    */
65     /*
66      * Other per-realm data.
67      */
68     char		*realm_ports;	/* Per-realm KDC UDP port */
69     char		*realm_tcp_ports; /* Per-realm KDC TCP port */
70     /*
71      * Per-realm parameters.
72      */
73     krb5_deltat		realm_maxlife;	/* Maximum ticket life for realm    */
74     krb5_deltat		realm_maxrlife;	/* Maximum renewable life for realm */
75     krb5_boolean	realm_reject_bad_transit; /* Accept unverifiable transited_realm ? */
76 } kdc_realm_t;
77 
78 extern kdc_realm_t	**kdc_realmlist;
79 extern int		kdc_numrealms;
80 extern kdc_realm_t	*kdc_active_realm;
81 
82 kdc_realm_t *find_realm_data (char *, krb5_ui_4);
83 
84 /*
85  * Replace previously used global variables with the active (e.g. request's)
86  * realm data.  This allows us to support multiple realms with minimal logic
87  * changes.
88  */
89 #define	kdc_context			kdc_active_realm->realm_context
90 #define	max_life_for_realm		kdc_active_realm->realm_maxlife
91 #define	max_renewable_life_for_realm	kdc_active_realm->realm_maxrlife
92 #define	master_keyblock			kdc_active_realm->realm_mkey
93 #define	master_princ			kdc_active_realm->realm_mprinc
94 #define	tgs_server_struct		*(kdc_active_realm->realm_tgsprinc)
95 #define	tgs_server			kdc_active_realm->realm_tgsprinc
96 #define	dbm_db_name			kdc_active_realm->realm_dbname
97 #define	primary_port			kdc_active_realm->realm_pport
98 #define reject_bad_transit		kdc_active_realm->realm_reject_bad_transit
99 
100 /* various externs for KDC */
101 extern krb5_data 	empty_string;	/* an empty string */
102 extern krb5_timestamp 	kdc_infinity;	/* greater than all other timestamps */
103 extern krb5_rcache	kdc_rcache;	/* replay cache */
104 extern krb5_keyblock	psr_key;	/* key for predicted sam response */
105 
106 extern volatile int signal_requests_exit;
107 extern volatile int signal_requests_hup;
108 
109 /* libbsm */
110 extern void audit_krb5kdc_as_req(struct in_addr *, in_port_t, in_port_t,
111 				char *, char *, int);
112 extern void audit_krb5kdc_tgs_req(struct in_addr *, in_port_t, in_port_t,
113 				char *, char *, int);
114 extern void audit_krb5kdc_tgs_req_2ndtktmm(struct in_addr *, in_port_t,
115 					in_port_t, char *, char *);
116 extern void audit_krb5kdc_tgs_req_alt_tgt(struct in_addr *, in_port_t,
117 					in_port_t, char *, char *, int);
118 
119 #ifdef	__cplusplus
120 }
121 #endif
122 
123 #endif /* !__KRB5_KDC_EXTERN__ */
124