summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/libcli/smb2/create.c2
-rw-r--r--source4/torture/smb2/util.c28
2 files changed, 29 insertions, 1 deletions
diff --git a/source4/libcli/smb2/create.c b/source4/libcli/smb2/create.c
index 6047a85d87..7267f92126 100644
--- a/source4/libcli/smb2/create.c
+++ b/source4/libcli/smb2/create.c
@@ -227,7 +227,7 @@ struct smb2_request *smb2_create_send(struct smb2_tree *tree, struct smb2_create
}
if (io->in.lease_request_v2) {
- struct smb2_lease *ls = &io->in.lease_request_v2;
+ struct smb2_lease *ls = io->in.lease_request_v2;
uint8_t data[52];
memcpy(&data[0], &ls->lease_key, 16);
diff --git a/source4/torture/smb2/util.c b/source4/torture/smb2/util.c
index 7e882349c9..59748b7e25 100644
--- a/source4/torture/smb2/util.c
+++ b/source4/torture/smb2/util.c
@@ -729,6 +729,34 @@ void smb2_lease_create(struct smb2_create *io, struct smb2_lease *ls,
leasekey, leasestate);
}
+void smb2_lease_v2_create_share(struct smb2_create *io,
+ struct smb2_lease *ls,
+ bool dir,
+ const char *name,
+ uint32_t share_access,
+ uint64_t leasekey,
+ const uint64_t *parentleasekey,
+ uint32_t leasestate,
+ uint16_t lease_epoch)
+{
+ smb2_generic_create_share(io, NULL, dir, name, NTCREATEX_DISP_OPEN_IF,
+ share_access, SMB2_OPLOCK_LEVEL_LEASE, 0, 0);
+
+ if (ls) {
+ ZERO_STRUCT(*ls);
+ ls->lease_key.data[0] = leasekey;
+ ls->lease_key.data[1] = ~leasekey;
+ ls->lease_state = leasestate;
+ if (parentleasekey != NULL) {
+ ls->lease_flags |= SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET;
+ ls->parent_lease_key.data[0] = *parentleasekey;
+ ls->parent_lease_key.data[1] = ~(*parentleasekey);
+ }
+ ls->lease_epoch = lease_epoch;
+ io->in.lease_request_v2 = ls;
+ }
+}
+
void smb2_oplock_create_share(struct smb2_create *io, const char *name,
uint32_t share_access, uint8_t oplock)
{