idmap_config.h revision e3c2d6aa3bc760b22fad3c83f876553f0d2c5b66
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw/*
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw * CDDL HEADER START
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw *
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw * The contents of this file are subject to the terms of the
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw * Common Development and Distribution License (the "License").
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw * You may not use this file except in compliance with the License.
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw *
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw * or http://www.opensolaris.org/os/licensing.
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw * See the License for the specific language governing permissions
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw * and limitations under the License.
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw *
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw * When distributing Covered Code, include this CDDL HEADER in each
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw * If applicable, add the following below this CDDL HEADER, with the
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw * fields enclosed by brackets "[]" replaced with your own identifying
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw * information: Portions Copyright [yyyy] [name of copyright owner]
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw *
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw * CDDL HEADER END
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw */
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw/*
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw * Use is subject to license terms.
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw */
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw#ifndef _IDMAP_CONFIG_H
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw#define _IDMAP_CONFIG_H
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw#pragma ident "%Z%%M% %I% %E% SMI"
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw#include "idmap.h"
c8e261054d98729a8718903716b9b8a512d8b693jp#include "addisc.h"
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw#include <libscf.h>
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw#include <synch.h>
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw#ifdef __cplusplus
c5c4113dfcabb1eed3d4bdf7609de5170027a794nwextern "C" {
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw#endif
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw#define MAX_POLICY_SIZE 1023
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw
c8e261054d98729a8718903716b9b8a512d8b693jp/* SMF and auto-discovery context handles */
c8e261054d98729a8718903716b9b8a512d8b693jptypedef struct idmap_cfg_handles {
c8e261054d98729a8718903716b9b8a512d8b693jp pthread_mutex_t mutex;
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw scf_handle_t *main;
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw scf_instance_t *instance;
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw scf_service_t *service;
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw scf_propertygroup_t *config_pg;
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw scf_propertygroup_t *general_pg;
c8e261054d98729a8718903716b9b8a512d8b693jp ad_disc_t ad_ctx;
c8e261054d98729a8718903716b9b8a512d8b693jp} idmap_cfg_handles_t;
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw
c8e261054d98729a8718903716b9b8a512d8b693jp/*
c8e261054d98729a8718903716b9b8a512d8b693jp * This structure stores AD and AD-related configuration
c8e261054d98729a8718903716b9b8a512d8b693jp */
c5c4113dfcabb1eed3d4bdf7609de5170027a794nwtypedef struct idmap_pg_config {
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw uint64_t list_size_limit;
c8e261054d98729a8718903716b9b8a512d8b693jp /*
c8e261054d98729a8718903716b9b8a512d8b693jp * The idmap_cfg_update_thread() uses the ad_disc_t context in
c8e261054d98729a8718903716b9b8a512d8b693jp * the idmap_cfg_handles_t (see above) to track which values
c8e261054d98729a8718903716b9b8a512d8b693jp * came from SMF and which values didn't. This works for all
c8e261054d98729a8718903716b9b8a512d8b693jp * items that are discoverable, but default_domain (the domain
c8e261054d98729a8718903716b9b8a512d8b693jp * that we qualify unqualified names passed to idmap show) is
c8e261054d98729a8718903716b9b8a512d8b693jp * not discoverable independently of domain_name. So we need to
c8e261054d98729a8718903716b9b8a512d8b693jp * track its procedence separately. The dflt_dom_set_in_smf
c8e261054d98729a8718903716b9b8a512d8b693jp * field does just that.
c8e261054d98729a8718903716b9b8a512d8b693jp */
c8e261054d98729a8718903716b9b8a512d8b693jp bool_t dflt_dom_set_in_smf;
c8e261054d98729a8718903716b9b8a512d8b693jp char *default_domain; /* default domain name */
c8e261054d98729a8718903716b9b8a512d8b693jp char *domain_name; /* AD domain name */
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw char *machine_sid; /* machine sid */
c8e261054d98729a8718903716b9b8a512d8b693jp ad_disc_ds_t *domain_controller; /* domain controller hosts */
c8e261054d98729a8718903716b9b8a512d8b693jp char *forest_name; /* forest name */
c8e261054d98729a8718903716b9b8a512d8b693jp char *site_name; /* site name */
c8e261054d98729a8718903716b9b8a512d8b693jp ad_disc_ds_t *global_catalog; /* global catalog hosts */
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw} idmap_pg_config_t;
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw
c5c4113dfcabb1eed3d4bdf7609de5170027a794nwtypedef struct idmap_cfg {
c8e261054d98729a8718903716b9b8a512d8b693jp idmap_pg_config_t pgcfg; /* live AD/ID mapping config */
c8e261054d98729a8718903716b9b8a512d8b693jp idmap_cfg_handles_t handles;
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw} idmap_cfg_t;
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw
c8e261054d98729a8718903716b9b8a512d8b693jp
c8e261054d98729a8718903716b9b8a512d8b693jpextern void idmap_cfg_unload(idmap_pg_config_t *);
c8e261054d98729a8718903716b9b8a512d8b693jpextern int idmap_cfg_load(idmap_cfg_handles_t *,
e3c2d6aa3bc760b22fad3c83f876553f0d2c5b66nw idmap_pg_config_t *, int);
c8e261054d98729a8718903716b9b8a512d8b693jpextern idmap_cfg_t *idmap_cfg_init(void);
c5c4113dfcabb1eed3d4bdf7609de5170027a794nwextern int idmap_cfg_fini(idmap_cfg_t *);
c8e261054d98729a8718903716b9b8a512d8b693jpextern int idmap_cfg_start_updates(idmap_cfg_t *);
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw#ifdef __cplusplus
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw}
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw#endif
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw#endif /* _IDMAP_CONFIG_H */