From 1bd2ab41611fc66386d8d7d0e4c7d4f948177eab Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 25 Sep 2013 23:20:18 +0200 Subject: smbd:smb2: successfully answer a DHnC request when the initial create was DH2Q I.e. the durable reconnect attempt is v1 while the original create was durable v2 including the create guid. Implement this by skipping the create_guid verification when the reconnect request is v1. Signed-off-by: Michael Adam Reviewed-by: Jeremy Allison Reviewed-by: Stefan Metzmacher --- source3/smbd/globals.h | 2 +- source3/smbd/smb2_create.c | 11 +++++++---- source3/smbd/smbXsrv_open.c | 12 ++++++++++-- 3 files changed, 18 insertions(+), 7 deletions(-) (limited to 'source3/smbd') 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; } -- cgit