diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-06-18 09:01:09 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:18:25 -0500 |
commit | f40e69da2633771a42ec2b74fca63bd0b0a37e4a (patch) | |
tree | ecc6737baffc63d09f3e272e9de0a6c6eaeb37fb /source4/lib/ldb/ldb_ildap/ldb_ildap.c | |
parent | 56b79e945f1e28d1ba7296e44a9802c140b942ef (diff) | |
download | samba-f40e69da2633771a42ec2b74fca63bd0b0a37e4a.tar.gz samba-f40e69da2633771a42ec2b74fca63bd0b0a37e4a.tar.bz2 samba-f40e69da2633771a42ec2b74fca63bd0b0a37e4a.zip |
r7714: enable samba credentials handling in ldb tools. So you can now do a
encrypted ldbedit against w2k3
(This used to be commit 6277c3923e7d9c26753424b1e77ac62f8e0729a4)
Diffstat (limited to 'source4/lib/ldb/ldb_ildap/ldb_ildap.c')
-rw-r--r-- | source4/lib/ldb/ldb_ildap/ldb_ildap.c | 14 |
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: |