s3: VFS: Change SMB_VFS_GET_QUOTA to use const struct smb_filename * instead of const...
[Samba.git] / source3 / include / ads.h
blobebc5728f3a4fccbe769271f55f7dff44a1dc2f86
1 #ifndef _INCLUDE_ADS_H_
2 #define _INCLUDE_ADS_H_
3 /*
4 header for ads (active directory) library routines
6 basically this is a wrapper around ldap
7 */
9 #include "libads/ads_status.h"
10 #include "smb_ldap.h"
12 struct ads_saslwrap;
14 struct ads_saslwrap_ops {
15 const char *name;
16 ADS_STATUS (*wrap)(struct ads_saslwrap *, uint8_t *buf, uint32_t len);
17 ADS_STATUS (*unwrap)(struct ads_saslwrap *);
18 void (*disconnect)(struct ads_saslwrap *);
21 enum ads_saslwrap_type {
22 ADS_SASLWRAP_TYPE_PLAIN = 1,
23 ADS_SASLWRAP_TYPE_SIGN = 2,
24 ADS_SASLWRAP_TYPE_SEAL = 4
27 struct ads_saslwrap {
28 /* expected SASL wrapping type */
29 enum ads_saslwrap_type wrap_type;
30 /* SASL wrapping operations */
31 const struct ads_saslwrap_ops *wrap_ops;
32 #ifdef HAVE_LDAP_SASL_WRAPPING
33 Sockbuf_IO_Desc *sbiod; /* lowlevel state for LDAP wrapping */
34 #endif /* HAVE_LDAP_SASL_WRAPPING */
35 TALLOC_CTX *mem_ctx;
36 void *wrap_private_data;
37 struct {
38 uint32_t ofs;
39 uint32_t needed;
40 uint32_t left;
41 #define ADS_SASL_WRAPPING_IN_MAX_WRAPPED 0x0FFFFFFF
42 uint32_t max_wrapped;
43 uint32_t min_wrapped;
44 uint32_t size;
45 uint8_t *buf;
46 } in;
47 struct {
48 uint32_t ofs;
49 uint32_t left;
50 #define ADS_SASL_WRAPPING_OUT_MAX_WRAPPED 0x00A00000
51 uint32_t max_unwrapped;
52 uint32_t sig_size;
53 uint32_t size;
54 uint8_t *buf;
55 } out;
58 typedef struct ads_struct {
59 int is_mine; /* do I own this structure's memory? */
61 /* info needed to find the server */
62 struct {
63 char *realm;
64 char *workgroup;
65 char *ldap_server;
66 bool gc; /* Is this a global catalog server? */
67 bool no_fallback; /* Bail if the ldap_server is not available */
68 } server;
70 /* info needed to authenticate */
71 struct {
72 char *realm;
73 char *password;
74 char *user_name;
75 char *kdc_server;
76 unsigned flags;
77 int time_offset;
78 char *ccache_name;
79 time_t tgt_expire;
80 time_t tgs_expire;
81 time_t renewable;
82 } auth;
84 /* info derived from the servers config */
85 struct {
86 uint32_t flags; /* cldap flags identifying the services. */
87 char *realm;
88 char *bind_path;
89 char *ldap_server_name;
90 char *server_site_name;
91 char *client_site_name;
92 time_t current_time;
93 char *schema_path;
94 char *config_path;
95 int ldap_page_size;
96 } config;
98 /* info about the current LDAP connection */
99 #ifdef HAVE_LDAP
100 struct ads_saslwrap ldap_wrap_data;
101 struct {
102 LDAP *ld;
103 struct sockaddr_storage ss; /* the ip of the active connection, if any */
104 time_t last_attempt; /* last attempt to reconnect, monotonic clock */
105 int port;
106 } ldap;
107 #endif /* HAVE_LDAP */
108 } ADS_STRUCT;
110 #ifdef HAVE_ADS
111 typedef LDAPMod **ADS_MODLIST;
112 #else
113 typedef void **ADS_MODLIST;
114 #endif
116 /* time between reconnect attempts */
117 #define ADS_RECONNECT_TIME 5
119 /* ldap control oids */
120 #define ADS_PAGE_CTL_OID "1.2.840.113556.1.4.319"
121 #define ADS_NO_REFERRALS_OID "1.2.840.113556.1.4.1339"
122 #define ADS_SERVER_SORT_OID "1.2.840.113556.1.4.473"
123 #define ADS_PERMIT_MODIFY_OID "1.2.840.113556.1.4.1413"
124 #define ADS_ASQ_OID "1.2.840.113556.1.4.1504"
125 #define ADS_EXTENDED_DN_OID "1.2.840.113556.1.4.529"
126 #define ADS_SD_FLAGS_OID "1.2.840.113556.1.4.801"
128 /* ldap bitwise searches */
129 #define ADS_LDAP_MATCHING_RULE_BIT_AND "1.2.840.113556.1.4.803"
130 #define ADS_LDAP_MATCHING_RULE_BIT_OR "1.2.840.113556.1.4.804"
132 #define ADS_PINGS 0x0000FFFF /* Ping response */
134 enum ads_extended_dn_flags {
135 ADS_EXTENDED_DN_HEX_STRING = 0,
136 ADS_EXTENDED_DN_STRING = 1 /* not supported on win2k */
139 /* this is probably not very well suited to pass other controls generically but
140 * is good enough for the extended dn control where it is only used for atm */
142 typedef struct {
143 const char *control;
144 int val;
145 int critical;
146 } ads_control;
148 #include "libads/ads_proto.h"
150 #ifdef HAVE_LDAP
151 #include "libads/ads_ldap_protos.h"
152 #endif
154 #include "libads/kerberos_proto.h"
156 #endif /* _INCLUDE_ADS_H_ */