Changing the passdb interface for allocated strings and unicode

Simo Sorce idra at samba.org
Tue Jan 1 16:52:02 GMT 2002


On Wed, Jan 02, 2002 at 10:50:03AM +1100, Andrew Bartlett wrote:
> I'm looking into some changes to the passdb interface - I want firstly
> to ditch the crazy pstrings we are carting around, and then I would like
> to add a dual multibyte/ucs2 interface.
> 
> Basically my proposal is to make all the 'pdb_set_xyz()' functions
> allocate their strings.  We know that the strings's are not illegally
> modified because the pdb_get_xyz() functions all return a 'const'.

I'm with you on this, I really want to get rid by that pstring limitations,
and have all stirngs allocated.

> 
> Once I get that bedded down I would like to change all the
> 'pdb_set_xyz()' functions to allocate both a multibyte string and a
> unicode string.  This should allow us to more easily introduce unicode
> to the rest of Samba - because it will be available at all places we use
> the passdb interface.  I would add a matching 'pdb_get_xyz_w()'
> function.

Please do not allocate 2 parallel strings, it is easy to get out of sync and
it is not really needed, we only need to use ucs2 and convert back to a normal string when requested

Further as we should slowly move to ucs2 strings internally I would not create _w functions, but instead make the normal functions multibyte and provide _a function for backward compatibility, this way we encourage people to use multibyte strings in the new code.


> I realise that _w interfaces (that is, having a dual mulitbyte and ucs2
> interface) isn't highly desirable, I believe that this case is
> justified.

every case is justified it is only a matter to take the hassle to convert all the code and make compatibility function untill needed.

I will be happy to help you out with this unicode conversion after 15 of january
bye, Simo.

-- 
Simo Sorce       idra at samba.org
-------------------------------
Samba Team http://www.samba.org




More information about the samba-technical mailing list