svn commit: samba r7719 - in
branches/SAMBA_4_0/source/lib/ldb/ldb_ildap: .
tridge at samba.org
tridge at samba.org
Sat Jun 18 09:48:17 GMT 2005
Author: tridge
Date: 2005-06-18 09:48:17 +0000 (Sat, 18 Jun 2005)
New Revision: 7719
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=7719
Log:
make the ildap ldb backend use the defaultNamingContext if the basedn
is not specified, so:
ldbsearch ldap://hostname '(objectclass=user)'
works without knowing the domain name
Modified:
branches/SAMBA_4_0/source/lib/ldb/ldb_ildap/ldb_ildap.c
Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/ldb_ildap/ldb_ildap.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/ldb_ildap/ldb_ildap.c 2005-06-18 09:27:40 UTC (rev 7718)
+++ branches/SAMBA_4_0/source/lib/ldb/ldb_ildap/ldb_ildap.c 2005-06-18 09:48:17 UTC (rev 7719)
@@ -37,9 +37,9 @@
#include "lib/cmdline/popt_common.h"
struct ildb_private {
- const char *basedn;
struct ldap_connection *ldap;
NTSTATUS last_rc;
+ struct ldb_message *rootDSE;
};
/*
@@ -100,6 +100,8 @@
}
+static void ildb_rootdse(struct ldb_module *module);
+
/*
search for matching records
*/
@@ -116,7 +118,13 @@
}
if (base == NULL) {
- base = "";
+ if (ildb->rootDSE == NULL) {
+ ildb_rootdse(module);
+ }
+ if (ildb->rootDSE != NULL) {
+ base = ldb_msg_find_string(ildb->rootDSE,
+ "defaultNamingContext", "");
+ }
}
if (expression == NULL || expression[0] == '\0') {
@@ -352,6 +360,22 @@
/*
+ fetch the rootDSE
+*/
+static void ildb_rootdse(struct ldb_module *module)
+{
+ struct ildb_private *ildb = module->private_data;
+ struct ldb_message **res = NULL;
+ int ret;
+ ret = ildb_search(module, "", LDB_SCOPE_BASE, "dn=dc=rootDSE", NULL, &res);
+ if (ret == 1) {
+ ildb->rootDSE = talloc_steal(ildb, res[0]);
+ }
+ talloc_free(res);
+}
+
+
+/*
connect to the database
*/
int ildb_connect(struct ldb_context *ldb, const char *url,
@@ -366,6 +390,8 @@
goto failed;
}
+ ildb->rootDSE = NULL;
+
ildb->ldap = ldap_new_connection(ildb, NULL);
if (!ildb->ldap) {
ldb_oom(ldb);
More information about the samba-cvs
mailing list