From f40e69da2633771a42ec2b74fca63bd0b0a37e4a Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 18 Jun 2005 09:01:09 +0000 Subject: r7714: enable samba credentials handling in ldb tools. So you can now do a encrypted ldbedit against w2k3 (This used to be commit 6277c3923e7d9c26753424b1e77ac62f8e0729a4) --- source4/lib/ldb/ldb_ildap/ldb_ildap.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'source4/lib/ldb/ldb_ildap') 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: -- cgit