summaryrefslogtreecommitdiff
path: root/source4/libcli/cldap/cldap.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-05-11 04:48:30 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:16:37 -0500
commita8c26fa4ace4dbb2e514669560143d68879a99bf (patch)
tree57fef2dac4e68d6579d5e1aec97cd38d8530c56a /source4/libcli/cldap/cldap.c
parent2f2fc84a7c6724f6eab39bf301be70ba5bec15cc (diff)
downloadsamba-a8c26fa4ace4dbb2e514669560143d68879a99bf.tar.gz
samba-a8c26fa4ace4dbb2e514669560143d68879a99bf.tar.bz2
samba-a8c26fa4ace4dbb2e514669560143d68879a99bf.zip
r6724: added "cldap port" smb.conf parameter
(This used to be commit 04af0e7c5de467a24b965ce1de2fb07621133164)
Diffstat (limited to 'source4/libcli/cldap/cldap.c')
-rw-r--r--source4/libcli/cldap/cldap.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/source4/libcli/cldap/cldap.c b/source4/libcli/cldap/cldap.c
index a28afc6877..75ce0a67db 100644
--- a/source4/libcli/cldap/cldap.c
+++ b/source4/libcli/cldap/cldap.c
@@ -41,7 +41,6 @@
#include "include/asn_1.h"
#define CLDAP_MAX_PACKET_SIZE 2048
-const unsigned CLDAP_PORT = 389;
/*
destroy a pending request
@@ -112,8 +111,12 @@ static void cldap_socket_recv(struct cldap_socket *cldap)
/* find the pending request */
req = idr_find(cldap->idr, ldap_msg.messageid);
if (req == NULL) {
- DEBUG(2,("Mismatched cldap reply %u from %s:%d\n",
- ldap_msg.messageid, src_addr, src_port));
+ if (cldap->incoming.handler) {
+ cldap->incoming.handler(cldap, &ldap_msg, src_addr, src_port);
+ } else {
+ DEBUG(2,("Mismatched cldap reply %u from %s:%d\n",
+ ldap_msg.messageid, src_addr, src_port));
+ }
talloc_free(tmp_ctx);
return;
}
@@ -249,6 +252,7 @@ struct cldap_socket *cldap_socket_init(TALLOC_CTX *mem_ctx,
cldap_socket_handler, cldap);
cldap->send_queue = NULL;
+ cldap->incoming.handler = NULL;
return cldap;
@@ -259,6 +263,20 @@ failed:
/*
+ setup a handler for incoming requests
+*/
+NTSTATUS cldap_set_incoming_handler(struct cldap_socket *cldap,
+ void (*handler)(struct cldap_socket *, struct ldap_message *,
+ const char *, int ),
+ void *private)
+{
+ cldap->incoming.handler = handler;
+ cldap->incoming.private = private;
+ EVENT_FD_READABLE(cldap->fde);
+ return NT_STATUS_OK;
+}
+
+/*
queue a cldap request for send
*/
struct cldap_request *cldap_search_send(struct cldap_socket *cldap,
@@ -278,7 +296,7 @@ struct cldap_request *cldap_search_send(struct cldap_socket *cldap,
req->dest_addr = talloc_strdup(req, io->in.dest_address);
if (req->dest_addr == NULL) goto failed;
- req->dest_port = CLDAP_PORT;
+ req->dest_port = lp_cldap_port();
req->message_id = idr_get_new_random(cldap->idr, req, UINT16_MAX);
if (req->message_id == -1) goto failed;