From 1933214108d1a71bc6473a696ce35020a427d8f4 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 18 Jan 2010 17:26:04 +0100 Subject: [PATCH] s3:dbwrap_ctdb: fix reading/storing of special key __db_sequence_number__ The key for reading and writing was inconsistent due to a off by one data length. Michael --- source3/lib/dbwrap_ctdb.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/source3/lib/dbwrap_ctdb.c b/source3/lib/dbwrap_ctdb.c index 79c4c0ce420..ddc886864be 100644 --- a/source3/lib/dbwrap_ctdb.c +++ b/source3/lib/dbwrap_ctdb.c @@ -688,8 +688,7 @@ static NTSTATUS db_ctdb_fetch_db_seqnum_from_db(struct db_ctdb_ctx *db, return NT_STATUS_INVALID_PARAMETER; } - key.dptr = (uint8_t *)discard_const(keyname); - key.dsize = strlen(keyname) + 1; + key = string_term_tdb_data(keyname); status = db_ctdb_ltdb_fetch(db, key, &header, mem_ctx, &data); if (!NT_STATUS_IS_OK(status) && @@ -723,8 +722,7 @@ static NTSTATUS db_ctdb_store_db_seqnum(struct db_ctdb_transaction_handle *h, TDB_DATA key; TDB_DATA data; - key.dptr = (uint8_t *)discard_const(keyname); - key.dsize = strlen(keyname); + key = string_term_tdb_data(keyname); data.dptr = (uint8_t *)&seqnum; data.dsize = sizeof(uint64_t); -- 2.11.4.GIT