Managing DNs in libads only in utf8
Volker Lendecke
Volker.Lendecke at SerNet.DE
Tue Feb 27 14:25:36 GMT 2007
On Tue, Feb 27, 2007 at 09:13:41AM -0500, simo wrote:
> smb_utf8_dn *utf8_dn_talloc(TALLOC_CTX *ctx, char *utf8_dn) {
>
> smb_utf8_dn *a_dn;
> int len = strlen(utf8_dn);
>
> a_dn = talloc(sizeof(smb_utf8_dn) + len + 1);
> if (a_dn == NULL) return NULL;
>
> a_dn->dn = (char *)(&a_dn[1]);
> memcopy(a_dn->dn, utf8_dn, len + 1);
>
> return a_dn;
> }
>
> Do you see any problem with this?
> We keep one allocation.
One unnecessary pointer, and I would suspect that this is
even less defined behaviour. But that's a detail.
Volker
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20070227/e5b2d773/attachment.bin
More information about the samba-technical
mailing list