diff options
Diffstat (limited to 'src/db')
-rw-r--r-- | src/db/sysdb_gpo.c | 4 | ||||
-rw-r--r-- | src/db/sysdb_init.c | 7 | ||||
-rw-r--r-- | src/db/sysdb_ops.c | 2 | ||||
-rw-r--r-- | src/db/sysdb_private.h | 5 | ||||
-rw-r--r-- | src/db/sysdb_upgrade.c | 56 |
5 files changed, 70 insertions, 4 deletions
diff --git a/src/db/sysdb_gpo.c b/src/db/sysdb_gpo.c index e5af91b..93d6517 100644 --- a/src/db/sysdb_gpo.c +++ b/src/db/sysdb_gpo.c @@ -154,7 +154,7 @@ sysdb_gpo_store_gpo(struct sss_domain_info *domain, goto done; } - lret = ldb_msg_add_fmt(update_msg, SYSDB_GPO_TIMEOUT_ATTR, "%lu", + lret = ldb_msg_add_fmt(update_msg, SYSDB_GPO_TIMEOUT_ATTR, "%"SPRItime, ((cache_timeout) ? (now + cache_timeout) : 0)); if (lret != LDB_SUCCESS) { ret = sysdb_error_to_errno(lret); @@ -198,7 +198,7 @@ sysdb_gpo_store_gpo(struct sss_domain_info *domain, goto done; } - lret = ldb_msg_add_fmt(update_msg, SYSDB_GPO_TIMEOUT_ATTR, "%lu", + lret = ldb_msg_add_fmt(update_msg, SYSDB_GPO_TIMEOUT_ATTR, "%"SPRItime, ((cache_timeout) ? (now + cache_timeout) : 0)); if (lret != LDB_SUCCESS) { ret = sysdb_error_to_errno(lret); diff --git a/src/db/sysdb_init.c b/src/db/sysdb_init.c index c2ea6c3..38a9cd6 100644 --- a/src/db/sysdb_init.c +++ b/src/db/sysdb_init.c @@ -603,6 +603,13 @@ static errno_t sysdb_domain_cache_upgrade(TALLOC_CTX *mem_ctx, } } + if (strcmp(version, SYSDB_VERSION_0_23) == 0) { + ret = sysdb_upgrade_23(sysdb, &version); + if (ret != EOK) { + goto done; + } + } + ret = EOK; done: sysdb->ldb = save_ldb; diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c index 3331d46..0f62e3b 100644 --- a/src/db/sysdb_ops.c +++ b/src/db/sysdb_ops.c @@ -5741,7 +5741,7 @@ errno_t sysdb_ldb_list_indexes(TALLOC_CTX *mem_ctx, indexes = talloc_realloc(mem_ctx, indexes, const char *, j + 2); if (indexes == NULL) ERROR_OUT(ret, ENOMEM, done); - indexes[j] = talloc_asprintf(indexes, "%*s", length, data); + indexes[j] = talloc_asprintf(indexes, "%.*s", length, data); if (indexes[j] == NULL) ERROR_OUT(ret, ENOMEM, done); indexes[++j] = NULL; diff --git a/src/db/sysdb_private.h b/src/db/sysdb_private.h index 1f55007..63f7b56 100644 --- a/src/db/sysdb_private.h +++ b/src/db/sysdb_private.h @@ -23,6 +23,7 @@ #ifndef __INT_SYS_DB_H__ #define __INT_SYS_DB_H__ +#define SYSDB_VERSION_0_24 "0.24" #define SYSDB_VERSION_0_23 "0.23" #define SYSDB_VERSION_0_22 "0.22" #define SYSDB_VERSION_0_21 "0.21" @@ -47,7 +48,7 @@ #define SYSDB_VERSION_0_2 "0.2" #define SYSDB_VERSION_0_1 "0.1" -#define SYSDB_VERSION SYSDB_VERSION_0_23 +#define SYSDB_VERSION SYSDB_VERSION_0_24 #define SYSDB_BASE_LDIF \ "dn: @ATTRIBUTES\n" \ @@ -60,6 +61,7 @@ "objectclass: CASE_INSENSITIVE\n" \ "ipHostNumber: CASE_INSENSITIVE\n" \ "ipNetworkNumber: CASE_INSENSITIVE\n" \ + "mail: CASE_INSENSITIVE\n" \ "\n" \ "dn: @INDEXLIST\n" \ "@IDXATTR: cn\n" \ @@ -191,6 +193,7 @@ int sysdb_upgrade_19(struct sysdb_ctx *sysdb, const char **ver); int sysdb_upgrade_20(struct sysdb_ctx *sysdb, const char **ver); int sysdb_upgrade_21(struct sysdb_ctx *sysdb, const char **ver); int sysdb_upgrade_22(struct sysdb_ctx *sysdb, const char **ver); +int sysdb_upgrade_23(struct sysdb_ctx *sysdb, const char **ver); int sysdb_ts_upgrade_01(struct sysdb_ctx *sysdb, const char **ver); diff --git a/src/db/sysdb_upgrade.c b/src/db/sysdb_upgrade.c index 346a1cb..56083e6 100644 --- a/src/db/sysdb_upgrade.c +++ b/src/db/sysdb_upgrade.c @@ -2718,6 +2718,62 @@ done: return ret; } +int sysdb_upgrade_23(struct sysdb_ctx *sysdb, const char **ver) +{ + TALLOC_CTX *tmp_ctx; + int ret; + struct ldb_message *msg; + struct upgrade_ctx *ctx; + + tmp_ctx = talloc_new(NULL); + if (!tmp_ctx) { + return ENOMEM; + } + + ret = commence_upgrade(sysdb, sysdb->ldb, SYSDB_VERSION_0_24, &ctx); + if (ret) { + return ret; + } + + /* Add new indexes */ + msg = ldb_msg_new(tmp_ctx); + if (!msg) { + ret = ENOMEM; + goto done; + } + msg->dn = ldb_dn_new(tmp_ctx, sysdb->ldb, "@ATTRIBUTES"); + if (!msg->dn) { + ret = ENOMEM; + goto done; + } + + /* Case insensitive search for mail */ + ret = ldb_msg_add_empty(msg, SYSDB_USER_EMAIL, LDB_FLAG_MOD_ADD, NULL); + if (ret != LDB_SUCCESS) { + ret = ENOMEM; + goto done; + } + ret = ldb_msg_add_string(msg, SYSDB_USER_EMAIL, "CASE_INSENSITIVE"); + if (ret != LDB_SUCCESS) { + ret = ENOMEM; + goto done; + } + + ret = ldb_modify(sysdb->ldb, msg); + if (ret != LDB_SUCCESS) { + ret = sysdb_error_to_errno(ret); + goto done; + } + + /* conversion done, update version number */ + ret = update_version(ctx); + +done: + ret = finish_upgrade(ret, &ctx, ver); + talloc_free(tmp_ctx); + return ret; +} + int sysdb_ts_upgrade_01(struct sysdb_ctx *sysdb, const char **ver) { struct upgrade_ctx *ctx; |