source: vendor/current/source3/include/ads.h

Last change on this file was 988, checked in by Silvan Scherrer, 9 years ago

Samba Server: update vendor to version 4.4.3

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