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 /* 23 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. 24 */ 25 26 #ifndef _ADINFO_H 27 #define _ADINFO_H 28 29 #include <rpcsvc/idmap_prot.h> 30 #include "libadutils.h" 31 32 33 #ifdef __cplusplus 34 extern "C" { 35 #endif 36 37 /* 38 * Maximum string SID size. 4 bytes for "S-1-", 15 for 2^48 (max authority), 39 * another '-', and ridcount (max 15) 10-digit RIDs plus '-' in between, plus 40 * a null. 41 */ 42 #define MAXSTRSID 185 43 #define MAXDOMAINNAME 256 44 45 typedef struct ad_disc *ad_disc_t; 46 47 48 typedef struct ad_disc_domains_in_forest { 49 char domain[MAXDOMAINNAME]; 50 char sid[MAXSTRSID]; 51 int trusted; /* This is not used by auto */ 52 /* discovery. It is provided so that */ 53 /* domains in a forest can be marked */ 54 /* as trusted. */ 55 } ad_disc_domainsinforest_t; 56 57 58 typedef struct ad_disc_trusted_domains { 59 char domain[MAXDOMAINNAME]; 60 int direction; 61 } ad_disc_trusteddomains_t; 62 63 enum ad_disc_req { 64 AD_DISC_PREFER_SITE = 0, /* Prefer Site specific version */ 65 AD_DISC_SITE_SPECIFIC, /* Request Site specific version */ 66 AD_DISC_GLOBAL /* Request global version */ 67 }; 68 69 ad_disc_t ad_disc_init(void); 70 71 void ad_disc_fini(ad_disc_t); 72 73 /* 74 * The following routines auto discover the specific item 75 */ 76 char * 77 ad_disc_get_DomainName(ad_disc_t ctx, boolean_t *auto_discovered); 78 79 idmap_ad_disc_ds_t * 80 ad_disc_get_DomainController(ad_disc_t ctx, 81 enum ad_disc_req req, boolean_t *auto_discovered); 82 83 char * 84 ad_disc_get_SiteName(ad_disc_t ctx, boolean_t *auto_discovered); 85 86 char * 87 ad_disc_get_ForestName(ad_disc_t ctx, boolean_t *auto_discovered); 88 89 idmap_ad_disc_ds_t * 90 ad_disc_get_GlobalCatalog(ad_disc_t ctx, enum ad_disc_req, 91 boolean_t *auto_discovered); 92 93 ad_disc_trusteddomains_t * 94 ad_disc_get_TrustedDomains(ad_disc_t ctx, boolean_t *auto_discovered); 95 96 ad_disc_domainsinforest_t * 97 ad_disc_get_DomainsInForest(ad_disc_t ctx, boolean_t *auto_discovered); 98 99 100 /* 101 * The following routines over ride auto discovery with the 102 * specified values 103 */ 104 int 105 ad_disc_set_DomainName(ad_disc_t ctx, const char *domainName); 106 107 int 108 ad_disc_set_DomainController(ad_disc_t ctx, 109 const idmap_ad_disc_ds_t *domainController); 110 111 int 112 ad_disc_set_SiteName(ad_disc_t ctx, const char *siteName); 113 114 int 115 ad_disc_set_ForestName(ad_disc_t ctx, const char *forestName); 116 117 int 118 ad_disc_set_GlobalCatalog(ad_disc_t ctx, 119 const idmap_ad_disc_ds_t *globalCatalog); 120 121 122 /* 123 * This routine forces all auto discovery item to be recomputed 124 * on request 125 */ 126 void ad_disc_refresh(ad_disc_t); 127 128 /* 129 * This routine marks the end of a discovery cycle and sets 130 * the sanity limits on the time before the next cycle. 131 */ 132 void ad_disc_done(ad_disc_t); 133 134 /* This routine unsets all overridden values */ 135 int ad_disc_unset(ad_disc_t ctx); 136 137 /* This routine test for subnet changes */ 138 boolean_t ad_disc_SubnetChanged(ad_disc_t); 139 140 /* This routine returns the Time To Live for auto discovered items */ 141 int ad_disc_get_TTL(ad_disc_t); 142 143 int ad_disc_compare_ds(idmap_ad_disc_ds_t *ds1, idmap_ad_disc_ds_t *ds2); 144 145 int ad_disc_compare_trusteddomains(ad_disc_trusteddomains_t *td1, 146 ad_disc_trusteddomains_t *td2); 147 148 int ad_disc_compare_domainsinforest(ad_disc_domainsinforest_t *td1, 149 ad_disc_domainsinforest_t *td2); 150 151 #ifdef __cplusplus 152 } 153 #endif 154 155 #endif /* _ADINFO_H */ 156