Skip to content

Commit

Permalink
SYSDB: drop the code that upgrades from v < 15
Browse files Browse the repository at this point in the history
It's reasonable to expect that nobody will attempt an upgrade
from DB version older than "0.16" (sssd-1.12) to "0.25"+
  • Loading branch information
alexey-tikhonov committed Sep 4, 2024
1 parent 58e86ff commit 040c8dd
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1,585 deletions.
119 changes: 20 additions & 99 deletions src/db/sysdb_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,26 @@ static errno_t sysdb_domain_cache_upgrade(TALLOC_CTX *mem_ctx,
const char *version;
struct ldb_context *save_ldb;

if ((strcmp(cur_version, SYSDB_VERSION_0_1) == 0) ||
(strcmp(cur_version, SYSDB_VERSION_0_2) == 0) ||
(strcmp(cur_version, SYSDB_VERSION_0_3) == 0) ||
(strcmp(cur_version, SYSDB_VERSION_0_4) == 0) ||
(strcmp(cur_version, SYSDB_VERSION_0_5) == 0) ||
(strcmp(cur_version, SYSDB_VERSION_0_6) == 0) ||
(strcmp(cur_version, SYSDB_VERSION_0_7) == 0) ||
(strcmp(cur_version, SYSDB_VERSION_0_8) == 0) ||
(strcmp(cur_version, SYSDB_VERSION_0_9) == 0) ||
(strcmp(cur_version, SYSDB_VERSION_0_10) == 0) ||
(strcmp(cur_version, SYSDB_VERSION_0_11) == 0) ||
(strcmp(cur_version, SYSDB_VERSION_0_12) == 0) ||
(strcmp(cur_version, SYSDB_VERSION_0_13) == 0) ||
(strcmp(cur_version, SYSDB_VERSION_0_14) == 0) ||
(strcmp(cur_version, SYSDB_VERSION_0_15) == 0)) {
DEBUG(SSSDBG_FATAL_FAILURE,
"Cache version is way too old and must be deleted manually\n");
return EIO;
}

tmp_ctx = talloc_new(NULL);
if (tmp_ctx == NULL) {
return ENOMEM;
Expand All @@ -384,97 +404,6 @@ static errno_t sysdb_domain_cache_upgrade(TALLOC_CTX *mem_ctx,
"Upgrading DB [%s] from version: %s\n",
domain->name, version);

if (strcmp(version, SYSDB_VERSION_0_3) == 0) {
ret = sysdb_upgrade_03(sysdb, &version);
if (ret != EOK) {
goto done;
}
}

if (strcmp(version, SYSDB_VERSION_0_4) == 0) {
ret = sysdb_upgrade_04(sysdb, &version);
if (ret != EOK) {
goto done;
}
}

if (strcmp(version, SYSDB_VERSION_0_5) == 0) {
ret = sysdb_upgrade_05(sysdb, &version);
if (ret != EOK) {
goto done;
}
}

if (strcmp(version, SYSDB_VERSION_0_6) == 0) {
ret = sysdb_upgrade_06(sysdb, &version);
if (ret != EOK) {
goto done;
}
}

if (strcmp(version, SYSDB_VERSION_0_7) == 0) {
ret = sysdb_upgrade_07(sysdb, &version);
if (ret != EOK) {
goto done;
}
}

if (strcmp(version, SYSDB_VERSION_0_8) == 0) {
ret = sysdb_upgrade_08(sysdb, &version);
if (ret != EOK) {
goto done;
}
}

if (strcmp(version, SYSDB_VERSION_0_9) == 0) {
ret = sysdb_upgrade_09(sysdb, &version);
if (ret != EOK) {
goto done;
}
}

if (strcmp(version, SYSDB_VERSION_0_10) == 0) {
ret = sysdb_upgrade_10(sysdb, domain, &version);
if (ret != EOK) {
goto done;
}
}

if (strcmp(version, SYSDB_VERSION_0_11) == 0) {
ret = sysdb_upgrade_11(sysdb, domain, &version);
if (ret != EOK) {
goto done;
}
}

if (strcmp(version, SYSDB_VERSION_0_12) == 0) {
ret = sysdb_upgrade_12(sysdb, &version);
if (ret != EOK) {
goto done;
}
}

if (strcmp(version, SYSDB_VERSION_0_13) == 0) {
ret = sysdb_upgrade_13(sysdb, &version);
if (ret != EOK) {
goto done;
}
}

if (strcmp(version, SYSDB_VERSION_0_14) == 0) {
ret = sysdb_upgrade_14(sysdb, &version);
if (ret != EOK) {
goto done;
}
}

if (strcmp(version, SYSDB_VERSION_0_15) == 0) {
ret = sysdb_upgrade_15(sysdb, &version);
if (ret != EOK) {
goto done;
}
}

if (strcmp(version, SYSDB_VERSION_0_16) == 0) {
ret = sysdb_upgrade_16(sysdb, &version);
if (ret != EOK) {
Expand Down Expand Up @@ -917,14 +846,6 @@ int sysdb_init_ext(TALLOC_CTX *mem_ctx,
TALLOC_CTX *tmp_ctx;
struct sysdb_dom_upgrade_ctx *dom_upgrade_ctx;

if (upgrade_ctx != NULL) {
/* check if we have an old sssd.ldb to upgrade */
ret = sysdb_check_upgrade_02(domains, DB_PATH);
if (ret != EOK) {
return ret;
}
}

tmp_ctx = talloc_new(mem_ctx);
if (tmp_ctx == NULL) {
return ENOMEM;
Expand Down
18 changes: 0 additions & 18 deletions src/db/sysdb_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,24 +168,6 @@ int sysdb_domain_init_internal(TALLOC_CTX *mem_ctx,
struct sysdb_ctx **_ctx);

/* Upgrade routines */
int sysdb_upgrade_01(struct ldb_context *ldb, const char **ver);
int sysdb_check_upgrade_02(struct sss_domain_info *domains,
const char *db_path);
int sysdb_upgrade_03(struct sysdb_ctx *sysdb, const char **ver);
int sysdb_upgrade_04(struct sysdb_ctx *sysdb, const char **ver);
int sysdb_upgrade_05(struct sysdb_ctx *sysdb, const char **ver);
int sysdb_upgrade_06(struct sysdb_ctx *sysdb, const char **ver);
int sysdb_upgrade_07(struct sysdb_ctx *sysdb, const char **ver);
int sysdb_upgrade_08(struct sysdb_ctx *sysdb, const char **ver);
int sysdb_upgrade_09(struct sysdb_ctx *sysdb, const char **ver);
int sysdb_upgrade_10(struct sysdb_ctx *sysdb, struct sss_domain_info *domain,
const char **ver);
int sysdb_upgrade_11(struct sysdb_ctx *sysdb, struct sss_domain_info *domain,
const char **ver);
int sysdb_upgrade_12(struct sysdb_ctx *sysdb, const char **ver);
int sysdb_upgrade_13(struct sysdb_ctx *sysdb, const char **ver);
int sysdb_upgrade_14(struct sysdb_ctx *sysdb, const char **ver);
int sysdb_upgrade_15(struct sysdb_ctx *sysdb, const char **ver);
int sysdb_upgrade_16(struct sysdb_ctx *sysdb, const char **ver);
int sysdb_upgrade_17(struct sysdb_ctx *sysdb,
struct sysdb_dom_upgrade_ctx *upgrade_ctx,
Expand Down
Loading

0 comments on commit 040c8dd

Please sign in to comment.