Commit: 1169dd3b50dfefa59b56cd1897bcd0b6c2ffb3be

tridge at tridge at
Fri Nov 20 18:04:35 MST 2009

Hi Cristian,

 > I noticed there is a *steal* function for almost every *add* function at
 > ldb_msg.c. is that related to this discussion? I mean, should I have created
 > the function ldb_msg_add_steal_dn specifying a memory context to the DN
 > string?

not for a struct ldb_dn, no. The ldb_dn struct contains a private
'linearized' string pointer that is a child of the ldb_dn. For a
ldb_dn structure to remain valid, it needs to keep that pointer, so it
isn't appropriate to steal it away. 

I think a copy is appropriate in most cases, except where the caller
knows the lifetime of the ldb_dn structure is at least as long as the
ldb_message. In that case copying the pointer is fine.

Cheers, Tridge

More information about the samba-technical mailing list