[SSSD] [PATCH] Always update sysdb to the latest version

Sumit Bose sbose at redhat.com
Wed Dec 9 17:21:35 UTC 2009


Hi,

this is a quick fix for #285 by calling sysdb_upgrade_03() after
sysdb_upgrade_02() is done. I'm thinking of refactoring all the upgrade
calls into one function which can be called multiple time from different
places of the code, but for the time being I think the patch is
sufficient.

bye,
Sumit
-------------- next part --------------
>From 104a092b42500cdb0f67cef0c3cd9b0f2a5a44e8 Mon Sep 17 00:00:00 2001
From: Sumit Bose <sbose at redhat.com>
Date: Wed, 9 Dec 2009 13:45:43 +0100
Subject: [PATCH] Always update sysdb to the latest version

---
 server/db/sysdb.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/server/db/sysdb.c b/server/db/sysdb.c
index 979acf8..bd3acc6 100644
--- a/server/db/sysdb.c
+++ b/server/db/sysdb.c
@@ -1568,6 +1568,7 @@ int sysdb_init(TALLOC_CTX *mem_ctx,
     struct sss_domain_info *domains, *dom;
     struct sysdb_ctx *ctx;
     bool upgrade_02 = false;
+    const char *version = NULL;
     int ret;
 
     if (!ev) return EINVAL;
@@ -1636,13 +1637,20 @@ int sysdb_init(TALLOC_CTX *mem_ctx,
 
         ret = sysdb_upgrade_02(cdb, ev, ctx, ctx_list);
         if (ret != EOK) {
-            DEBUG(0, ("FATAL: Upgrade form db version %d failed!\n",
+            DEBUG(0, ("FATAL: Upgrade form db version %s failed!\n",
                       SYSDB_VERSION_0_2));
-            DEBUG(0, ("You can find a backup of the database here: %s\n",
-                      backup_file));
+            DEBUG(0, ("You may find a backup of the database here: %s\n",
+                      DB_PATH));
             talloc_zfree(ctx_list);
             return ret;
         }
+        ret = sysdb_upgrade_03(ctx, &version);
+        if (ret != EOK) {
+            DEBUG(0, ("FATAL: Upgrade form db version %d failed!\n",
+                      SYSDB_VERSION_0_3));
+            talloc_zfree(ctx_list);
+            return ret;
+        };
     }
 
     *_ctx_list = ctx_list;
-- 
1.6.5.2



More information about the sssd-devel mailing list