1 #ifndef _INCLUDE_ADS_H_
2 #define _INCLUDE_ADS_H_
4 header for ads (active directory) library routines
6 basically this is a wrapper around ldap
9 #define TOK_ID_KRB_AP_REQ ((const uint8_t *)"\x01\x00")
10 #define TOK_ID_KRB_AP_REP ((const uint8_t *)"\x02\x00")
11 #define TOK_ID_KRB_ERROR ((const uint8_t *)"\x03\x00")
12 #define TOK_ID_GSS_GETMIC ((const uint8_t *)"\x01\x01")
13 #define TOK_ID_GSS_WRAP ((const uint8_t *)"\x02\x01")
15 enum wb_posix_mapping {
16 WB_POSIX_MAP_UNKNOWN = -1,
17 WB_POSIX_MAP_TEMPLATE = 0,
19 WB_POSIX_MAP_SFU20 = 2,
20 WB_POSIX_MAP_RFC2307 = 3,
21 WB_POSIX_MAP_UNIXINFO = 4
26 struct ads_saslwrap_ops {
28 ADS_STATUS (*wrap)(struct ads_struct *, uint8 *buf, uint32 len);
29 ADS_STATUS (*unwrap)(struct ads_struct *);
30 void (*disconnect)(struct ads_struct *);
33 enum ads_saslwrap_type {
34 ADS_SASLWRAP_TYPE_PLAIN = 1,
35 ADS_SASLWRAP_TYPE_SIGN = 2,
36 ADS_SASLWRAP_TYPE_SEAL = 4
39 typedef struct ads_struct {
40 int is_mine; /* do I own this structure's memory? */
42 /* info needed to find the server */
47 int foreign; /* set to 1 if connecting to a foreign
49 bool gc; /* Is this a global catalog server? */
52 /* info needed to authenticate */
65 /* info derived from the servers config */
67 uint32 flags; /* cldap flags identifying the services. */
70 char *ldap_server_name;
71 char *server_site_name;
72 char *client_site_name;
78 /* info about the current LDAP connection */
82 struct sockaddr_storage ss; /* the ip of the active connection, if any */
83 time_t last_attempt; /* last attempt to reconnect */
86 enum ads_saslwrap_type wrap_type;
88 #ifdef HAVE_LDAP_SASL_WRAPPING
89 Sockbuf_IO_Desc *sbiod; /* lowlevel state for LDAP wrapping */
90 #endif /* HAVE_LDAP_SASL_WRAPPING */
92 const struct ads_saslwrap_ops *wrap_ops;
93 void *wrap_private_data;
98 #define ADS_SASL_WRAPPING_IN_MAX_WRAPPED 0x0FFFFFFF
107 #define ADS_SASL_WRAPPING_OUT_MAX_WRAPPED 0x00A00000
108 uint32 max_unwrapped;
114 #endif /* HAVE_LDAP */
117 /* used to remember the names of the posix attributes in AD */
118 /* see the rfc2307 & sfu nss backends */
120 struct posix_schema {
121 char *posix_homedir_attr;
122 char *posix_shell_attr;
123 char *posix_uidnumber_attr;
124 char *posix_gidnumber_attr;
125 char *posix_gecos_attr;
126 char *posix_uid_attr;
132 typedef LDAPMod **ADS_MODLIST;
134 typedef void **ADS_MODLIST;
137 /* time between reconnect attempts */
138 #define ADS_RECONNECT_TIME 5
140 /* ldap control oids */
141 #define ADS_PAGE_CTL_OID "1.2.840.113556.1.4.319"
142 #define ADS_NO_REFERRALS_OID "1.2.840.113556.1.4.1339"
143 #define ADS_SERVER_SORT_OID "1.2.840.113556.1.4.473"
144 #define ADS_PERMIT_MODIFY_OID "1.2.840.113556.1.4.1413"
145 #define ADS_ASQ_OID "1.2.840.113556.1.4.1504"
146 #define ADS_EXTENDED_DN_OID "1.2.840.113556.1.4.529"
147 #define ADS_SD_FLAGS_OID "1.2.840.113556.1.4.801"
149 /* ldap attribute oids (Services for Unix 3.0, 3.5) */
150 #define ADS_ATTR_SFU_UIDNUMBER_OID "1.2.840.113556.1.6.18.1.310"
151 #define ADS_ATTR_SFU_GIDNUMBER_OID "1.2.840.113556.1.6.18.1.311"
152 #define ADS_ATTR_SFU_HOMEDIR_OID "1.2.840.113556.1.6.18.1.344"
153 #define ADS_ATTR_SFU_SHELL_OID "1.2.840.113556.1.6.18.1.312"
154 #define ADS_ATTR_SFU_GECOS_OID "1.2.840.113556.1.6.18.1.337"
155 #define ADS_ATTR_SFU_UID_OID "1.2.840.113556.1.6.18.1.309"
157 /* ldap attribute oids (Services for Unix 2.0) */
158 #define ADS_ATTR_SFU20_UIDNUMBER_OID "1.2.840.113556.1.4.7000.187.70"
159 #define ADS_ATTR_SFU20_GIDNUMBER_OID "1.2.840.113556.1.4.7000.187.71"
160 #define ADS_ATTR_SFU20_HOMEDIR_OID "1.2.840.113556.1.4.7000.187.106"
161 #define ADS_ATTR_SFU20_SHELL_OID "1.2.840.113556.1.4.7000.187.72"
162 #define ADS_ATTR_SFU20_GECOS_OID "1.2.840.113556.1.4.7000.187.97"
163 #define ADS_ATTR_SFU20_UID_OID "1.2.840.113556.1.4.7000.187.102"
166 /* ldap attribute oids (RFC2307) */
167 #define ADS_ATTR_RFC2307_UIDNUMBER_OID "1.3.6.1.1.1.1.0"
168 #define ADS_ATTR_RFC2307_GIDNUMBER_OID "1.3.6.1.1.1.1.1"
169 #define ADS_ATTR_RFC2307_HOMEDIR_OID "1.3.6.1.1.1.1.3"
170 #define ADS_ATTR_RFC2307_SHELL_OID "1.3.6.1.1.1.1.4"
171 #define ADS_ATTR_RFC2307_GECOS_OID "1.3.6.1.1.1.1.2"
172 #define ADS_ATTR_RFC2307_UID_OID "0.9.2342.19200300.100.1.1"
174 /* ldap bitwise searches */
175 #define ADS_LDAP_MATCHING_RULE_BIT_AND "1.2.840.113556.1.4.803"
176 #define ADS_LDAP_MATCHING_RULE_BIT_OR "1.2.840.113556.1.4.804"
178 #define ADS_PINGS 0x0000FFFF /* Ping response */
180 /* ads auth control flags */
181 #define ADS_AUTH_DISABLE_KERBEROS 0x0001
182 #define ADS_AUTH_NO_BIND 0x0002
183 #define ADS_AUTH_ANON_BIND 0x0004
184 #define ADS_AUTH_SIMPLE_BIND 0x0008
185 #define ADS_AUTH_ALLOW_NTLMSSP 0x0010
186 #define ADS_AUTH_SASL_SIGN 0x0020
187 #define ADS_AUTH_SASL_SEAL 0x0040
188 #define ADS_AUTH_SASL_FORCE 0x0080
189 #define ADS_AUTH_USER_CREDS 0x0100
191 enum ads_extended_dn_flags {
192 ADS_EXTENDED_DN_HEX_STRING = 0,
193 ADS_EXTENDED_DN_STRING = 1 /* not supported on win2k */
196 /* this is probably not very well suited to pass other controls generically but
197 * is good enough for the extended dn control where it is only used for atm */
205 #define ADS_IGNORE_PRINCIPAL "not_defined_in_RFC4178@please_ignore"
207 #endif /* _INCLUDE_ADS_H_ */