LDB base DN semantics
Andrew Bartlett
abartlet at samba.org
Thu Jul 5 03:50:21 GMT 2007
In the naming_fsmo module, we do a base search for
cn=partitions,cn=configuration,dc=.....
This often fails before the DB is fully set up, so the code there allows
for 0 returned values, and continues.
However, when Samba4 is backed against LDAP, the error return is
different - NO_SUCH_OBJECT, as the base DN does not exist. Shouldn't
LDB's tdb backend also return this?
I had to use this patch to allow naming_fsmo to cope with both cases:
Modified: branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/naming_fsmo.c
===================================================================
---
branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/naming_fsmo.c 2007-07-05 02:52:58 UTC (rev 23717)
+++
branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/naming_fsmo.c 2007-07-05 03:06:59 UTC (rev 23718)
@@ -69,10 +69,16 @@
LDB_SCOPE_BASE,
NULL, naming_attrs,
&naming_res);
+ if (ret == LDB_ERR_NO_SUCH_OBJECT) {
+ ldb_debug(module->ldb, LDB_DEBUG_WARNING,
+ "naming_fsmo_init: no partitions dn present:
(skip loading of naming contexts details)\n");
+ talloc_free(mem_ctx);
+ return ldb_next_init(module);
+ }
if (ret != LDB_SUCCESS) {
ldb_debug_set(module->ldb, LDB_DEBUG_FATAL,
- "naming_fsmo_init: failed to search the
cross-ref container: %d:%s\n",
- ret, ldb_strerror(ret));
+ "naming_fsmo_init: failed to search the
cross-ref container: %s: %s\n",
+ ldb_strerror(ret),
ldb_errstring(module->ldb));
talloc_free(mem_ctx);
return ret;
}
--
Andrew Bartlett http://samba.org/~abartlet/
Authentication Developer, Samba Team http://samba.org
Samba Developer, Red Hat Inc. http://redhat.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.samba.org/archive/samba-technical/attachments/20070705/efec79a5/attachment.bin
More information about the samba-technical
mailing list