summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-06-30 10:39:04 +0200
committerVolker Lendecke <vl@samba.org>2009-07-04 12:54:22 +0200
commitf6ce7e062547a788425d683e75a517a32c235bd0 (patch)
tree9e6e7289dc60f354fdabaf3663f213c2a947767d /source3
parent98fb2a18f9d805a16514f24a5a0d87aa4a3573ff (diff)
downloadsamba-f6ce7e062547a788425d683e75a517a32c235bd0.tar.gz
samba-f6ce7e062547a788425d683e75a517a32c235bd0.tar.bz2
samba-f6ce7e062547a788425d683e75a517a32c235bd0.zip
pdb_ads: Use tldap_fetch_rootdse in pdb_ads_connect
Diffstat (limited to 'source3')
-rw-r--r--source3/passdb/pdb_ads.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/source3/passdb/pdb_ads.c b/source3/passdb/pdb_ads.c
index 2063a554f5..7a2fac701b 100644
--- a/source3/passdb/pdb_ads.c
+++ b/source3/passdb/pdb_ads.c
@@ -2134,11 +2134,10 @@ int pdb_ads_search_fmt(struct pdb_ads_state *state, const char *base,
static NTSTATUS pdb_ads_connect(struct pdb_ads_state *state,
const char *location)
{
- const char *rootdse_attrs[2] = {
- "defaultNamingContext", "configurationNamingContext" };
const char *domain_attrs[2] = { "objectSid", "objectGUID" };
const char *ncname_attrs[1] = { "netbiosname" };
- struct tldap_message **rootdse, **domain, **ncname;
+ struct tldap_context *ld;
+ struct tldap_message *rootdse, **domain, **ncname;
TALLOC_CTX *frame = talloc_stackframe();
NTSTATUS status;
int num_domains;
@@ -2149,23 +2148,23 @@ static NTSTATUS pdb_ads_connect(struct pdb_ads_state *state,
strncpy(state->socket_address.sun_path, location,
sizeof(state->socket_address.sun_path) - 1);
- rc = pdb_ads_search_fmt(
- state, "", TLDAP_SCOPE_BASE,
- rootdse_attrs, ARRAY_SIZE(rootdse_attrs), 0,
- talloc_tos(), &rootdse, "(objectclass=*)");
+ ld = pdb_ads_ld(state);
+ if (ld == NULL) {
+ status = NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
+ goto done;
+ }
+
+ rc = tldap_fetch_rootdse(ld);
if (rc != TLDAP_SUCCESS) {
DEBUG(10, ("Could not retrieve rootdse: %s\n",
tldap_errstr(debug_ctx(), state->ld, rc)));
status = NT_STATUS_LDAP(rc);
goto done;
}
- if (talloc_array_length(rootdse) != 1) {
- status = NT_STATUS_INTERNAL_DB_CORRUPTION;
- goto done;
- }
+ rootdse = tldap_rootdse(state->ld);
state->domaindn = tldap_talloc_single_attribute(
- rootdse[0], "defaultNamingContext", state);
+ rootdse, "defaultNamingContext", state);
if (state->domaindn == NULL) {
DEBUG(10, ("Could not get defaultNamingContext\n"));
status = NT_STATUS_INTERNAL_DB_CORRUPTION;
@@ -2174,7 +2173,7 @@ static NTSTATUS pdb_ads_connect(struct pdb_ads_state *state,
DEBUG(10, ("defaultNamingContext = %s\n", state->domaindn));
state->configdn = tldap_talloc_single_attribute(
- rootdse[0], "configurationNamingContext", state);
+ rootdse, "configurationNamingContext", state);
if (state->domaindn == NULL) {
DEBUG(10, ("Could not get configurationNamingContext\n"));
status = NT_STATUS_INTERNAL_DB_CORRUPTION;