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.
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.
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]
23 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
30 #include <sys/socket.h>
32 #include "libadutils.h"
40 * Maximum string SID size. 4 bytes for "S-1-", 15 for 2^48 (max authority),
41 * another '-', and ridcount (max 15) 10-digit RIDs plus '-' in between, plus
45 #define MAXDOMAINNAME 256
46 #define AD_DISC_MAXHOSTNAME 256
48 typedef struct ad_disc
*ad_disc_t
;
51 typedef struct ad_disc_domains_in_forest
{
52 char domain
[MAXDOMAINNAME
];
54 int trusted
; /* This is not used by auto */
55 /* discovery. It is provided so that */
56 /* domains in a forest can be marked */
58 } ad_disc_domainsinforest_t
;
61 typedef struct ad_disc_trusted_domains
{
62 char domain
[MAXDOMAINNAME
];
64 } ad_disc_trusteddomains_t
;
67 AD_DISC_PREFER_SITE
= 0, /* Prefer Site specific version */
68 AD_DISC_SITE_SPECIFIC
, /* Request Site specific version */
69 AD_DISC_GLOBAL
/* Request global version */
73 * First four members of this are like idmap_ad_disc_ds_t
74 * (for compatiblity) until that can be eliminated.
75 * See PROP_DOMAIN_CONTROLLER in idmapd/server.c
77 typedef struct ad_disc_ds
{
78 /* Keep these first four in sync with idmap_ad_disc_ds_t */
82 char host
[AD_DISC_MAXHOSTNAME
];
83 /* Members after this are private and free to change. */
84 char site
[AD_DISC_MAXHOSTNAME
];
85 struct sockaddr_storage addr
;
90 ad_disc_t
ad_disc_init(void);
92 void ad_disc_fini(ad_disc_t
);
95 * The following routines auto discover the specific item
98 ad_disc_get_DomainName(ad_disc_t ctx
, boolean_t
*auto_discovered
);
101 ad_disc_get_DomainGUID(ad_disc_t ctx
, boolean_t
*auto_discovered
);
104 ad_disc_get_DomainController(ad_disc_t ctx
,
105 enum ad_disc_req req
, boolean_t
*auto_discovered
);
108 ad_disc_get_PreferredDC(ad_disc_t ctx
, boolean_t
*auto_discovered
);
111 ad_disc_get_SiteName(ad_disc_t ctx
, boolean_t
*auto_discovered
);
114 ad_disc_get_ForestName(ad_disc_t ctx
, boolean_t
*auto_discovered
);
117 ad_disc_get_GlobalCatalog(ad_disc_t ctx
, enum ad_disc_req
,
118 boolean_t
*auto_discovered
);
120 ad_disc_trusteddomains_t
*
121 ad_disc_get_TrustedDomains(ad_disc_t ctx
, boolean_t
*auto_discovered
);
123 ad_disc_domainsinforest_t
*
124 ad_disc_get_DomainsInForest(ad_disc_t ctx
, boolean_t
*auto_discovered
);
128 * The following routines over ride auto discovery with the
132 ad_disc_set_DomainName(ad_disc_t ctx
, const char *domainName
);
135 ad_disc_set_DomainGUID(ad_disc_t ctx
, uchar_t
*u
);
138 ad_disc_set_DomainController(ad_disc_t ctx
,
139 const ad_disc_ds_t
*domainController
);
141 ad_disc_set_PreferredDC(ad_disc_t ctx
, const ad_disc_ds_t
*dc
);
144 ad_disc_set_SiteName(ad_disc_t ctx
, const char *siteName
);
147 ad_disc_set_ForestName(ad_disc_t ctx
, const char *forestName
);
150 ad_disc_set_GlobalCatalog(ad_disc_t ctx
,
151 const ad_disc_ds_t
*globalCatalog
);
154 * This function sets a FILE * on which this library will write
155 * progress information during DC Location.
158 ad_disc_set_StatusFP(ad_disc_t ctx
, struct __FILE_TAG
*);
161 ad_disc_getnameinfo(char *, int, struct sockaddr_storage
*);
164 * This routine forces all auto discovery item to be recomputed
167 void ad_disc_refresh(ad_disc_t
);
170 * This routine marks the end of a discovery cycle and sets
171 * the sanity limits on the time before the next cycle.
173 void ad_disc_done(ad_disc_t
);
175 /* This routine unsets all overridden values */
176 int ad_disc_unset(ad_disc_t ctx
);
178 /* This routine test for subnet changes */
179 boolean_t
ad_disc_SubnetChanged(ad_disc_t
);
181 /* This routine returns the Time To Live for auto discovered items */
182 int ad_disc_get_TTL(ad_disc_t
);
184 int ad_disc_compare_uuid(uuid_t
*u1
, uuid_t
*u2
);
186 int ad_disc_compare_ds(ad_disc_ds_t
*ds1
, ad_disc_ds_t
*ds2
);
188 int ad_disc_compare_trusteddomains(ad_disc_trusteddomains_t
*td1
,
189 ad_disc_trusteddomains_t
*td2
);
191 int ad_disc_compare_domainsinforest(ad_disc_domainsinforest_t
*td1
,
192 ad_disc_domainsinforest_t
*td2
);
198 #endif /* _ADINFO_H */