From: Stefan Metzmacher Date: Wed, 5 Aug 2026 20:01:13 +0000 (+0200) Subject: s3:open_files.idl: use SHARE_MODE_DATA_VERSION_1 and VFS_DEFAULT_DURABLE_COOKIE_VERSI... X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=84ef0d2b6ae28a26a272d456f44a2da3f085fee0;p=thirdparty%2Fsamba.git s3:open_files.idl: use SHARE_MODE_DATA_VERSION_1 and VFS_DEFAULT_DURABLE_COOKIE_VERSION = 1 4.25 changed the formats, so bump the version. This gives us a way to autodetect old formats easier in case cluster upgrades from older versions is implemented in future. Signed-off-by: Stefan Metzmacher Reviewed-by: Ralph Boehme --- diff --git a/source3/librpc/idl/open_files.idl b/source3/librpc/idl/open_files.idl index 7000325bc68..596c8f61a96 100644 --- a/source3/librpc/idl/open_files.idl +++ b/source3/librpc/idl/open_files.idl @@ -5,7 +5,6 @@ import "security.idl"; import "file_id.idl"; import "smb2_lease_struct.idl"; import "misc.idl"; -import "smbXsrv.idl"; [ pointer_default(unique) @@ -39,7 +38,7 @@ interface open_files smb2_lease_key lease_key; uint32 access_mask; uint32 share_access; - timeval_legacy time; + timeval time; udlong share_file_id; uint32 uid; share_entry_flags flags; @@ -92,13 +91,17 @@ interface open_files [ignore] file_id id; /* In memory key used to lookup cache. */ } share_mode_data; + typedef [public, v1_enum] enum { + SHARE_MODE_DATA_VERSION_1 = 0x00000001 + } share_mode_data_version; + typedef union { - [case(0)] share_mode_data *data0; - [default] hyper *dummy; + [case(SHARE_MODE_DATA_VERSION_1),ref] share_mode_data *data1; + [default] ; } share_mode_dataU; typedef [public] struct { - smbXsrv_version_values version; + share_mode_data_version version; hyper unique_content_epoch; share_mode_flags flags; [switch_is(version)] share_mode_dataU data; @@ -107,7 +110,7 @@ interface open_files /* these are 0x30 (48) characters */ const string VFS_DEFAULT_DURABLE_COOKIE_MAGIC = "VFS_DEFAULT_DURABLE_COOKIE_MAGIC "; - const uint32 VFS_DEFAULT_DURABLE_COOKIE_VERSION = 0; + const uint32 VFS_DEFAULT_DURABLE_COOKIE_VERSION = 1; /* this corresponds to struct stat_ex (SMB_STRUCT_STAT) */ typedef struct { @@ -119,10 +122,10 @@ interface open_files hyper st_ex_gid; hyper st_ex_rdev; hyper st_ex_size; - timespec_legacy st_ex_atime; - timespec_legacy st_ex_mtime; - timespec_legacy st_ex_ctime; - timespec_legacy st_ex_btime; + timespec st_ex_atime; + timespec st_ex_mtime; + timespec st_ex_ctime; + timespec st_ex_btime; hyper st_ex_blksize; hyper st_ex_blocks; uint32 st_ex_flags; diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c index b6145c54729..043ef177e42 100644 --- a/source3/locking/brlock.c +++ b/source3/locking/brlock.c @@ -35,7 +35,7 @@ #include "messages.h" #include "util_tdb.h" #include "source3/locking/share_mode_lock.h" -#include "../librpc/gen_ndr/ndr_smbXsrv.h" +#include "../librpc/gen_ndr/ndr_open_files.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_LOCKING @@ -1654,7 +1654,7 @@ static void byte_range_lock_flush(struct byte_range_lock *br_lck) store_flags |= DBWRAP_STORE_PERSISTENT; } - PUSH_BE_U32(version_buf, 0, smbXsrv_version_global_current()); + PUSH_BE_U32(version_buf, 0, SHARE_MODE_DATA_VERSION_1); status = dbwrap_record_storev(br_lck->record, data, @@ -1692,7 +1692,7 @@ static bool brl_parse_data(struct byte_range_lock *br_lck, TDB_DATA data) return false; } version = PULL_BE_U32(data.dptr, 0); - if (version != SMBXSRV_VERSION_0) { + if (version != SHARE_MODE_DATA_VERSION_1) { DBG_WARNING("Invalid version: %"PRIu32"\n", version); return false; } diff --git a/source3/locking/share_mode_lock.c b/source3/locking/share_mode_lock.c index 9300c1e3ea1..600097d75df 100644 --- a/source3/locking/share_mode_lock.c +++ b/source3/locking/share_mode_lock.c @@ -259,9 +259,9 @@ static enum ndr_err_code get_share_mode_blob_header( .data = discard_const_p(uint8_t, buf), .data_size = buflen, }; - enum smbXsrv_version_values v; - NDR_CHECK(ndr_pull_smbXsrv_version_values(&ndr, NDR_SCALARS, &v)); - if (v != SMBXSRV_VERSION_0) { + enum share_mode_data_version v; + NDR_CHECK(ndr_pull_share_mode_data_version(&ndr, NDR_SCALARS, &v)); + if (v != SHARE_MODE_DATA_VERSION_1) { DBG_ERR("Invalid version\n"); return NDR_ERR_VALIDATE; } @@ -357,7 +357,7 @@ static struct share_mode_data *share_mode_memcache_fetch( */ struct share_mode_entry_buf { - uint8_t buf[140]; + uint8_t buf[128]; }; #define SHARE_MODE_ENTRY_SIZE (sizeof(struct share_mode_entry_buf)) @@ -619,14 +619,14 @@ static struct share_mode_data *parse_share_mode_data( goto fail; } - if (data_blob.version != SMBXSRV_VERSION_0) { + if (data_blob.version != SHARE_MODE_DATA_VERSION_1) { DBG_ERR("Invalid record in locking.tdb:" "key '%s' unsupported version: %d\n", file_id_str_buf(id, &idbuf), (int)data_blob.version); goto fail; } - d = data_blob.data.data0; + d = data_blob.data.data1; if (DEBUGLEVEL >= 10) { DBG_DEBUG("parse_share_modes:\n"); @@ -635,7 +635,7 @@ static struct share_mode_data *parse_share_mode_data( return d; fail: - TALLOC_FREE(data_blob.data.data0); + TALLOC_FREE(data_blob.data.data1); return NULL; } @@ -669,11 +669,11 @@ static NTSTATUS share_mode_data_ltdb_store(struct share_mode_data *d, enum ndr_err_code ndr_err; data_blob = (struct share_mode_dataB) { - .version = smbXsrv_version_global_current(), + .version = SHARE_MODE_DATA_VERSION_1, .unique_content_epoch = d->unique_content_epoch, .flags = d->flags, }; - data_blob.data.data0 = d; + data_blob.data.data1 = d; ndr_err = ndr_push_struct_blob( &blob,