diff options
author | Stefan Metzmacher <metze@samba.org> | 2008-08-13 09:48:44 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2008-08-14 13:13:50 +0200 |
commit | 2a36568129877273f6c559bd5c3bdb8f2efef8c7 (patch) | |
tree | cb3727d5b08d60e03db41b8e903a0ab38e1a4741 /source4 | |
parent | 0294c678c0665e675673ff477df26fddd8ed53dd (diff) | |
download | samba-2a36568129877273f6c559bd5c3bdb8f2efef8c7.tar.gz samba-2a36568129877273f6c559bd5c3bdb8f2efef8c7.tar.bz2 samba-2a36568129877273f6c559bd5c3bdb8f2efef8c7.zip |
smb2srv: async replies with STATUS_PENDING are not signed
..., but the they may have the sign flag set.
metze
(This used to be commit 43e43dead030f6bffd06631007fdb162c3c6b2b5)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/smb_server/smb2/receive.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/source4/smb_server/smb2/receive.c b/source4/smb_server/smb2/receive.c index bcc91e4ee3..1fe6f0b877 100644 --- a/source4/smb_server/smb2/receive.c +++ b/source4/smb_server/smb2/receive.c @@ -506,6 +506,8 @@ static NTSTATUS smb2srv_init_pending(struct smbsrv_connection *smb_conn) NTSTATUS smb2srv_queue_pending(struct smb2srv_request *req) { + NTSTATUS status; + bool signing_used = false; int id; if (req->pending_id) { @@ -521,10 +523,35 @@ NTSTATUS smb2srv_queue_pending(struct smb2srv_request *req) DLIST_ADD_END(req->smb_conn->requests2.list, req, struct smb2srv_request *); req->pending_id = id; + if (req->smb_conn->connection->event.fde == NULL) { + /* the socket has been destroyed - no point trying to send an error! */ + return NT_STATUS_REMOTE_DISCONNECT; + } + talloc_set_destructor(req, smb2srv_request_deny_destructor); - smb2srv_send_error(req, STATUS_PENDING); - talloc_set_destructor(req, smb2srv_request_destructor); + status = smb2srv_setup_reply(req, 8, true, 0); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + SIVAL(req->out.hdr, SMB2_HDR_STATUS, NT_STATUS_V(STATUS_PENDING)); + + SSVAL(req->out.body, 0x02, 0); + SIVAL(req->out.body, 0x04, 0); + + /* if the real reply will be signed set the signed flags, but don't sign */ + if (req->is_signed) { + SIVAL(req->out.hdr, SMB2_HDR_FLAGS, IVAL(req->out.hdr, SMB2_HDR_FLAGS) | SMB2_HDR_FLAG_SIGNED); + signing_used = req->is_signed; + req->is_signed = false; + } + + smb2srv_send_reply(req); + + req->is_signed = signing_used; + + talloc_set_destructor(req, smb2srv_request_destructor); return NT_STATUS_OK; } |