svn commit: samba r18245 - in
branches/SAMBA_4_0/source/lib/ldb/common: .
simo
idra at samba.org
Fri Sep 8 14:19:32 GMT 2006
Andrew, can you revert this?
ldb_msg_find_attr_as_dn() guarantees that basedn is talloc-ed on the ldb
context. It is completely useless to steal the whole structure and keep
all its memory around.
Simo.
On Fri, 2006-09-08 at 04:04 +0000, abartlet at samba.org wrote:
> Author: abartlet
> Date: 2006-09-08 04:04:30 +0000 (Fri, 08 Sep 2006)
> New Revision: 18245
>
> WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=18245
>
> Log:
> Ensure we don't keep the rootdse record around (steal it onto the
> correct memory context).
>
> Andrew Bartlett
>
> Modified:
> branches/SAMBA_4_0/source/lib/ldb/common/ldb.c
>
>
> Changeset:
> Modified: branches/SAMBA_4_0/source/lib/ldb/common/ldb.c
> ===================================================================
> --- branches/SAMBA_4_0/source/lib/ldb/common/ldb.c 2006-09-08 03:28:39 UTC (rev 18244)
> +++ branches/SAMBA_4_0/source/lib/ldb/common/ldb.c 2006-09-08 04:04:30 UTC (rev 18245)
> @@ -162,12 +162,14 @@
> tmp_ctx = talloc_new(ldb);
> ret = ldb_search(ldb, ldb_dn_new(tmp_ctx), LDB_SCOPE_BASE,
> "(objectClass=*)", attrs, &res);
> - if (ret == LDB_SUCCESS && res->count == 1) {
> - basedn = ldb_msg_find_attr_as_dn(ldb, res->msgs[0], "defaultNamingContext");
> + if (ret == LDB_SUCCESS) {
> + talloc_steal(tmp_ctx, res);
> + if (res->count == 1) {
> + basedn = ldb_msg_find_attr_as_dn(ldb, res->msgs[0], "defaultNamingContext");
> + ldb_set_opaque(ldb, "default_baseDN", basedn);
> + }
> }
>
> - ldb_set_opaque(ldb, "default_baseDN", basedn);
> -
> talloc_free(tmp_ctx);
> return basedn;
> }
--
Simo Sorce
Samba Team GPL Compliance Officer
email: idra at samba.org
http://samba.org
More information about the samba-cvs
mailing list