diff options
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/globals.h | 2 | ||||
-rw-r--r-- | source3/smbd/smb2_create.c | 11 | ||||
-rw-r--r-- | source3/smbd/smbXsrv_open.c | 12 |
3 files changed, 18 insertions, 7 deletions
diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h index 9ea5e25bc0..6beee59e7b 100644 --- a/source3/smbd/globals.h +++ b/source3/smbd/globals.h @@ -457,7 +457,7 @@ NTSTATUS smb2srv_open_lookup(struct smbXsrv_connection *conn, NTSTATUS smb2srv_open_recreate(struct smbXsrv_connection *conn, struct auth_session_info *session_info, uint64_t persistent_id, - struct GUID create_guid, + const struct GUID *create_guid, NTTIME now, struct smbXsrv_open **_open); struct smbXsrv_open_global0; diff --git a/source3/smbd/smb2_create.c b/source3/smbd/smb2_create.c index 93cccf8445..fb9b56e36d 100644 --- a/source3/smbd/smb2_create.c +++ b/source3/smbd/smb2_create.c @@ -550,7 +550,8 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx, uint64_t allocation_size = 0; struct smb2_create_blob *twrp = NULL; struct smb2_create_blob *qfid = NULL; - struct GUID create_guid = GUID_zero(); + struct GUID _create_guid = GUID_zero(); + struct GUID *create_guid = NULL; bool update_open = false; bool durable_requested = false; uint32_t durable_timeout_msec = 0; @@ -668,10 +669,11 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx, create_guid_blob = data_blob_const(p + 16, 16); status = GUID_from_ndr_blob(&create_guid_blob, - &create_guid); + &_create_guid); if (tevent_req_nterror(req, status)) { return tevent_req_post(req, ev); } + create_guid = &_create_guid; /* * we need to store the create_guid later */ @@ -706,10 +708,11 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx, create_guid_blob = data_blob_const(p + 16, 16); status = GUID_from_ndr_blob(&create_guid_blob, - &create_guid); + &_create_guid); if (tevent_req_nterror(req, status)) { return tevent_req_post(req, ev); } + create_guid = &_create_guid; do_durable_reconnect = true; } @@ -940,7 +943,7 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx, } if (update_open) { - op->global->create_guid = create_guid; + op->global->create_guid = _create_guid; status = smbXsrv_open_update(op); DEBUG(10, ("smb2_create_send: smbXsrv_open_update " diff --git a/source3/smbd/smbXsrv_open.c b/source3/smbd/smbXsrv_open.c index 27dd50c65a..25dc6f7005 100644 --- a/source3/smbd/smbXsrv_open.c +++ b/source3/smbd/smbXsrv_open.c @@ -1168,7 +1168,7 @@ NTSTATUS smb2srv_open_lookup(struct smbXsrv_connection *conn, NTSTATUS smb2srv_open_recreate(struct smbXsrv_connection *conn, struct auth_session_info *session_info, uint64_t persistent_id, - struct GUID create_guid, + const struct GUID *create_guid, NTTIME now, struct smbXsrv_open **_open) { @@ -1207,7 +1207,15 @@ NTSTATUS smb2srv_open_recreate(struct smbXsrv_connection *conn, return status; } - if (!GUID_equal(&op->global->create_guid, &create_guid)) { + /* + * If the provided create_guid is NULL, this means that + * the reconnect request was a v1 request. In that case + * we should skipt the create GUID verification, since + * it is valid to v1-reconnect a v2-opened handle. + */ + if ((create_guid != NULL) && + !GUID_equal(&op->global->create_guid, create_guid)) + { TALLOC_FREE(op); return NT_STATUS_OBJECT_NAME_NOT_FOUND; } |