TDB signed vs. unsigned char (was Re: [SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-554-gf942cb6)

Jeremy Allison jra at samba.org
Wed Apr 1 15:55:48 GMT 2009


On Wed, Apr 01, 2009 at 12:39:28PM +0200, Stefan (metze) Metzmacher wrote:
> Hi Jeremy,
> 
> > commit f942cb616e981e5370fab122969127de0910b58b
> > Author: Jeremy Allison <jra at samba.org>
> > Date:   Wed Mar 18 15:44:13 2009 -0700
> > 
> >     Fix bug #6195 - Migrating from 3.0.x to 3.3.x can fail to update passdb.tdb correctly.
> >     This is a really nasty one to fix as in order to successfully update the
> >     passdb.tdb we must do the equivalent of a tdbbackup to move to the new hash
> >     values before we do the upgrade.
> >     Jeremy.
> 
> Sorry, that I "introducted" the change that triggers with problems...

No problem, everyone makes mistakes (as we have seen today :-).

> But it shows once again that we really need to use 'uint8_t *' instead
> of 'char *' to represent raw bytes! As the same problem is there,
> if we copy passdb.tdb from a machine where char is signed to a machine
> were char is unsigned, while using exactly the same source on both machines.
> 
> So we should really try to get rid of all 'char *buf' pointers we have,

Yeah, we should start cleaning up the code here (much of which
is extremely old of course :-).

> but as the above example shows we need to be extremly careful and add
> explicit cast in the right spots in order to avoid upgrade problems.

It's too late for that cast now, there were existing databases out there.
(I did think about doing that, but we couldn't get away with it).

Jeremy.


More information about the samba-cvs mailing list