summaryrefslogtreecommitdiff
path: root/source4/libcli/cldap
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-11-15 17:08:45 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:28:14 -0500
commit146a4ff13a56ac5d72203adbf47c6cd53e892b32 (patch)
treea56dda806dbafea69f494951aa0389b0453cc22f /source4/libcli/cldap
parenta4957315d89f99ca3bac2df816a4f3f6a0b83c93 (diff)
downloadsamba-146a4ff13a56ac5d72203adbf47c6cd53e892b32.tar.gz
samba-146a4ff13a56ac5d72203adbf47c6cd53e892b32.tar.bz2
samba-146a4ff13a56ac5d72203adbf47c6cd53e892b32.zip
r19724: add a helper functions to return an CLDAP error
metze (This used to be commit 0a1ecb911656f8170708ce13e1183557fe118794)
Diffstat (limited to 'source4/libcli/cldap')
-rw-r--r--source4/libcli/cldap/cldap.c28
-rw-r--r--source4/libcli/cldap/cldap.h14
2 files changed, 37 insertions, 5 deletions
diff --git a/source4/libcli/cldap/cldap.c b/source4/libcli/cldap/cldap.c
index 1b09272f04..94887ef697 100644
--- a/source4/libcli/cldap/cldap.c
+++ b/source4/libcli/cldap/cldap.c
@@ -636,6 +636,34 @@ NTSTATUS cldap_empty_reply(struct cldap_socket *cldap,
return status;
}
+/*
+ send an error reply (used on any error, so the client doesn't keep waiting
+ or send the bad request again)
+*/
+NTSTATUS cldap_error_reply(struct cldap_socket *cldap,
+ uint32_t message_id,
+ struct socket_address *src,
+ int resultcode,
+ const char *errormessage)
+{
+ NTSTATUS status;
+ struct cldap_reply reply;
+ struct ldap_Result result;
+
+ reply.messageid = message_id;
+ reply.dest = src;
+ reply.response = NULL;
+ reply.result = &result;
+
+ ZERO_STRUCT(result);
+ result.resultcode = resultcode;
+ result.errormessage = errormessage;
+
+ status = cldap_reply_send(cldap, &reply);
+
+ return status;
+}
+
/*
send a netlogon reply
diff --git a/source4/libcli/cldap/cldap.h b/source4/libcli/cldap/cldap.h
index 98cb54dded..8bae2aa41b 100644
--- a/source4/libcli/cldap/cldap.h
+++ b/source4/libcli/cldap/cldap.h
@@ -135,6 +135,15 @@ struct cldap_reply {
NTSTATUS cldap_reply_send(struct cldap_socket *cldap, struct cldap_reply *io);
+NTSTATUS cldap_empty_reply(struct cldap_socket *cldap,
+ uint32_t message_id,
+ struct socket_address *src);
+NTSTATUS cldap_error_reply(struct cldap_socket *cldap,
+ uint32_t message_id,
+ struct socket_address *src,
+ int resultcode,
+ const char *errormessage);
+
/*
a netlogon cldap request
*/
@@ -161,11 +170,6 @@ NTSTATUS cldap_netlogon_recv(struct cldap_request *req,
struct cldap_netlogon *io);
NTSTATUS cldap_netlogon(struct cldap_socket *cldap,
TALLOC_CTX *mem_ctx, struct cldap_netlogon *io);
-
-
-NTSTATUS cldap_empty_reply(struct cldap_socket *cldap,
- uint32_t message_id,
- struct socket_address *src);
NTSTATUS cldap_netlogon_reply(struct cldap_socket *cldap,
uint32_t message_id,
struct socket_address *src,