s4:dsdb - remove some calls of "samdb_msg_add_string" when we have talloc'ed strings

Andrew Bartlett abartlet at samba.org
Sun Oct 24 14:27:37 MDT 2010


On Sun, 2010-10-24 at 22:04 +0200, Matthias Dieter Wallnöfer wrote:
> The branch, master has been updated
>        via  7b3dbbd s4:dsdb - remove some calls of "samdb_msg_add_string" when we have talloc'ed strings
>       from  177aad5 talloc: pytalloc should not depend on samba specific code
> 
> http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
> 
> 
> - Log -----------------------------------------------------------------
> commit 7b3dbbde04d52f9faeeba507b82bc4242b1efddd
> Author: Matthias Dieter Wallnöfer <mdw at samba.org>
> Date:   Thu Oct 14 22:26:44 2010 +0200
> 
>     s4:dsdb - remove some calls of "samdb_msg_add_string" when we have talloc'ed strings
>     
>     They can be substituted by "ldb_msg_add_string" if the string was already
>     talloc'ed.

Matthias,

Do you know that moving
 - ret = samdb_msg_add_string(ldb, ac->msg, ac->msg,
-                             "defaultObjectCategory",
-                             ldb_dn_get_linearized(ac->dn));
+  ret = ldb_msg_add_string(ac->msg, "defaultObjectCategory",
+                           ldb_dn_alloc_linearized(ac, ac->dn));

Doesn't really change anything?  In both cases you do a talloc_strdup(),
it's just a matter of where.  

In the rpc_server case, I think what you want is
'ldb_msg_add_steal_string()'.  This will put the string in the right
place in the talloc tree of the message.  (If you keep/repeat the
ldb_dn_alloc...() related change, then ldb_msg_add_steal_string() would
be appropriate here too). 

Of course, be careful when making these changes - to ensure that it's
right to steal these particular strings. 

Andrew Bartlett

-- 
Andrew Bartlett                                http://samba.org/~abartlet/
Authentication Developer, Samba Team           http://samba.org
Samba Developer, Cisco Inc.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20101025/76db8dac/attachment.pgp>


More information about the samba-technical mailing list