#include "librpc/gen_ndr/ndr_misc.h"
#include "librpc/ndr/libndr.h"
#include "dsdb/samdb/samdb.h"
+#include "dsdb/common/util.h"
#include <ldb_handlers.h>
struct entryuuid_private {
struct ldb_context *ldb;
int ret;
struct map_private *map_private;
- struct entryuuid_private *entryuuid_private;
unsigned long long seq_num = 0;
struct ldb_request *search_req;
map_private = talloc_get_type(ldb_module_get_private(module), struct map_private);
- entryuuid_private = talloc_get_type(map_private->caller_private, struct entryuuid_private);
-
/* All this to get the DN of the parition, so we can search the right thing */
partition_ctrl = ldb_request_get_control(req, DSDB_CONTROL_CURRENT_PARTITION_OID);
if (!partition_ctrl) {
ldb_debug_set(ldb, LDB_DEBUG_FATAL,
- "entryuuid_sequence_number: no current partition control found");
- return LDB_ERR_CONSTRAINT_VIOLATION;
+ "entryuuid_sequence_number: no current partition control found!");
+ return LDB_ERR_PROTOCOL_ERROR;
}
partition = talloc_get_type(partition_ctrl->data,
struct dsdb_control_current_partition);
- SMB_ASSERT(partition && partition->version == DSDB_CONTROL_CURRENT_PARTITION_VERSION);
+ if ((partition == NULL) || (partition->version != DSDB_CONTROL_CURRENT_PARTITION_VERSION)) {
+ ldb_debug_set(ldb, LDB_DEBUG_FATAL,
+ "entryuuid_sequence_number: current partition control with wrong data!");
+ return LDB_ERR_PROTOCOL_ERROR;
+ }
ret = ldb_build_search_req(&search_req, ldb, req,
partition->dn, LDB_SCOPE_BASE,
seqr->seq_num++;
break;
case LDB_SEQ_HIGHEST_TIMESTAMP:
- {
- seqr->seq_num = (seq_num >> 24);
- break;
- }
+ return ldb_module_error(module, LDB_ERR_OPERATIONS_ERROR, "LDB_SEQ_HIGHEST_TIMESTAMP not supported");
}
+
seqr->flags = 0;
- seqr->flags |= LDB_SEQ_TIMESTAMP_SEQUENCE;
seqr->flags |= LDB_SEQ_GLOBAL_SEQUENCE;
/* send request done */