summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/smbd/process.c2
-rw-r--r--source3/smbd/reply.c29
2 files changed, 29 insertions, 2 deletions
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index d0531bdfd9..2946eb878f 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -736,7 +736,7 @@ static const struct smb_message_struct {
/* 0x2b */ { "SMBecho",NULL,reply_echo,0},
/* 0x2c */ { "SMBwriteclose",reply_writeclose,NULL,AS_USER},
/* 0x2d */ { "SMBopenX",NULL,reply_open_and_X,AS_USER | CAN_IPC },
-/* 0x2e */ { "SMBreadX",reply_read_and_X,NULL,AS_USER | CAN_IPC },
+/* 0x2e */ { "SMBreadX",NULL,reply_read_and_X,AS_USER | CAN_IPC },
/* 0x2f */ { "SMBwriteX",NULL,reply_write_and_X,AS_USER | CAN_IPC },
/* 0x30 */ { NULL, NULL, NULL, 0 },
/* 0x31 */ { NULL, NULL, NULL, 0 },
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 3e35c0064b..7cfcecbf2f 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -2858,7 +2858,9 @@ normal_read:
Reply to a read and X.
****************************************************************************/
-int reply_read_and_X(connection_struct *conn, char *inbuf,char *outbuf,int length,int bufsize)
+static int reply_read_and_X_old(connection_struct *conn,
+ char *inbuf, char *outbuf,
+ int length,int bufsize)
{
files_struct *fsp;
SMB_OFF_T startpos;
@@ -2956,6 +2958,31 @@ int reply_read_and_X(connection_struct *conn, char *inbuf,char *outbuf,int lengt
return nread;
}
+void reply_read_and_X(connection_struct *conn, struct smb_request *req)
+{
+ char *inbuf, *outbuf;
+ int length, bufsize;
+ int outsize;
+
+ if (!reply_prep_legacy(req, &inbuf, &outbuf, &length, &bufsize)) {
+ reply_nterror(req, NT_STATUS_NO_MEMORY);
+ return;
+ }
+
+ outsize = reply_read_and_X_old(conn, inbuf, outbuf, length, bufsize);
+
+ DEBUG(10, ("outsize = %d\n", outsize));
+
+ /*
+ * Can't use reply_post_legacy here, setup_readX_header has set up its
+ * size itself already.
+ */
+
+ if (outsize == -1) {
+ TALLOC_FREE(req->outbuf);
+ }
+}
+
/****************************************************************************
Reply to a writebraw (core+ or LANMAN1.0 protocol).
****************************************************************************/