*/
#include "includes.h"
-#include "libcli/ldap/ldap.h"
+#include "libcli/ldap/libcli_ldap.h"
#include "libcli/ldap/ldap_client.h"
/*
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 */ ;
/*
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,
msg->r.SearchRequest.attributesonly = attributesonly;
msg->r.SearchRequest.tree = tree;
msg->r.SearchRequest.num_attributes = n;
- msg->r.SearchRequest.attributes = discard_const(attrs);
+ msg->r.SearchRequest.attributes = attrs;
msg->controls = control_req;
req = ldap_request_send(conn, msg);
- talloc_steal(msg, req);
+ talloc_reparent(conn, msg, req);
for (i=n=0;true;i++) {
struct ldap_message *res;
/*
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,
struct ldb_control ***control_res,
struct ldap_message ***results)
{
- struct ldb_parse_tree *tree = ldb_parse_tree(conn, expression);
NTSTATUS status;
+ struct ldb_parse_tree *tree = ldb_parse_tree(conn, expression);
+
+ if (tree == NULL) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
status = ildap_search_bytree(conn, basedn, scope, tree, attrs,
attributesonly, control_req,
control_res, results);