diff options
author | Björn Baumbach <bb@sernet.de> | 2011-11-02 13:40:36 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2011-11-03 10:13:41 +0100 |
commit | 66eefde53b68b0665557095158411c89d44a1934 (patch) | |
tree | 174281dd190852b6897110ded0bd157d1c42405e /source3 | |
parent | bdc973b5db871ec9a9db3a16eea72f62e9ff6e64 (diff) | |
download | samba-66eefde53b68b0665557095158411c89d44a1934.tar.gz samba-66eefde53b68b0665557095158411c89d44a1934.tar.bz2 samba-66eefde53b68b0665557095158411c89d44a1934.zip |
s3-registry: fix upgrade code
Assume REGDB_VERSION_V1 if no version key found in registry.tdb
Signed-off-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'source3')
-rw-r--r-- | source3/registry/reg_backend_db.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/source3/registry/reg_backend_db.c b/source3/registry/reg_backend_db.c index fad6c08b5e..7fa6249cec 100644 --- a/source3/registry/reg_backend_db.c +++ b/source3/registry/reg_backend_db.c @@ -667,10 +667,24 @@ WERROR regdb_init(void) if (!NT_STATUS_IS_OK(status)) { DEBUG(10, ("regdb_init: registry version uninitialized " "(got %d), initializing to version %d\n", - vers_id, REGDB_CODE_VERSION)); - - werr = regdb_store_regdb_version(regdb, REGDB_CODE_VERSION); - return werr; + vers_id, REGDB_VERSION_V1)); + + /* + * There was a regdb format version prior to version 1 + * which did not store a INFO/version key. The format + * of this version was identical to version 1 except for + * the lack of the sorted subkey cache records. + * Since these are disposable, we can safely assume version + * 1 if no INFO/version key is found and run the db through + * the whole chain of upgrade. If the database was not + * initialized, this does not harm. If it was the unversioned + * version ("0"), then it do the right thing with the records. + */ + werr = regdb_store_regdb_version(regdb, REGDB_VERSION_V1); + if (!W_ERROR_IS_OK(werr)) { + return werr; + } + vers_id = REGDB_VERSION_V1; } if (vers_id > REGDB_CODE_VERSION || vers_id == 0) { |