2 Unix SMB/CIFS implementation.
6 Copyright (C) Andrew Tridgell 2005
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #include "../lib/util/asn1.h"
23 #include "../libcli/netlogon.h"
27 enum cldap_request_state {CLDAP_REQUEST_SEND,
33 a cldap request packet
35 struct cldap_request {
36 struct cldap_request *next, *prev;
38 struct cldap_socket *cldap;
40 enum cldap_request_state state;
43 /* where to send the request */
44 struct socket_address *dest;
46 /* timeout between retries (seconds) */
52 /* the ldap message_id */
55 struct timed_event *te;
57 /* the encoded request */
61 struct asn1_data *asn1;
63 /* information on what to do on completion */
65 void (*fn)(struct cldap_request *);
71 context structure for operations on cldap packets
74 struct socket_context *sock;
75 struct event_context *event_ctx;
76 struct smb_iconv_convenience *iconv_convenience;
81 /* a queue of outgoing requests */
82 struct cldap_request *send_queue;
84 /* mapping from message_id to pending request */
85 struct idr_context *idr;
87 /* what to do with incoming request packets */
89 void (*handler)(struct cldap_socket *, struct ldap_message *,
90 struct socket_address *);
97 a general cldap search request
101 const char *dest_address;
104 const char **attributes;
109 struct ldap_SearchResEntry *response;
110 struct ldap_Result *result;
114 struct cldap_socket *cldap_socket_init(TALLOC_CTX *mem_ctx,
115 struct event_context *event_ctx,
116 struct smb_iconv_convenience *iconv_convenience);
117 NTSTATUS cldap_set_incoming_handler(struct cldap_socket *cldap,
118 void (*handler)(struct cldap_socket *, struct ldap_message *,
119 struct socket_address *),
121 struct cldap_request *cldap_search_send(struct cldap_socket *cldap,
122 struct cldap_search *io);
123 NTSTATUS cldap_search_recv(struct cldap_request *req, TALLOC_CTX *mem_ctx,
124 struct cldap_search *io);
125 NTSTATUS cldap_search(struct cldap_socket *cldap, TALLOC_CTX *mem_ctx,
126 struct cldap_search *io);
130 a general cldap reply
134 struct socket_address *dest;
135 struct ldap_SearchResEntry *response;
136 struct ldap_Result *result;
139 NTSTATUS cldap_reply_send(struct cldap_socket *cldap, struct cldap_reply *io);
141 NTSTATUS cldap_empty_reply(struct cldap_socket *cldap,
143 struct socket_address *src);
144 NTSTATUS cldap_error_reply(struct cldap_socket *cldap,
146 struct socket_address *src,
148 const char *errormessage);
151 a netlogon cldap request
153 struct cldap_netlogon {
155 const char *dest_address;
160 const char *domain_guid;
161 const char *domain_sid;
167 struct netlogon_samlogon_response netlogon;
171 struct cldap_request *cldap_netlogon_send(struct cldap_socket *cldap,
172 struct cldap_netlogon *io);
173 NTSTATUS cldap_netlogon_recv(struct cldap_request *req,
175 struct cldap_netlogon *io);
176 NTSTATUS cldap_netlogon(struct cldap_socket *cldap,
177 TALLOC_CTX *mem_ctx, struct cldap_netlogon *io);
178 NTSTATUS cldap_netlogon_reply(struct cldap_socket *cldap,
180 struct socket_address *src,
182 struct netlogon_samlogon_response *netlogon);