diff options
author | Michal Židek <mzidek@redhat.com> | 2015-07-07 15:15:32 +0200 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2015-09-03 09:32:15 +0200 |
commit | 175613be0cfb0890174d12d941e634d833b63dd9 (patch) | |
tree | f60beceb3b170ceca78cbb8cf7d668d3ce9aec0f /src/confdb/confdb_setup.c | |
parent | 3954cd07dae78bf79136f0854472757d1ed26897 (diff) | |
download | sssd-175613be0cfb0890174d12d941e634d833b63dd9.tar.gz sssd-175613be0cfb0890174d12d941e634d833b63dd9.tar.xz sssd-175613be0cfb0890174d12d941e634d833b63dd9.zip |
CONFDB: Assume config file version 2 if missing
Default to config file version 2 if the version
is not specified explicitly.
Ticket:
https://fedorahosted.org/sssd/ticket/2688
Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
Diffstat (limited to 'src/confdb/confdb_setup.c')
-rw-r--r-- | src/confdb/confdb_setup.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/src/confdb/confdb_setup.c b/src/confdb/confdb_setup.c index 93a1a1b53..694a7f016 100644 --- a/src/confdb/confdb_setup.c +++ b/src/confdb/confdb_setup.c @@ -224,30 +224,30 @@ int confdb_init_db(const char *config_file, struct confdb_ctx *cdb) ret = sss_ini_check_config_obj(init_data); if (ret != EOK) { - /* No known version. Assumed to be version 1 */ - DEBUG(SSSDBG_FATAL_FAILURE, - "Config file is an old version. " - "Please run configuration upgrade script.\n"); - ret = EINVAL; - goto done; - } - - version = sss_ini_get_int_config_value(init_data, 1, -1, &ret); - if (ret != EOK) { - DEBUG(SSSDBG_FATAL_FAILURE, - "Config file version could not be determined\n"); - goto done; - } else if (version < CONFDB_VERSION_INT) { - DEBUG(SSSDBG_FATAL_FAILURE, - "Config file is an old version. " - "Please run configuration upgrade script.\n"); - ret = EINVAL; - goto done; - } else if (version > CONFDB_VERSION_INT) { - DEBUG(SSSDBG_FATAL_FAILURE, - "Config file version is newer than confdb\n"); - ret = EINVAL; - goto done; + /* No known version. Use default. */ + DEBUG(SSSDBG_CONF_SETTINGS, + "Value of config_file_version option not found. " + "Assumed to be version %d.\n", CONFDB_DEFAULT_CFG_FILE_VER); + } else { + version = sss_ini_get_int_config_value(init_data, + CONFDB_DEFAULT_CFG_FILE_VER, + -1, &ret); + if (ret != EOK) { + DEBUG(SSSDBG_FATAL_FAILURE, + "Config file version could not be determined\n"); + goto done; + } else if (version < CONFDB_VERSION_INT) { + DEBUG(SSSDBG_FATAL_FAILURE, + "Config file is an old version. " + "Please run configuration upgrade script.\n"); + ret = EINVAL; + goto done; + } else if (version > CONFDB_VERSION_INT) { + DEBUG(SSSDBG_FATAL_FAILURE, + "Config file version is newer than confdb\n"); + ret = EINVAL; + goto done; + } } /* Set up a transaction to replace the configuration */ |