Commit: 1169dd3b50dfefa59b56cd1897bcd0b6c2ffb3be

Kamen Mazdrashki kamen.mazdrashki at
Fri Nov 20 05:34:11 MST 2009

On Fri, Nov 20, 2009 at 12:49,  <tridge at> wrote:
> > However, could you plese consider renaming this function to something
> > like ldb_msg_add_dn_string() (ldb_msg_add_string_dn()... whatever)
> > - this way it will be obvious it adds string representation of the DN,
> > not the DN itself.
> Is it ever valid to add a DN to a ldb_message as anything other than a
> string?

I think it is not valid currently.
My point is that function name does not say exactly what it does.
ldb_msg_add_dn_string() obviously adds the DN in string format 
(at least it is obvious for me).
On the other hand, without '_string' I will need think about
what the format of the DN is actually, right?
I just want to read Samba code without peeking what every
function does internally :) (yeap, I am a bit lazy)

> > Also, not copying linearized DN string could lead to some very
> > tricky to resolve bugs. It seems replaces in ldb_map_inbound.c
> > are exactly this case - DN string is allocated in 'dn' context,
> > but the it is expected to live in 'ac->local_msg' context.
> I think you're right about this being a possible trap.
> How about we add ldb_msg_add_string_copy(), which will be like
> ldb_msg_add_string() but which uses strdup(), and make
> ldb_msg_add_dn() use that?

Sounds great and clearly shows who is the owner after the call.

Kamen Mazdrashki
kamen.mazdrashki at

More information about the samba-technical mailing list