From afe3e8172ddaa5e4aa811faceecda4f943d6e2ef Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 2 Apr 2008 04:53:27 +0200 Subject: Install public header files again and include required prototypes. (This used to be commit 47ffbbf67435904754469544390b67d34c958343) --- source4/libcli/ldap/config.mk | 3 +-- source4/libcli/ldap/ldap.c | 5 +++-- source4/libcli/ldap/ldap.h | 4 +++- source4/libcli/ldap/ldap_bind.c | 7 ++++--- source4/libcli/ldap/ldap_client.c | 23 ++++++++++---------- source4/libcli/ldap/ldap_client.h | 44 +++++++++++++++++++++++++++++++++++++++ source4/libcli/ldap/ldap_ildap.c | 6 +++--- source4/libcli/ldap/ldap_msg.c | 2 +- 8 files changed, 71 insertions(+), 23 deletions(-) (limited to 'source4/libcli/ldap') diff --git a/source4/libcli/ldap/config.mk b/source4/libcli/ldap/config.mk index bcdedd3440..0c5236c138 100644 --- a/source4/libcli/ldap/config.mk +++ b/source4/libcli/ldap/config.mk @@ -10,9 +10,8 @@ PUBLIC_DEPENDENCIES = LIBSAMBA-ERRORS LIBEVENTS LIBPACKET PRIVATE_DEPENDENCIES = LIBCLI_COMPOSITE samba-socket NDR_SAMR LIBTLS ASN1_UTIL \ LDAP_ENCODE LIBNDR LP_RESOLVE gensec -PUBLIC_HEADERS += libcli/ldap/ldap.h +PUBLIC_HEADERS += libcli/ldap/ldap.h libcli/ldap/ldap_ndr.h [SUBSYSTEM::LDAP_ENCODE] -PRIVATE_PROTO_HEADER = ldap_ndr.h OBJ_FILES = ldap_ndr.o # FIXME PRIVATE_DEPENDENCIES = LIBLDB diff --git a/source4/libcli/ldap/ldap.c b/source4/libcli/ldap/ldap.c index 00a0631753..fc6de7993e 100644 --- a/source4/libcli/ldap/ldap.c +++ b/source4/libcli/ldap/ldap.c @@ -25,6 +25,7 @@ #include "includes.h" #include "lib/util/asn1.h" #include "libcli/ldap/ldap.h" +#include "libcli/ldap/ldap_proto.h" static bool ldap_push_filter(struct asn1_data *data, struct ldb_parse_tree *tree) @@ -187,7 +188,7 @@ static void ldap_encode_response(struct asn1_data *data, struct ldap_Result *res } } -bool ldap_encode(struct ldap_message *msg, DATA_BLOB *result, TALLOC_CTX *mem_ctx) +_PUBLIC_ bool ldap_encode(struct ldap_message *msg, DATA_BLOB *result, TALLOC_CTX *mem_ctx) { struct asn1_data *data = asn1_init(mem_ctx); int i, j; @@ -927,7 +928,7 @@ static void ldap_decode_attribs(TALLOC_CTX *mem_ctx, struct asn1_data *data, /* This routine returns LDAP status codes */ -NTSTATUS ldap_decode(struct asn1_data *data, struct ldap_message *msg) +_PUBLIC_ NTSTATUS ldap_decode(struct asn1_data *data, struct ldap_message *msg) { uint8_t tag; diff --git a/source4/libcli/ldap/ldap.h b/source4/libcli/ldap/ldap.h index 6f5e86744e..a336a7ad85 100644 --- a/source4/libcli/ldap/ldap.h +++ b/source4/libcli/ldap/ldap.h @@ -254,6 +254,8 @@ struct cli_credentials; struct dom_sid; struct asn1_data; -#include "libcli/ldap/ldap_proto.h" +struct ldap_message *new_ldap_message(TALLOC_CTX *mem_ctx); +NTSTATUS ldap_decode(struct asn1_data *data, struct ldap_message *msg); +bool ldap_encode(struct ldap_message *msg, DATA_BLOB *result, TALLOC_CTX *mem_ctx); #endif diff --git a/source4/libcli/ldap/ldap_bind.c b/source4/libcli/ldap/ldap_bind.c index fd15ff2fc7..2c04edf950 100644 --- a/source4/libcli/ldap/ldap_bind.c +++ b/source4/libcli/ldap/ldap_bind.c @@ -23,6 +23,7 @@ #include "includes.h" #include "libcli/ldap/ldap.h" +#include "libcli/ldap/ldap_proto.h" #include "libcli/ldap/ldap_client.h" #include "lib/tls/tls.h" #include "auth/gensec/gensec.h" @@ -35,7 +36,7 @@ struct ldap_simple_creds { const char *pw; }; -NTSTATUS ldap_rebind(struct ldap_connection *conn) +_PUBLIC_ NTSTATUS ldap_rebind(struct ldap_connection *conn) { NTSTATUS status; struct ldap_simple_creds *creds; @@ -88,7 +89,7 @@ static struct ldap_message *new_ldap_simple_bind_msg(struct ldap_connection *con /* perform a simple username/password bind */ -NTSTATUS ldap_bind_simple(struct ldap_connection *conn, +_PUBLIC_ NTSTATUS ldap_bind_simple(struct ldap_connection *conn, const char *userdn, const char *password) { struct ldap_request *req; @@ -199,7 +200,7 @@ static struct ldap_message *new_ldap_sasl_bind_msg(struct ldap_connection *conn, /* perform a sasl bind using the given credentials */ -NTSTATUS ldap_bind_sasl(struct ldap_connection *conn, +_PUBLIC_ NTSTATUS ldap_bind_sasl(struct ldap_connection *conn, struct cli_credentials *creds, struct loadparm_context *lp_ctx) { diff --git a/source4/libcli/ldap/ldap_client.c b/source4/libcli/ldap/ldap_client.c index d99851ee15..296a7b11f2 100644 --- a/source4/libcli/ldap/ldap_client.c +++ b/source4/libcli/ldap/ldap_client.c @@ -28,6 +28,7 @@ #include "lib/events/events.h" #include "lib/socket/socket.h" #include "libcli/ldap/ldap.h" +#include "libcli/ldap/ldap_proto.h" #include "libcli/ldap/ldap_client.h" #include "libcli/composite/composite.h" #include "lib/stream/packet.h" @@ -41,7 +42,7 @@ /** create a new ldap_connection stucture. The event context is optional */ -struct ldap_connection *ldap4_new_connection(TALLOC_CTX *mem_ctx, +_PUBLIC_ struct ldap_connection *ldap4_new_connection(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, struct event_context *ev) { @@ -293,7 +294,7 @@ struct ldap_connect_state { static void ldap_connect_recv_unix_conn(struct composite_context *ctx); static void ldap_connect_recv_tcp_conn(struct composite_context *ctx); -struct composite_context *ldap_connect_send(struct ldap_connection *conn, +_PUBLIC_ struct composite_context *ldap_connect_send(struct ldap_connection *conn, const char *url) { struct composite_context *result, *ctx; @@ -476,7 +477,7 @@ _PUBLIC_ NTSTATUS ldap_connect_recv(struct composite_context *ctx) return status; } -NTSTATUS ldap_connect(struct ldap_connection *conn, const char *url) +_PUBLIC_ NTSTATUS ldap_connect(struct ldap_connection *conn, const char *url) { struct composite_context *ctx = ldap_connect_send(conn, url); return ldap_connect_recv(ctx); @@ -484,7 +485,7 @@ NTSTATUS ldap_connect(struct ldap_connection *conn, const char *url) /* set reconnect parameters */ -void ldap_set_reconn_params(struct ldap_connection *conn, int max_retries) +_PUBLIC_ void ldap_set_reconn_params(struct ldap_connection *conn, int max_retries) { if (conn) { conn->reconnect.max_retries = max_retries; @@ -569,7 +570,7 @@ static void ldap_request_complete(struct event_context *ev, struct timed_event * /* send a ldap message - async interface */ -struct ldap_request *ldap_request_send(struct ldap_connection *conn, +_PUBLIC_ struct ldap_request *ldap_request_send(struct ldap_connection *conn, struct ldap_message *msg) { struct ldap_request *req; @@ -645,7 +646,7 @@ failed: wait for a request to complete note that this does not destroy the request */ -NTSTATUS ldap_request_wait(struct ldap_request *req) +_PUBLIC_ NTSTATUS ldap_request_wait(struct ldap_request *req) { while (req->state < LDAP_REQUEST_DONE) { if (event_loop_once(req->conn->event.event_ctx) != 0) { @@ -709,7 +710,7 @@ static const struct { /* used to setup the status code from a ldap response */ -NTSTATUS ldap_check_response(struct ldap_connection *conn, struct ldap_Result *r) +_PUBLIC_ NTSTATUS ldap_check_response(struct ldap_connection *conn, struct ldap_Result *r) { int i; const char *codename = "unknown"; @@ -742,7 +743,7 @@ NTSTATUS ldap_check_response(struct ldap_connection *conn, struct ldap_Result *r /* return error string representing the last error */ -const char *ldap_errstr(struct ldap_connection *conn, +_PUBLIC_ const char *ldap_errstr(struct ldap_connection *conn, TALLOC_CTX *mem_ctx, NTSTATUS status) { @@ -756,7 +757,7 @@ const char *ldap_errstr(struct ldap_connection *conn, /* return the Nth result message, waiting if necessary */ -NTSTATUS ldap_result_n(struct ldap_request *req, int n, struct ldap_message **msg) +_PUBLIC_ NTSTATUS ldap_result_n(struct ldap_request *req, int n, struct ldap_message **msg) { *msg = NULL; @@ -784,7 +785,7 @@ NTSTATUS ldap_result_n(struct ldap_request *req, int n, struct ldap_message **ms /* return a single result message, checking if it is of the expected LDAP type */ -NTSTATUS ldap_result_one(struct ldap_request *req, struct ldap_message **msg, int type) +_PUBLIC_ NTSTATUS ldap_result_one(struct ldap_request *req, struct ldap_message **msg, int type) { NTSTATUS status; status = ldap_result_n(req, 0, msg); @@ -802,7 +803,7 @@ NTSTATUS ldap_result_one(struct ldap_request *req, struct ldap_message **msg, in a simple ldap transaction, for single result requests that only need a status code this relies on single valued requests having the response type == request type + 1 */ -NTSTATUS ldap_transaction(struct ldap_connection *conn, struct ldap_message *msg) +_PUBLIC_ NTSTATUS ldap_transaction(struct ldap_connection *conn, struct ldap_message *msg) { struct ldap_request *req = ldap_request_send(conn, msg); struct ldap_message *res; diff --git a/source4/libcli/ldap/ldap_client.h b/source4/libcli/ldap/ldap_client.h index d5ff441aff..13b0bf725c 100644 --- a/source4/libcli/ldap/ldap_client.h +++ b/source4/libcli/ldap/ldap_client.h @@ -94,3 +94,47 @@ struct ldap_connection { struct packet_context *packet; }; + +struct ldap_connection *ldap4_new_connection(TALLOC_CTX *mem_ctx, + struct loadparm_context *lp_ctx, + struct event_context *ev); + +NTSTATUS ldap_connect(struct ldap_connection *conn, const char *url); +struct composite_context *ldap_connect_send(struct ldap_connection *conn, + const char *url); + +NTSTATUS ldap_rebind(struct ldap_connection *conn); +NTSTATUS ldap_bind_simple(struct ldap_connection *conn, + const char *userdn, const char *password); +NTSTATUS ldap_bind_sasl(struct ldap_connection *conn, + struct cli_credentials *creds, + struct loadparm_context *lp_ctx); +struct ldap_request *ldap_request_send(struct ldap_connection *conn, + struct ldap_message *msg); +NTSTATUS ldap_request_wait(struct ldap_request *req); +struct composite_context; +NTSTATUS ldap_connect_recv(struct composite_context *ctx); +NTSTATUS ldap_result_n(struct ldap_request *req, int n, struct ldap_message **msg); +NTSTATUS ldap_result_one(struct ldap_request *req, struct ldap_message **msg, int type); +NTSTATUS ldap_transaction(struct ldap_connection *conn, struct ldap_message *msg); +const char *ldap_errstr(struct ldap_connection *conn, + TALLOC_CTX *mem_ctx, + NTSTATUS status); +NTSTATUS ldap_check_response(struct ldap_connection *conn, struct ldap_Result *r); +void ldap_set_reconn_params(struct ldap_connection *conn, int max_retries); +int ildap_count_entries(struct ldap_connection *conn, struct ldap_message **res); +NTSTATUS ildap_search_bytree(struct ldap_connection *conn, const char *basedn, + int scope, struct ldb_parse_tree *tree, + const char * const *attrs, bool attributesonly, + struct ldb_control **control_req, + struct ldb_control ***control_res, + struct ldap_message ***results); +NTSTATUS ildap_search(struct ldap_connection *conn, const char *basedn, + int scope, const char *expression, + const char * const *attrs, bool attributesonly, + struct ldb_control **control_req, + struct ldb_control ***control_res, + struct ldap_message ***results); + + + diff --git a/source4/libcli/ldap/ldap_ildap.c b/source4/libcli/ldap/ldap_ildap.c index 7b592c65ae..8f21af0690 100644 --- a/source4/libcli/ldap/ldap_ildap.c +++ b/source4/libcli/ldap/ldap_ildap.c @@ -28,7 +28,7 @@ /* count the returned search entries */ -int ildap_count_entries(struct ldap_connection *conn, struct ldap_message **res) +_PUBLIC_ int ildap_count_entries(struct ldap_connection *conn, struct ldap_message **res) { int i; for (i=0;res && res[i];i++) /* noop */ ; @@ -39,7 +39,7 @@ int ildap_count_entries(struct ldap_connection *conn, struct ldap_message **res) /* perform a synchronous ldap search */ -NTSTATUS ildap_search_bytree(struct ldap_connection *conn, const char *basedn, +_PUBLIC_ NTSTATUS ildap_search_bytree(struct ldap_connection *conn, const char *basedn, int scope, struct ldb_parse_tree *tree, const char * const *attrs, bool attributesonly, struct ldb_control **control_req, @@ -112,7 +112,7 @@ NTSTATUS ildap_search_bytree(struct ldap_connection *conn, const char *basedn, /* perform a ldap search */ -NTSTATUS ildap_search(struct ldap_connection *conn, const char *basedn, +_PUBLIC_ NTSTATUS ildap_search(struct ldap_connection *conn, const char *basedn, int scope, const char *expression, const char * const *attrs, bool attributesonly, struct ldb_control **control_req, diff --git a/source4/libcli/ldap/ldap_msg.c b/source4/libcli/ldap/ldap_msg.c index 12832b8ec4..c712e1e654 100644 --- a/source4/libcli/ldap/ldap_msg.c +++ b/source4/libcli/ldap/ldap_msg.c @@ -26,7 +26,7 @@ #include "libcli/ldap/ldap_client.h" -struct ldap_message *new_ldap_message(TALLOC_CTX *mem_ctx) +_PUBLIC_ struct ldap_message *new_ldap_message(TALLOC_CTX *mem_ctx) { return talloc_zero(mem_ctx, struct ldap_message); } -- cgit