summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2016-04-20 15:49:11 +0200
committerJakub Hrozek <jhrozek@redhat.com>2016-06-23 13:40:11 +0200
commite732d23f3ec986a463d757781a334040e03d1f59 (patch)
treebeae984cf17e1cdd579840299a16af816659776a
parent6e9d7cbe43fdfc866b18f9ef0779bbfc10ad6f3a (diff)
downloadsssd-e732d23f3ec986a463d757781a334040e03d1f59.tar.gz
sssd-e732d23f3ec986a463d757781a334040e03d1f59.tar.xz
sssd-e732d23f3ec986a463d757781a334040e03d1f59.zip
UTIL: Add error codes for sysdb too old or too new
We used really strange errno codes for detecting whether the database is too old or too new. We should use our sssd-specific error coded instead. Reviewed-by: Sumit Bose <sbose@redhat.com>
-rw-r--r--src/db/sysdb.h4
-rw-r--r--src/db/sysdb_init.c8
-rw-r--r--src/util/util_errors.c2
-rw-r--r--src/util/util_errors.h2
4 files changed, 10 insertions, 6 deletions
diff --git a/src/db/sysdb.h b/src/db/sysdb.h
index 6567e904f..42f845033 100644
--- a/src/db/sysdb.h
+++ b/src/db/sysdb.h
@@ -265,14 +265,14 @@
"cached credentials.\n")
#define SYSDB_VERSION_LOWER_ERROR(ret) do { \
- if (ret == EUCLEAN) { \
+ if (ret == ERR_SYSDB_VERSION_TOO_NEW) { \
ERROR("Lower version of database is expected!\n"); \
SYSDB_VERSION_ERROR_HINT; \
} \
} while(0)
#define SYSDB_VERSION_HIGHER_ERROR(ret) do { \
- if (ret == EMEDIUMTYPE) { \
+ if (ret == ERR_SYSDB_VERSION_TOO_OLD) { \
ERROR("Higher version of database is expected!\n"); \
ERROR("In order to upgrade the database, you must run SSSD.\n"); \
SYSDB_VERSION_ERROR_HINT; \
diff --git a/src/db/sysdb_init.c b/src/db/sysdb_init.c
index 76783d619..637b41a65 100644
--- a/src/db/sysdb_init.c
+++ b/src/db/sysdb_init.c
@@ -215,15 +215,15 @@ sysdb_version_check(const char *expected,
}
if (recv_major > exp_major) {
- return EUCLEAN;
+ return ERR_SYSDB_VERSION_TOO_NEW;
} else if (recv_major < exp_major) {
- return EMEDIUMTYPE;
+ return ERR_SYSDB_VERSION_TOO_OLD;
}
if (recv_minor > exp_minor) {
- return EUCLEAN;
+ return ERR_SYSDB_VERSION_TOO_NEW;
} else if (recv_minor < exp_minor) {
- return EMEDIUMTYPE;
+ return ERR_SYSDB_VERSION_TOO_OLD;
}
return EOK;
diff --git a/src/util/util_errors.c b/src/util/util_errors.c
index 3c95af82a..458321a08 100644
--- a/src/util/util_errors.c
+++ b/src/util/util_errors.c
@@ -89,6 +89,8 @@ struct err_string error_to_str[] = {
{ "Account is locked" }, /* ERR_ACCOUNT_LOCKED */
{ "AD renewal child failed" }, /* ERR_RENEWAL_CHILD */
{ "SBUS request already handled" }, /* ERR_SBUS_REQUEST_HANDLED */
+ { "Sysdb version is too old" }, /* ERR_SYSDB_VERSION_TOO_OLD */
+ { "Sysdb version is too new" }, /* ERR_SYSDB_VERSION_TOO_NEW */
{ "ERR_LAST" } /* ERR_LAST */
};
diff --git a/src/util/util_errors.h b/src/util/util_errors.h
index 066f8abf5..2f4791522 100644
--- a/src/util/util_errors.h
+++ b/src/util/util_errors.h
@@ -111,6 +111,8 @@ enum sssd_errors {
ERR_ACCOUNT_LOCKED,
ERR_RENEWAL_CHILD,
ERR_SBUS_REQUEST_HANDLED,
+ ERR_SYSDB_VERSION_TOO_OLD,
+ ERR_SYSDB_VERSION_TOO_NEW,
ERR_LAST /* ALWAYS LAST */
};