From 8f42f1292c2f1f1002b8446dc8b5351eb633d5ce Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 14 Aug 2006 00:59:57 +0000 Subject: r17526: Move timestamp generation into the objectGUID module. It probably needs to be renamed (operation_add?). This allows me to match the behaviour and substitute with the entryUUID module for remote LDAP connections. Andrew Bartlett (This used to be commit af02b4d7c631bb15bf5a5f73f9fdc23075d50f60) --- source4/lib/ldb/modules/operational.c | 41 ----------------------------------- 1 file changed, 41 deletions(-) (limited to 'source4/lib/ldb/modules/operational.c') diff --git a/source4/lib/ldb/modules/operational.c b/source4/lib/ldb/modules/operational.c index 934622eccd..b14d552e83 100644 --- a/source4/lib/ldb/modules/operational.c +++ b/source4/lib/ldb/modules/operational.c @@ -169,35 +169,6 @@ failed: return -1; } -/* - add a time element to a record -*/ -static int add_time_element(struct ldb_message *msg, const char *attr, time_t t) -{ - struct ldb_message_element *el; - char *s; - - if (ldb_msg_find_element(msg, attr) != NULL) { - return 0; - } - - s = ldb_timestring(msg, t); - if (s == NULL) { - return -1; - } - - if (ldb_msg_add_string(msg, attr, s) != 0) { - return -1; - } - - el = ldb_msg_find_element(msg, attr); - /* always set as replace. This works because on add ops, the flag - is ignored */ - el->flags = LDB_FLAG_MOD_REPLACE; - - return 0; -} - /* add a uint64_t element to a record */ @@ -348,7 +319,6 @@ static int operational_add(struct ldb_module *module, struct ldb_request *req) { struct ldb_request *down_req; struct ldb_message *msg; - time_t t = time(NULL); uint64_t seq_num; int ret; @@ -368,11 +338,6 @@ static int operational_add(struct ldb_module *module, struct ldb_request *req) if (msg == NULL) { return LDB_ERR_OPERATIONS_ERROR; } - if (add_time_element(msg, "whenCreated", t) != 0 || - add_time_element(msg, "whenChanged", t) != 0) { - talloc_free(down_req); - return LDB_ERR_OPERATIONS_ERROR; - } /* Get a sequence number from the backend */ ret = ldb_sequence_number(module->ldb, &seq_num); @@ -405,7 +370,6 @@ static int operational_modify(struct ldb_module *module, struct ldb_request *req { struct ldb_request *down_req; struct ldb_message *msg; - time_t t = time(NULL); uint64_t seq_num; int ret; @@ -425,11 +389,6 @@ static int operational_modify(struct ldb_module *module, struct ldb_request *req if (msg == NULL) { return LDB_ERR_OPERATIONS_ERROR; } - if (add_time_element(msg, "whenChanged", t) != 0) { - talloc_free(down_req); - return LDB_ERR_OPERATIONS_ERROR; - } - /* Get a sequence number from the backend */ ret = ldb_sequence_number(module->ldb, &seq_num); if (ret == LDB_SUCCESS) { -- cgit