summaryrefslogtreecommitdiffstats
path: root/src/db/sysdb.h
diff options
context:
space:
mode:
authorOndrej Kos <okos@redhat.com>2012-11-08 14:34:36 +0100
committerJakub Hrozek <jhrozek@redhat.com>2012-11-19 14:02:19 +0100
commit6642637ef37258686c34f5b630d5fcba99bea3ee (patch)
tree139b6995e469e9d09c2a4f0618ff0f8172d52a7c /src/db/sysdb.h
parent05bfd452f037a60c87a25e04da51ed7bd02d6d97 (diff)
downloadsssd-6642637ef37258686c34f5b630d5fcba99bea3ee.tar.gz
sssd-6642637ef37258686c34f5b630d5fcba99bea3ee.tar.xz
sssd-6642637ef37258686c34f5b630d5fcba99bea3ee.zip
Display more information on DB version crash
https://fedorahosted.org/sssd/ticket/1589 Added check for determining, whether database version is higher or lower than expected. To distinguish it from other errors it uses following retun values (further used for appropriate error message): EMEDIUMTYPE for lower version than expected EUCLEAN for higher version than expected When SSSD or one of it's tools fails on DB version mismatch, new error message is showed suggesting how to proceed.
Diffstat (limited to 'src/db/sysdb.h')
-rw-r--r--src/db/sysdb.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/db/sysdb.h b/src/db/sysdb.h
index 39e0f9f52..c60f7e951 100644
--- a/src/db/sysdb.h
+++ b/src/db/sysdb.h
@@ -214,6 +214,36 @@
#define SYSDB_MOD_DEL LDB_FLAG_MOD_DELETE
#define SYSDB_MOD_REP LDB_FLAG_MOD_REPLACE
+/* sysdb version check macros */
+#define SYSDB_VERSION_ERROR_HINT \
+ ERROR("Removing cache files in "DB_PATH" should fix the issue, " \
+ "but note that removing cache files will also remove all of your " \
+ "cached credentials.\n")
+
+#define SYSDB_VERSION_LOWER_ERROR(ret) do { \
+ if (ret == EUCLEAN) { \
+ ERROR("Lower version of database is expected!\n"); \
+ SYSDB_VERSION_ERROR_HINT; \
+ } \
+} while(0)
+
+#define SYSDB_VERSION_HIGHER_ERROR(ret) do { \
+ if (ret == EMEDIUMTYPE) { \
+ ERROR("Higher version of database is expected!\n"); \
+ ERROR("In order to upgrade the database, you must run SSSD.\n"); \
+ SYSDB_VERSION_ERROR_HINT; \
+ } \
+} while(0)
+
+/* use this in daemons */
+#define SYSDB_VERSION_ERROR_DAEMON(ret) \
+ SYSDB_VERSION_LOWER_ERROR(ret)
+
+/* use this in tools */
+#define SYSDB_VERSION_ERROR(ret) \
+ SYSDB_VERSION_LOWER_ERROR(ret); \
+ SYSDB_VERSION_HIGHER_ERROR(ret)
+
struct confdb_ctx;
struct sysdb_ctx;