mirror of
https://github.com/samba-team/samba.git
synced 2025-02-10 13:57:47 +03:00
Convert read_smb_length to return NTSTATUS
This commit is contained in:
parent
73a79a957a
commit
5750c3a51b
@ -1174,31 +1174,18 @@ NTSTATUS read_smb_length_return_keepalive(int fd, char *inbuf,
|
|||||||
Timeout is in milliseconds.
|
Timeout is in milliseconds.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
ssize_t read_smb_length(int fd, char *inbuf, unsigned int timeout, enum smb_read_errors *pre)
|
NTSTATUS read_smb_length(int fd, char *inbuf, unsigned int timeout,
|
||||||
|
size_t *len)
|
||||||
{
|
{
|
||||||
size_t len;
|
|
||||||
uint8_t msgtype = SMBkeepalive;
|
uint8_t msgtype = SMBkeepalive;
|
||||||
|
|
||||||
set_smb_read_error(pre, SMB_READ_OK);
|
|
||||||
|
|
||||||
while (msgtype == SMBkeepalive) {
|
while (msgtype == SMBkeepalive) {
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
|
|
||||||
status = read_smb_length_return_keepalive(fd, inbuf, timeout,
|
status = read_smb_length_return_keepalive(fd, inbuf, timeout,
|
||||||
&len);
|
len);
|
||||||
if (!NT_STATUS_IS_OK(status)) {
|
if (!NT_STATUS_IS_OK(status)) {
|
||||||
if (NT_STATUS_EQUAL(status, NT_STATUS_END_OF_FILE)) {
|
return status;
|
||||||
set_smb_read_error(pre, SMB_READ_EOF);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT)) {
|
|
||||||
set_smb_read_error(pre, SMB_READ_TIMEOUT);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
set_smb_read_error(pre, SMB_READ_ERROR);
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
msgtype = CVAL(inbuf, 0);
|
msgtype = CVAL(inbuf, 0);
|
||||||
@ -1207,7 +1194,7 @@ ssize_t read_smb_length(int fd, char *inbuf, unsigned int timeout, enum smb_read
|
|||||||
DEBUG(10,("read_smb_length: got smb length of %lu\n",
|
DEBUG(10,("read_smb_length: got smb length of %lu\n",
|
||||||
(unsigned long)len));
|
(unsigned long)len));
|
||||||
|
|
||||||
return len;
|
return NT_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
@ -3492,18 +3492,12 @@ void reply_writebraw(struct smb_request *req)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Now read the raw data into the buffer and write it */
|
/* Now read the raw data into the buffer and write it */
|
||||||
if (read_smb_length(smbd_server_fd(),buf,
|
status = read_smb_length(smbd_server_fd(), buf, SMB_SECONDARY_WAIT,
|
||||||
SMB_SECONDARY_WAIT, get_srv_read_error()) == -1) {
|
&numtowrite);
|
||||||
|
if (!NT_STATUS_IS_OK(status)) {
|
||||||
exit_server_cleanly("secondary writebraw failed");
|
exit_server_cleanly("secondary writebraw failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Even though this is not an smb message,
|
|
||||||
* smb_len returns the generic length of a packet.
|
|
||||||
*/
|
|
||||||
|
|
||||||
numtowrite = smb_len(buf);
|
|
||||||
|
|
||||||
/* Set up outbuf to return the correct size */
|
/* Set up outbuf to return the correct size */
|
||||||
reply_outbuf(req, 1, 0);
|
reply_outbuf(req, 1, 0);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user