TALLOC_CTX to ldb_search()?
tridge at samba.org
tridge at samba.org
Mon Dec 4 06:24:04 GMT 2006
Volker,
> To me this looks a bit unnatural and error-prone. Having an
> explicit mem_ctx makes it easier to hook it to a
> procedure-local temporary ctx and have it automatically
> freed.
If we'd been designing it now, I would have chosen to have a mem_ctx
argument. The question really is whether it's worth changing it now.
One option is to leave the current function, and add a new one which
also gives us a printf style argument for the expression. The most
common pattern of usage seems to be like this:
expr = talloc_asprintf(ldb, "(&(gidNumber=%u)(objectClass=groupMap))",
(unsigned)gid);
if (expr == NULL) goto failed;
ret = ldb_search(ldb, NULL, LDB_SCOPE_SUBTREE, expr, NULL, &res);
talloc_steal(expr, res);
if we had a varargs printf style argument to a function like
ldb_search which also put the result on a specified talloc context
then this would become one function, and I think that would be the
most friendly for programmers.
But what to call the function?? :-)
Cheers, Tridge
More information about the samba-technical
mailing list