2 header for ads (active directory) library routines
4 basically this is a wrapper around ldap
8 void *ld
; /* the active ldap structure */
9 struct in_addr ldap_ip
; /* the ip of the active connection, if any */
10 time_t last_attempt
; /* last attempt to reconnect */
13 /* info needed to find the server */
18 int foreign
; /* set to 1 if connecting to a foreign realm */
21 /* info needed to authenticate */
31 /* info derived from the servers config */
35 char *ldap_server_name
;
43 char *shortServerName
;
49 char *defaultPriority
;
53 char *operatingSystem
;
54 char *operatingSystemHotfix
;
55 char *operatingSystemServicePack
;
56 char *operatingSystemVersion
;
57 char *physicalLocationObject
;
59 char *printAttributes
;
63 char *printDuplexSupported
;
66 char *printKeepPrintedJobs
;
68 char *printMACAddress
;
70 char *printMaxResolutionSupported
;
71 char *printMaxXExtent
;
72 char *printMaxYExtent
;
73 char **printMediaReady
;
74 char **printMediaSupported
;
76 char *printMinXExtent
;
77 char *printMinYExtent
;
78 char *printNetworkAddress
;
81 char **printOrientationsSupported
;
83 char *printPagesPerMinute
;
86 char *printSeparatorFile
;
87 char **printShareName
;
89 char *printStaplingSupported
;
95 /* there are 4 possible types of errors the ads subsystem can produce */
96 enum ads_error_type
{ADS_ERROR_KRB5
, ADS_ERROR_GSS
,
97 ADS_ERROR_LDAP
, ADS_ERROR_SYSTEM
, ADS_ERROR_NT
};
100 enum ads_error_type error_type
;
105 /* For error_type = ADS_ERROR_GSS minor_status describe GSS API error */
106 /* Where rc represents major_status of GSS API error */
111 typedef LDAPMod
**ADS_MODLIST
;
113 typedef void **ADS_MODLIST
;
116 /* macros to simplify error returning */
117 #define ADS_ERROR(rc) ADS_ERROR_LDAP(rc)
118 #define ADS_ERROR_LDAP(rc) ads_build_error(ADS_ERROR_LDAP, rc, 0)
119 #define ADS_ERROR_SYSTEM(rc) ads_build_error(ADS_ERROR_SYSTEM, rc?rc:EINVAL, 0)
120 #define ADS_ERROR_KRB5(rc) ads_build_error(ADS_ERROR_KRB5, rc, 0)
121 #define ADS_ERROR_GSS(rc, minor) ads_build_error(ADS_ERROR_GSS, rc, minor)
122 #define ADS_ERROR_NT(rc) ads_build_nt_error(ADS_ERROR_NT,rc)
124 #define ADS_ERR_OK(status) ((status.error_type == ADS_ERROR_NT) ? NT_STATUS_IS_OK(status.err.nt_status):(status.err.rc == 0))
125 #define ADS_SUCCESS ADS_ERROR(0)
127 /* time between reconnect attempts */
128 #define ADS_RECONNECT_TIME 5
130 /* timeout on searches */
131 #define ADS_SEARCH_TIMEOUT 10
133 /* ldap control oids */
134 #define ADS_PAGE_CTL_OID "1.2.840.113556.1.4.319"
135 #define ADS_NO_REFERRALS_OID "1.2.840.113556.1.4.1339"
136 #define ADS_SERVER_SORT_OID "1.2.840.113556.1.4.473"
138 /* UserFlags for userAccountControl */
139 #define UF_SCRIPT 0x00000001
140 #define UF_ACCOUNTDISABLE 0x00000002
141 #define UF_UNUSED_1 0x00000004
142 #define UF_HOMEDIR_REQUIRED 0x00000008
144 #define UF_LOCKOUT 0x00000010
145 #define UF_PASSWD_NOTREQD 0x00000020
146 #define UF_PASSWD_CANT_CHANGE 0x00000040
147 #define UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED 0x00000080
149 #define UF_TEMP_DUPLICATE_ACCOUNT 0x00000100
150 #define UF_NORMAL_ACCOUNT 0x00000200
151 #define UF_UNUSED_2 0x00000400
152 #define UF_INTERDOMAIN_TRUST_ACCOUNT 0x00000800
154 #define UF_WORKSTATION_TRUST_ACCOUNT 0x00001000
155 #define UF_SERVER_TRUST_ACCOUNT 0x00002000
156 #define UF_UNUSED_3 0x00004000
157 #define UF_UNUSED_4 0x00008000
159 #define UF_DONT_EXPIRE_PASSWD 0x00010000
160 #define UF_MNS_LOGON_ACCOUNT 0x00020000
161 #define UF_SMARTCARD_REQUIRED 0x00040000
162 #define UF_TRUSTED_FOR_DELEGATION 0x00080000
164 #define UF_NOT_DELEGATED 0x00100000
165 #define UF_USE_DES_KEY_ONLY 0x00200000
166 #define UF_DONT_REQUIRE_PREAUTH 0x00400000
167 #define UF_UNUSED_5 0x00800000
169 #define UF_UNUSED_6 0x01000000
170 #define UF_UNUSED_7 0x02000000
171 #define UF_UNUSED_8 0x04000000
172 #define UF_UNUSED_9 0x08000000
174 #define UF_UNUSED_10 0x10000000
175 #define UF_UNUSED_11 0x20000000
176 #define UF_UNUSED_12 0x40000000
177 #define UF_UNUSED_13 0x80000000
179 #define UF_MACHINE_ACCOUNT_MASK (\
180 UF_INTERDOMAIN_TRUST_ACCOUNT |\
181 UF_WORKSTATION_TRUST_ACCOUNT |\
182 UF_SERVER_TRUST_ACCOUNT \
185 #define UF_ACCOUNT_TYPE_MASK (\
186 UF_TEMP_DUPLICATE_ACCOUNT |\
188 UF_INTERDOMAIN_TRUST_ACCOUNT |\
189 UF_WORKSTATION_TRUST_ACCOUNT |\
190 UF_SERVER_TRUST_ACCOUNT \
193 #define UF_SETTABLE_BITS (\
196 UF_HOMEDIR_REQUIRED |\
199 UF_PASSWD_CANT_CHANGE |\
200 UF_ACCOUNT_TYPE_MASK | \
201 UF_DONT_EXPIRE_PASSWD | \
202 UF_MNS_LOGON_ACCOUNT |\
203 UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED |\
204 UF_SMARTCARD_REQUIRED |\
205 UF_TRUSTED_FOR_DELEGATION |\
207 UF_USE_DES_KEY_ONLY |\
208 UF_DONT_REQUIRE_PREAUTH \
212 #define ATYPE_NORMAL_ACCOUNT 0x30000000 /* 805306368 */
213 #define ATYPE_WORKSTATION_TRUST 0x30000001 /* 805306369 */
214 #define ATYPE_INTERDOMAIN_TRUST 0x30000002 /* 805306370 */
215 #define ATYPE_SECURITY_GLOBAL_GROUP 0x10000000 /* 268435456 */
216 #define ATYPE_DISTRIBUTION_GLOBAL_GROUP 0x10000001 /* 268435457 */
217 #define ATYPE_DISTRIBUTION_UNIVERSAL_GROUP AT_DISTRIBUTION_GLOBAL_GROUP
218 #define ATYPE_SECURITY_LOCAL_GROUP 0x20000000 /* 536870912 */
219 #define ATYPE_DISTRIBUTION_LOCAL_GROUP 0x20000001 /* 536870913 */
221 #define ATYPE_ACCOUNT ATYPE_NORMAL_ACCOUNT /* 0x30000000 805306368 */
222 #define ATYPE_GLOBAL_GROUP ATYPE_SECURITY_GLOBAL_GROUP /* 0x10000000 268435456 */
223 #define ATYPE_LOCAL_GROUP ATYPE_SECURITY_LOCAL_GROUP /* 0x20000000 536870912 */
226 #define GTYPE_SECURITY_BUILTIN_LOCAL_GROUP 0x80000005 /* -2147483643 */
227 #define GTYPE_SECURITY_DOMAIN_LOCAL_GROUP 0x80000004 /* -2147483644 */
228 #define GTYPE_SECURITY_GLOBAL_GROUP 0x80000002 /* -2147483646 */
229 #define GTYPE_DISTRIBUTION_GLOBAL_GROUP 0x00000002 /* 2 */
230 #define GTYPE_DISTRIBUTION_DOMAIN_LOCAL_GROUP 0x00000004 /* 4 */
231 #define GTYPE_DISTRIBUTION_UNIVERSAL_GROUP 0x00000008 /* 8 */
233 /* Mailslot or cldap getdcname response flags */
234 #define ADS_PDC 0x00000001 /* DC is PDC */
235 #define ADS_GC 0x00000004 /* DC is a GC of forest */
236 #define ADS_LDAP 0x00000008 /* DC is an LDAP server */
237 #define ADS_DS 0x00000010 /* DC supports DS */
238 #define ADS_KDC 0x00000020 /* DC is running KDC */
239 #define ADS_TIMESERV 0x00000040 /* DC is running time services */
240 #define ADS_CLOSEST 0x00000080 /* DC is closest to client */
241 #define ADS_WRITABLE 0x00000100 /* DC has writable DS */
242 #define ADS_GOOD_TIMESERV 0x00000200 /* DC has hardware clock
243 (and running time) */
244 #define ADS_NDNC 0x00000400 /* DomainName is non-domain NC serviced
246 #define ADS_PINGS 0x0000FFFF /* Ping response */
247 #define ADS_DNS_CONTROLLER 0x20000000 /* DomainControllerName is a DNS name*/
248 #define ADS_DNS_DOMAIN 0x40000000 /* DomainName is a DNS name */
249 #define ADS_DNS_FOREST 0x80000000 /* DnsForestName is a DNS name */
251 /* DomainCntrollerAddressType */
252 #define ADS_INET_ADDRESS 0x00000001
253 #define ADS_NETBIOS_ADDRESS 0x00000002
256 /* ads auth control flags */
257 #define ADS_AUTH_DISABLE_KERBEROS 1
258 #define ADS_AUTH_NO_BIND 2