tdbsam serious problem when migrating from 3.0.32 to 3.3.2

Jeremy Allison jra at samba.org
Tue Mar 17 20:26:07 GMT 2009


On Tue, Mar 17, 2009 at 03:58:16PM +0300, Alexander Zagrebin wrote:
> I have tried to migrate from samba version 3.0.32 to 3.3.2 and found
> the serious problem: samba can't convert my passdb.tdb from version 3 to
> version 4.
> 
> For example, when running "pdbedit -L" I receive:
> 
> # pdbedit -L
> tdbsam_open: Converting version 3 database to version 4.
> Could not store the new record: NT_STATUS_UNSUCCESSFUL
> Converting records failed
> tdbsam_open: Error when trying to convert tdbsam
> [/usr/local/etc/samba/passdb.tdb]
> tdbsam_getsampwnam: failed to open /usr/local/etc/samba/passdb.tdb!
> Could not start searching users
> Segmentation fault (core dumped)
> 
> With debugging (-d5) the output contains:
> ...
> Finding user ????
> Trying _Get_Pwnam(), username as lowercase is ????
> Get_Pwnam_internals did find user [????]!
> Could not store the new record: NT_STATUS_UNSUCCESSFUL
> Converting records failed
> ...
> 
> This problem exists only for user names, containing characters with codes
> from
> range 128...255 (with high bit set).
> After doing some debugging, I have found that:
> 
> 1. Possible the "break" is missed at source/passdb/pdb_tdb.c:
> 
> --- source/passdb/pdb_tdb.c.orig        2009-02-24 10:38:16.000000000 +0300
> +++ source/passdb/pdb_tdb.c             2009-03-14 23:47:41.000000000 +0300
> @@ -102,6 +102,7 @@
>                 ret = init_samu_from_buffer(user, SAMU_BUFFER_V3,
>                                             (uint8 *)rec->value.dptr,
>                                             rec->value.dsize);
> +               break;

Yes, that's definately a bug - thanks ! I'll fix that asap and in
all branches.

>         case 4:
>                 ret = init_samu_from_buffer(user, SAMU_BUFFER_V4,
>                                             (uint8 *)rec->value.dptr,
> 
> 2. The reason of the above described problem is in default_tdb_hash
> (source/lib/tdb/common/open.c)
> This function returns different results on 3.0.* and 3.3.* for same data,
> containing non-ascii
> characters. The code is the same, but definition of TDB_DATA
> (source/lib/tdb/include/tdb.h)
> was changed. Early the TDB_DATA.dptr was signed, but now it is unsigned. So
> the hash calculation
> makes a different result now and pdbedit can't store the new (upgraded)
> record.

Hmmm. Good catch. I'll investigate this. We need the updates to be
flawless.

Jeremy.


More information about the samba-technical mailing list