xref: /titanic_44/usr/src/cmd/idmap/idmapd/idmap_config.h (revision 5819f75e225cf93d9c11f52e04ee71c2dcd0eca9)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _IDMAP_CONFIG_H
27 #define	_IDMAP_CONFIG_H
28 
29 
30 #include "idmap.h"
31 #include "addisc.h"
32 #include <libscf.h>
33 #include <synch.h>
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 #define	MAX_POLICY_SIZE 1023
40 
41 #define	DIRECTORY_MAPPING_NONE	0
42 #define	DIRECTORY_MAPPING_NAME	1
43 #define	DIRECTORY_MAPPING_IDMU	2
44 
45 struct enum_lookup_map {
46 	int value;
47 	char *string;
48 };
49 
50 extern struct enum_lookup_map directory_mapping_map[];
51 extern const char *enum_lookup(int value, struct enum_lookup_map *map);
52 
53 /* SMF and auto-discovery context handles */
54 typedef struct idmap_cfg_handles {
55 	pthread_mutex_t		mutex;
56 	scf_handle_t		*main;
57 	scf_instance_t		*instance;
58 	scf_service_t		*service;
59 	scf_propertygroup_t	*config_pg;
60 	scf_propertygroup_t	*general_pg;
61 	ad_disc_t		ad_ctx;
62 } idmap_cfg_handles_t;
63 
64 /*
65  * This structure stores AD and AD-related configuration
66  */
67 typedef struct idmap_trustedforest {
68 	char		*forest_name;
69 	idmap_ad_disc_ds_t
70 			*global_catalog;	/* global catalog hosts */
71 	ad_disc_domainsinforest_t
72 			*domains_in_forest;
73 } idmap_trustedforest_t;
74 
75 
76 typedef struct idmap_pg_config {
77 	uint64_t	list_size_limit;
78 	char		*machine_sid;		/* machine sid */
79 	char		*default_domain;	/* default domain name */
80 	char		*domain_name;		/* AD domain name */
81 	boolean_t		domain_name_auto_disc;
82 	idmap_ad_disc_ds_t
83 			*domain_controller;	/* domain controller hosts */
84 	boolean_t	domain_controller_auto_disc;
85 	char		*forest_name;		/* forest name */
86 	boolean_t	forest_name_auto_disc;
87 	char		*site_name;		/* site name */
88 	boolean_t	site_name_auto_disc;
89 	idmap_ad_disc_ds_t
90 			*global_catalog;	/* global catalog hosts */
91 	boolean_t	global_catalog_auto_disc;
92 	ad_disc_domainsinforest_t
93 			*domains_in_forest;
94 	ad_disc_trusteddomains_t
95 			*trusted_domains;	/* Trusted Domains */
96 	int		num_trusted_forests;
97 	idmap_trustedforest_t
98 			*trusted_forests;	/* Array of trusted forests */
99 
100 	/*
101 	 * Following properties are associated with directory-based
102 	 * name-mappings.
103 	 */
104 	char		*ad_unixuser_attr;
105 	char		*ad_unixgroup_attr;
106 	char		*nldap_winname_attr;
107 	int		directory_based_mapping;	/* enum */
108 	boolean_t	eph_map_unres_sids;
109 } idmap_pg_config_t;
110 
111 typedef struct idmap_cfg {
112 	idmap_pg_config_t	pgcfg;	    /* live AD/ID mapping config */
113 	idmap_cfg_handles_t	handles;
114 	int			initialized;
115 } idmap_cfg_t;
116 
117 
118 extern void 		idmap_cfg_unload(idmap_pg_config_t *);
119 extern int		idmap_cfg_load(idmap_cfg_t *, int);
120 extern idmap_cfg_t	*idmap_cfg_init(void);
121 extern int		idmap_cfg_fini(idmap_cfg_t *);
122 extern int		idmap_cfg_upgrade(idmap_cfg_t *);
123 extern int		idmap_cfg_start_updates(void);
124 extern void		idmap_cfg_poke_updates(void);
125 extern void		idmap_cfg_hup_handler(int);
126 
127 #define	CFG_DISCOVER		0x1
128 #define	CFG_LOG			0x2
129 
130 #ifdef __cplusplus
131 }
132 #endif
133 
134 #endif /* _IDMAP_CONFIG_H */
135