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 2008 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 idmap_ad_disc_ds_t *domain_controller; 73 /* domain controller hosts */ 74 char *forest_name; /* forest name */ 75 char *site_name; /* site name */ 76 idmap_ad_disc_ds_t *global_catalog; 77 /* global catalog hosts */ 78 /* 79 * Following properties are associated with directory-based 80 * name-mappings. 81 */ 82 char *ad_unixuser_attr; 83 char *ad_unixgroup_attr; 84 char *nldap_winname_attr; 85 bool_t ds_name_mapping_enabled; 86 bool_t eph_map_unres_sids; 87 } idmap_pg_config_t; 88 89 typedef struct idmap_cfg { 90 idmap_pg_config_t pgcfg; /* live AD/ID mapping config */ 91 idmap_cfg_handles_t handles; 92 int initialized; 93 } idmap_cfg_t; 94 95 96 extern void idmap_cfg_unload(idmap_pg_config_t *); 97 extern int idmap_cfg_load(idmap_cfg_t *, int); 98 extern idmap_cfg_t *idmap_cfg_init(void); 99 extern int idmap_cfg_fini(idmap_cfg_t *); 100 extern int idmap_cfg_start_updates(void); 101 extern void idmap_cfg_poke_updates(void); 102 extern void idmap_cfg_hup_handler(int); 103 104 #define CFG_DISCOVER 0x1 105 #define CFG_LOG 0x2 106 107 #ifdef __cplusplus 108 } 109 #endif 110 111 #endif /* _IDMAP_CONFIG_H */ 112