diff options
author | Simo Sorce <idra@samba.org> | 2005-01-03 08:59:00 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:08:16 -0500 |
commit | 8164d2442868a2e8353ee2ae3d61f78aa9ccb226 (patch) | |
tree | 83b8f7ab8c65c7152435198f0c8d4b2358f5e2be /source4/lib/ldb | |
parent | ab4e92ab21887430774fda380ccbb14a10cab2da (diff) | |
download | samba-8164d2442868a2e8353ee2ae3d61f78aa9ccb226.tar.gz samba-8164d2442868a2e8353ee2ae3d61f78aa9ccb226.tar.bz2 samba-8164d2442868a2e8353ee2ae3d61f78aa9ccb226.zip |
r4503: add an error reporting function (fixes)
(This used to be commit d11732f4f7f9bc535222aa7a6dd2f15cf5002a4d)
Diffstat (limited to 'source4/lib/ldb')
-rw-r--r-- | source4/lib/ldb/modules/timestamps.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/source4/lib/ldb/modules/timestamps.c b/source4/lib/ldb/modules/timestamps.c index 95a2ddc88e..719aed19ba 100644 --- a/source4/lib/ldb/modules/timestamps.c +++ b/source4/lib/ldb/modules/timestamps.c @@ -37,6 +37,10 @@ #include "ldb/include/ldb_private.h" #include <time.h> +struct private_data { + const char *error_string; +}; + static int timestamps_close(struct ldb_module *module) { ldb_debug(module->ldb, LDB_DEBUG_TRACE, "timestamps_close\n"); @@ -57,9 +61,10 @@ static int timestamps_search_free(struct ldb_module *module, struct ldb_message return ldb_next_search_free(module, res); } -static int add_time_element(struct ldb_context *ldb, struct ldb_message *msg, +static int add_time_element(struct ldb_module *module, struct ldb_message *msg, const char *attr_name, const char *time_string, unsigned int flags) { + struct private_data *data = (struct private_data *)module->private_data; struct ldb_val *values; char *name, *timestr; int i; @@ -94,6 +99,7 @@ static int add_time_element(struct ldb_context *ldb, struct ldb_message *msg, /* add_record: add crateTimestamp/modifyTimestamp attributes */ static int timestamps_add_record(struct ldb_module *module, const struct ldb_message *msg) { + struct private_data *data = (struct private_data *)module->private_data; struct ldb_message *msg2 = NULL; struct tm *tm; char *timestr; @@ -131,10 +137,10 @@ static int timestamps_add_record(struct ldb_module *module, const struct ldb_mes msg2->elements[i] = msg->elements[i]; } - add_time_element(module->ldb, msg2, "createTimestamp", timestr, LDB_FLAG_MOD_ADD); - add_time_element(module->ldb, msg2, "modifyTimestamp", timestr, LDB_FLAG_MOD_ADD); - add_time_element(module->ldb, msg2, "whenCreated", timestr, LDB_FLAG_MOD_ADD); - add_time_element(module->ldb, msg2, "whenChanged", timestr, LDB_FLAG_MOD_ADD); + add_time_element(module, msg2, "createTimestamp", timestr, LDB_FLAG_MOD_ADD); + add_time_element(module, msg2, "modifyTimestamp", timestr, LDB_FLAG_MOD_ADD); + add_time_element(module, msg2, "whenCreated", timestr, LDB_FLAG_MOD_ADD); + add_time_element(module, msg2, "whenChanged", timestr, LDB_FLAG_MOD_ADD); } if (msg2) { @@ -150,6 +156,7 @@ static int timestamps_add_record(struct ldb_module *module, const struct ldb_mes /* modify_record: change modifyTimestamp as well */ static int timestamps_modify_record(struct ldb_module *module, const struct ldb_message *msg) { + struct private_data *data = (struct private_data *)module->private_data; struct ldb_message *msg2 = NULL; struct tm *tm; char *timestr; @@ -188,8 +195,8 @@ static int timestamps_modify_record(struct ldb_module *module, const struct ldb_ msg2->elements[i] = msg->elements[i]; } - add_time_element(module->ldb, msg2, "modifyTimestamp", timestr, LDB_FLAG_MOD_REPLACE); - add_time_element(module->ldb, msg2, "whenChanged", timestr, LDB_FLAG_MOD_REPLACE); + add_time_element(module, msg2, "modifyTimestamp", timestr, LDB_FLAG_MOD_REPLACE); + add_time_element(module, msg2, "whenChanged", timestr, LDB_FLAG_MOD_REPLACE); } if (msg2) { @@ -229,9 +236,11 @@ static int timestamps_unlock(struct ldb_module *module, const char *lockname) /* return extended error information */ static const char *timestamps_errstring(struct ldb_module *module) { + struct private_data *data = (struct private_data *)module->private_data; + ldb_debug(module->ldb, LDB_DEBUG_TRACE, "timestamps_errstring\n"); if (data->error_string) { - char *error; + const char *error; error = data->error_string; data->error_string = NULL; |