xref: /titanic_50/usr/src/cmd/idmap/idmapd/idmap_config.h (revision 3fbbb872ea33adea240e8fd8c692f6d3131cc69b)
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 2007 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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #include "idmap.h"
32 #include "addisc.h"
33 #include <libscf.h>
34 #include <synch.h>
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 #define	MAX_POLICY_SIZE 1023
41 
42 /* SMF and auto-discovery context handles */
43 typedef struct idmap_cfg_handles {
44 	pthread_mutex_t		mutex;
45 	scf_handle_t		*main;
46 	scf_instance_t		*instance;
47 	scf_service_t		*service;
48 	scf_propertygroup_t	*config_pg;
49 	scf_propertygroup_t	*general_pg;
50 	ad_disc_t		ad_ctx;
51 } idmap_cfg_handles_t;
52 
53 /*
54  * This structure stores AD and AD-related configuration
55  */
56 typedef struct idmap_pg_config {
57 	uint64_t	list_size_limit;
58 	/*
59 	 * The idmap_cfg_update_thread() uses the ad_disc_t context in
60 	 * the idmap_cfg_handles_t (see above) to track which values
61 	 * came from SMF and which values didn't.  This works for all
62 	 * items that are discoverable, but default_domain (the domain
63 	 * that we qualify unqualified names passed to idmap show) is
64 	 * not discoverable independently of domain_name.  So we need to
65 	 * track its procedence separately.  The dflt_dom_set_in_smf
66 	 * field does just that.
67 	 */
68 	bool_t		dflt_dom_set_in_smf;
69 	char		*default_domain;	/* default domain name */
70 	char		*domain_name;		/* AD domain name */
71 	char		*machine_sid;		/* machine sid */
72 	ad_disc_ds_t	*domain_controller;	/* domain controller hosts */
73 	char		*forest_name;		/* forest name */
74 	char		*site_name;		/* site name */
75 	ad_disc_ds_t	*global_catalog;	/* global catalog hosts */
76 	/*
77 	 * Following properties are associated with directory-based
78 	 * name-mappings.
79 	 */
80 	char		*ad_unixuser_attr;
81 	char		*ad_unixgroup_attr;
82 	char		*nldap_winname_attr;
83 	bool_t		ds_name_mapping_enabled;
84 } idmap_pg_config_t;
85 
86 typedef struct idmap_cfg {
87 	idmap_pg_config_t	pgcfg;	    /* live AD/ID mapping config */
88 	idmap_cfg_handles_t	handles;
89 } idmap_cfg_t;
90 
91 
92 extern void 		idmap_cfg_unload(idmap_pg_config_t *);
93 extern int		idmap_cfg_load(idmap_cfg_handles_t *,
94 					idmap_pg_config_t *, int);
95 extern idmap_cfg_t	*idmap_cfg_init(void);
96 extern int		idmap_cfg_fini(idmap_cfg_t *);
97 extern int		idmap_cfg_start_updates(idmap_cfg_t *);
98 
99 #ifdef __cplusplus
100 }
101 #endif
102 
103 #endif /* _IDMAP_CONFIG_H */
104