| 1 | /*
|
|---|
| 2 | Unix SMB/CIFS implementation.
|
|---|
| 3 | LDAP server
|
|---|
| 4 | Copyright (C) Volker Lendecke 2004
|
|---|
| 5 | Copyright (C) Stefan Metzmacher 2004
|
|---|
| 6 |
|
|---|
| 7 | This program is free software; you can redistribute it and/or modify
|
|---|
| 8 | it under the terms of the GNU General Public License as published by
|
|---|
| 9 | the Free Software Foundation; either version 3 of the License, or
|
|---|
| 10 | (at your option) any later version.
|
|---|
| 11 |
|
|---|
| 12 | This program is distributed in the hope that it will be useful,
|
|---|
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 15 | GNU General Public License for more details.
|
|---|
| 16 |
|
|---|
| 17 | You should have received a copy of the GNU General Public License
|
|---|
| 18 | along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|---|
| 19 | */
|
|---|
| 20 |
|
|---|
| 21 | #include "libcli/ldap/libcli_ldap.h"
|
|---|
| 22 | #include "lib/socket/socket.h"
|
|---|
| 23 | #include "lib/stream/packet.h"
|
|---|
| 24 | #include "system/network.h"
|
|---|
| 25 | #include "lib/param/loadparm.h"
|
|---|
| 26 |
|
|---|
| 27 | struct ldapsrv_connection {
|
|---|
| 28 | struct loadparm_context *lp_ctx;
|
|---|
| 29 | struct stream_connection *connection;
|
|---|
| 30 | struct gensec_security *gensec;
|
|---|
| 31 | struct auth_session_info *session_info;
|
|---|
| 32 | struct ldapsrv_service *service;
|
|---|
| 33 | struct cli_credentials *server_credentials;
|
|---|
| 34 | struct ldb_context *ldb;
|
|---|
| 35 |
|
|---|
| 36 | struct {
|
|---|
| 37 | struct tevent_queue *send_queue;
|
|---|
| 38 | struct tstream_context *raw;
|
|---|
| 39 | struct tstream_context *tls;
|
|---|
| 40 | struct tstream_context *sasl;
|
|---|
| 41 | struct tstream_context *active;
|
|---|
| 42 | } sockets;
|
|---|
| 43 |
|
|---|
| 44 | bool global_catalog;
|
|---|
| 45 | bool is_privileged;
|
|---|
| 46 | enum ldap_server_require_strong_auth require_strong_auth;
|
|---|
| 47 |
|
|---|
| 48 | struct {
|
|---|
| 49 | int initial_timeout;
|
|---|
| 50 | int conn_idle_time;
|
|---|
| 51 | int max_page_size;
|
|---|
| 52 | int search_timeout;
|
|---|
| 53 | struct timeval endtime;
|
|---|
| 54 | const char *reason;
|
|---|
| 55 | } limits;
|
|---|
| 56 |
|
|---|
| 57 | struct tevent_req *active_call;
|
|---|
| 58 | };
|
|---|
| 59 |
|
|---|
| 60 | struct ldapsrv_call {
|
|---|
| 61 | struct ldapsrv_connection *conn;
|
|---|
| 62 | struct ldap_message *request;
|
|---|
| 63 | struct ldapsrv_reply {
|
|---|
| 64 | struct ldapsrv_reply *prev, *next;
|
|---|
| 65 | struct ldap_message *msg;
|
|---|
| 66 | } *replies;
|
|---|
| 67 | struct iovec out_iov;
|
|---|
| 68 |
|
|---|
| 69 | struct tevent_req *(*postprocess_send)(TALLOC_CTX *mem_ctx,
|
|---|
| 70 | struct tevent_context *ev,
|
|---|
| 71 | void *private_data);
|
|---|
| 72 | NTSTATUS (*postprocess_recv)(struct tevent_req *req);
|
|---|
| 73 | void *postprocess_private;
|
|---|
| 74 | };
|
|---|
| 75 |
|
|---|
| 76 | struct ldapsrv_service {
|
|---|
| 77 | struct tstream_tls_params *tls_params;
|
|---|
| 78 | struct task_server *task;
|
|---|
| 79 | struct tevent_queue *call_queue;
|
|---|
| 80 | };
|
|---|
| 81 |
|
|---|
| 82 | #include "ldap_server/proto.h"
|
|---|