summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/ldb_ildap
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/ldb/ldb_ildap')
-rw-r--r--source4/lib/ldb/ldb_ildap/ldb_ildap.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/source4/lib/ldb/ldb_ildap/ldb_ildap.c b/source4/lib/ldb/ldb_ildap/ldb_ildap.c
index aa0efee481..9cccec0313 100644
--- a/source4/lib/ldb/ldb_ildap/ldb_ildap.c
+++ b/source4/lib/ldb/ldb_ildap/ldb_ildap.c
@@ -34,6 +34,7 @@
#include "ldb/include/ldb_private.h"
#include "libcli/ldap/ldap.h"
#include "libcli/ldap/ldap_client.h"
+#include "lib/cmdline/popt_common.h"
struct ildb_private {
const char *basedn;
@@ -110,6 +111,10 @@ static int ildb_search(struct ldb_module *module, const char *base,
int count, i;
struct ldap_message **ldapres, *msg;
+ if (scope == LDB_SCOPE_DEFAULT) {
+ scope = LDB_SCOPE_SUBTREE;
+ }
+
if (base == NULL) {
base = "";
}
@@ -384,6 +389,15 @@ int ildb_connect(struct ldb_context *ldb, const char *url,
ldb->modules->private_data = ildb;
ldb->modules->ops = &ildb_ops;
+ if (cmdline_credentials->username_obtained > CRED_GUESSED) {
+ status = ldap_bind_sasl(ildb->ldap, cmdline_credentials);
+ if (!NT_STATUS_IS_OK(status)) {
+ ldb_debug(ldb, LDB_DEBUG_ERROR, "Failed to bind - %s\n",
+ ldap_errstr(ildb->ldap, status));
+ goto failed;
+ }
+ }
+
return 0;
failed: