/*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
*/
/*
* Copyright 2015 Nexenta Systems, Inc. All rights reserved.
*/
/*
* Dispatch function for SMB2_READ
*/
#include <smbsrv/smb2_kproto.h>
#include <smbsrv/smb_fsops.h>
{
int rc = 0;
/*
* SMB2 Read request
*/
"wb.lqqqlllww",
&StructSize, /* w */
&Padding, /* b. */
&Length, /* l */
&Offset, /* q */
&MinCount, /* l */
&Channel, /* l */
&Remaining, /* l */
&ChanInfoOffset, /* w */
&ChanInfoLength); /* w */
if (rc)
return (SDRC_ERROR);
if (StructSize != 49)
return (SDRC_ERROR);
if (status) {
return (SDRC_SUCCESS);
}
if (Length > smb2_max_rwsize) {
return (SDRC_SUCCESS);
}
/* This is automatically free'd. */
case STYPE_DISKTREE:
/* Check for conflicting locks. */
if (rc) {
break;
}
}
break;
case STYPE_IPC:
break;
default:
case STYPE_PRINTQ:
break;
}
/* How much data we moved. */
smb_mbuf_trim(m, XferCount);
/*
* Checking the error return _after_ dealing with
* the returned data so that if m was allocated,
* it will be free'd via sr->raw_data cleanup.
*/
if (rc) {
return (SDRC_SUCCESS);
}
/*
* SMB2 Read reply
*/
"wb.lllC",
17, /* StructSize */ /* w */
DataOff, /* b. */
XferCount, /* l */
0, /* DataRemaining */ /* l */
0, /* reserved */ /* l */
if (rc)
return (SDRC_ERROR);
return (SDRC_SUCCESS);
}