}
static bool test_fruit_locking_conflict(struct torture_context *tctx,
- struct smb2_tree *tree)
+ struct smb2_tree *tree,
+ struct smb2_tree *tree2)
{
TALLOC_CTX *mem_ctx;
struct smb2_create create;
CHECK_STATUS(status, NT_STATUS_OK);
h = create.out.file.handle;
+ /* Add AD_FILELOCK_RSRC_DENY_WR lock. */
el = (struct smb2_lock_element) {
.offset = 0xfffffffffffffffc,
.length = 1,
.in.locks = &el,
};
+ /*
+ * Lock up to and including:
+ * AD_FILELOCK_OPEN_WR
+ * AD_FILELOCK_OPEN_RD
+ * This is designed to cause a NetAtalk
+ * locking conflict on the next open,
+ * even though the share modes are
+ * compatible.
+ */
status = smb2_lock(tree, &lck);
CHECK_STATUS(status, NT_STATUS_OK);
el = (struct smb2_lock_element) {
.offset = 0,
- .length = 0x7fffffffffffffff,
+ .length = 0x7ffffffffffffff7,
.flags = SMB2_LOCK_FLAG_EXCLUSIVE,
};
status = smb2_lock(tree, &lck);
.in.fname = fname,
};
- status = smb2_create(tree, mem_ctx, &create);
- CHECK_STATUS(status, NT_STATUS_FILE_LOCK_CONFLICT);
+ /*
+ * Open on the second tree - ensure we are
+ * emulating trying to access with a NetATalk
+ * process with an existing open/deny mode.
+ */
+ status = smb2_create(tree2, mem_ctx, &create);
+ CHECK_STATUS(status, NT_STATUS_SHARING_VIOLATION);
{
struct smb2_close cl = {
torture_suite_add_1smb2_test(suite, "read netatalk metadata", test_read_netatalk_metadata);
torture_suite_add_1smb2_test(suite, "stream names with locally created xattr", test_stream_names_local);
- torture_suite_add_1smb2_test(
+ torture_suite_add_2smb2_test(
suite, "locking conflict", test_fruit_locking_conflict);
return suite;