#include "includes.h"
#include "system/filesys.h"
+#include "lib/util/server_id.h"
#include "smbd/smbd.h"
#include "smbd/globals.h"
#include "libcli/security/security.h"
{
int ret;
- if (cookie_st->st_ex_dev != fsp_st->st_ex_dev) {
- DEBUG(1, ("vfs_default_durable_reconnect (%s): "
- "stat_ex.%s differs: "
- "cookie:%llu != stat:%llu, "
- "denying durable reconnect\n",
- name,
- "st_ex_dev",
- (unsigned long long)cookie_st->st_ex_dev,
- (unsigned long long)fsp_st->st_ex_dev));
- return false;
- }
-
- if (cookie_st->st_ex_ino != fsp_st->st_ex_ino) {
- DEBUG(1, ("vfs_default_durable_reconnect (%s): "
- "stat_ex.%s differs: "
- "cookie:%llu != stat:%llu, "
- "denying durable reconnect\n",
- name,
- "st_ex_ino",
- (unsigned long long)cookie_st->st_ex_ino,
- (unsigned long long)fsp_st->st_ex_ino));
- return false;
- }
-
if (cookie_st->st_ex_mode != fsp_st->st_ex_mode) {
DEBUG(1, ("vfs_default_durable_reconnect (%s): "
"stat_ex.%s differs: "
}
/* Create an smb_filename with stream_name == NULL. */
- smb_fname = synthetic_smb_fname(talloc_tos(), cookie.base_name,
- NULL, NULL);
+ smb_fname = synthetic_smb_fname(talloc_tos(),
+ cookie.base_name,
+ NULL,
+ NULL,
+ 0);
if (smb_fname == NULL) {
return NT_STATUS_NO_MEMORY;
}
fsp->aio_write_behind = false;
fsp->oplock_type = e->op_type;
+ if (fsp->oplock_type == LEASE_OPLOCK) {
+ struct share_mode_lease *l = &lck->data->leases[e->lease_idx];
+ struct smb2_lease_key key;
+
+ key.data[0] = l->lease_key.data[0];
+ key.data[1] = l->lease_key.data[1];
+
+ fsp->lease = find_fsp_lease(fsp, &key, l);
+ if (fsp->lease == NULL) {
+ TALLOC_FREE(lck);
+ fsp_free(fsp);
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ /*
+ * Ensure the existing client guid matches the
+ * stored one in the share_mode_lease.
+ */
+ if (!GUID_equal(fsp_client_guid(fsp),
+ &l->client_guid)) {
+ TALLOC_FREE(lck);
+ fsp_free(fsp);
+ return NT_STATUS_OBJECT_NAME_NOT_FOUND;
+ }
+ }
+
fsp->initial_allocation_size = cookie.initial_allocation_size;
fsp->fh->position_information = cookie.position_information;
fsp->update_write_time_triggered = cookie.update_write_time_triggered;