diff options
author | Stefan Metzmacher <metze@samba.org> | 2012-10-31 09:06:48 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2013-04-18 15:11:48 +0200 |
commit | 3c9846cafde28fb8d40ae81cafb03f2e2ec8d9e2 (patch) | |
tree | 25fb67e3251e16a2a57f91628649c91a1c49b0ec | |
parent | 6c81893b342786d5f63aaa89e855e9378def50c3 (diff) | |
download | samba-3c9846cafde28fb8d40ae81cafb03f2e2ec8d9e2.tar.gz samba-3c9846cafde28fb8d40ae81cafb03f2e2ec8d9e2.tar.bz2 samba-3c9846cafde28fb8d40ae81cafb03f2e2ec8d9e2.zip |
s4:torture/smb2: add smb2_lease_v2_create_share() helper
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
-rw-r--r-- | source4/libcli/smb2/create.c | 2 | ||||
-rw-r--r-- | source4/torture/smb2/util.c | 28 |
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) { |